Added friction and damping support
This commit is contained in:
parent
c407cd82b9
commit
e28ff36674
2 changed files with 16 additions and 2 deletions
|
@ -38,6 +38,7 @@ def export_gazebo_model(assembly_file, model_dir, configs={}):
|
|||
model.sdf_version = '1.5'
|
||||
|
||||
joint_limits = configs.get('joints_limits', {})
|
||||
joint_dynamics = configs.get('joints_dynamics', {})
|
||||
|
||||
constraints = []
|
||||
for obj in doc.Objects:
|
||||
|
@ -112,7 +113,9 @@ def export_gazebo_model(assembly_file, model_dir, configs={}):
|
|||
lower_limit=joint_limits.get('lower', -90),
|
||||
upper_limit=joint_limits.get('upper', 90),
|
||||
effort_limit=joint_limits.get('effort', 10),
|
||||
velocity_limit=joint_limits.get('velocity', 10))
|
||||
velocity_limit=joint_limits.get('velocity', 10),
|
||||
friction=joint_dynamics.get('friction', 0),
|
||||
damping=joint_dynamics.get('damping', 0))
|
||||
|
||||
joint = Joint(name=parent.Label+'_'+child.Label,
|
||||
pose=joint_pose,
|
||||
|
|
|
@ -290,6 +290,8 @@ class Axis(SpatialEntity):
|
|||
self.upper_limit = kwargs.get('upper_limit', 0)
|
||||
self.effort_limit = kwargs.get('effort_limit', 0)
|
||||
self.velocity_limit = kwargs.get('velocity_limit', 0)
|
||||
self.friction = kwargs.get('friction', 0)
|
||||
self.damping = kwargs.get('damping', 0)
|
||||
self.use_parent_frame = kwargs.get('use_parent_frame', False)
|
||||
|
||||
def to_xml(self, fmt='sdf'):
|
||||
|
@ -310,6 +312,11 @@ class Axis(SpatialEntity):
|
|||
effort.text = flt2str(self.effort_limit)
|
||||
velocity = ET.SubElement(limit, 'velocity')
|
||||
velocity.text = flt2str(self.velocity_limit)
|
||||
dynamics = ET.SubElement(axis, 'dynamics')
|
||||
friction = ET.SubElement(dynamics, 'friction')
|
||||
friction.text = flt2str(self.friction)
|
||||
damping = ET.SubElement(dynamics, 'damping')
|
||||
damping.text = flt2str(self.damping)
|
||||
use_parent_frame = ET.SubElement(axis, 'use_parent_model_frame')
|
||||
use_parent_frame.text = str(self.use_parent_frame).lower()
|
||||
else:
|
||||
|
@ -321,7 +328,11 @@ class Axis(SpatialEntity):
|
|||
limit.set('effort', flt2str(self.effort_limit))
|
||||
limit.set('velocity', flt2str(self.velocity_limit))
|
||||
|
||||
return [axis, limit]
|
||||
dynamics = ET.Element('dynamics')
|
||||
dynamics.set('friction', flt2str(self.friction))
|
||||
dynamics.set('damping', flt2str(self.damping))
|
||||
|
||||
return [axis, limit, dynamics]
|
||||
return axis
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue