|
def | __init__ (self, name, urdf, make_pretty=True) |
| Constructor. More...
|
|
def | load_urdf (self, urdf, load=True) |
| Loads the URDF as a COLLADA mesh, as well as loading the XML. More...
|
|
def | get_link (self, link_name) |
| Gets a Blender object corresponding to a link on the robot. More...
|
|
def | get_link_xml (self, link_name) |
| Get the XML description in the URDF of a link. More...
|
|
def | get_joint_xml (self, joint_name) |
| Get the XML description in the URDF of a joint. More...
|
|
def | set_joint (self, joint_name, value, interpolate=True) |
| Set the value of a 1-DoF joint in the URDF. More...
|
|
def | set_joint_tf (self, joint_name, tf, interpolate=True) |
| Set the value of a 6-DoF joint in the URDF. More...
|
|
def | add_keyframe (self, joint_name, frame) |
| Adds a keyframe to a joint in the URDF at a frame in the animation timeline. More...
|
|
def | animate_path (self, path_file, fps=60., start=30, reverse=False, interpolate=False) |
| Adds keyframes to animate a moveit_msgs::RobotTrajectoryMsg. More...
|
|
def | set_state (self, state_file) |
| Sets the robot's state from a file with a moveit_msgs::RobotState. More...
|
|
def | attach_object (self, link_name, item, frame) |
| Attaches an object to a link of the robot. More...
|
|
def | detach_object (self, link_name, item, frame) |
| Detaches an object to a link of the robot. More...
|
|
def | prettify (self) |
| Cleans up robot mesh geometry and applies modifiers to improve rendering aesthetics. More...
|
|
def | load_link_mesh (self, link_name) |
| Loads the mesh data for a specific link on the robot. More...
|
|
def | clear_animation_data (self) |
| Clear all animation data for this robot. More...
|
|
def | get_root (self) |
| Get the root link of this robot. More...
|
|
Controllable URDF described robot.
This class loads a URDF from the package resource URI under a Blender collection.
Definition at line 18 of file robot.py.
def robowflex_visualization.robot.Robot.load_link_mesh |
( |
|
self, |
|
|
|
link_name |
|
) |
| |
Loads the mesh data for a specific link on the robot.
If the mesh is originally a COLLADA mesh, loads and replaces current mesh data. This provides better textures if they exist, as collada_urdf does not preserve them when converting the robot.
- Parameters
-
link_name | Name of the link to the load the mesh for. |
Definition at line 332 of file robot.py.
332 def load_link_mesh(self, link_name):
333 link_xml = self.get_link_xml(link_name)
335 name = self.name +
"_temp"
336 collection = rv.utils.make_collection(name)
339 visual = link_xml.visuals[0]
340 geometry = visual.geometry
343 if hasattr(geometry,
'filename')
and ".dae" in geometry.filename:
344 meshes, top = rv.primitives.add_mesh(
345 {
"resource": geometry.filename})
347 rv.utils.deselect_all()
348 bpy.context.view_layer.objects.active = meshes[0]
350 mesh.select_set(
True)
351 bpy.ops.object.join()
352 rv.utils.move_selected_to_collection(name)
353 rv.utils.deselect_all()
355 old = self.get_link(link_name)
356 old.data = meshes[0].data
358 rv.utils.remove_collection(name)
def robowflex_visualization.robot.Robot.set_joint_tf |
( |
|
self, |
|
|
|
joint_name, |
|
|
|
tf, |
|
|
|
interpolate = True |
|
) |
| |
Set the value of a 6-DoF joint in the URDF.
Assumes input transform is of the form: { 'translation' : [x, y, z], 'rotation' : [x, y, z, w] }
- Parameters
-
joint_name | Name of the joint to set in the robot. |
tf | YAML of the transform. |
interpolate | If true, will attempt to make quaternions compatible with current pose. |
Definition at line 182 of file robot.py.
182 def set_joint_tf(self, joint_name, tf, interpolate = True):
184 if joint_name ==
"virtual_joint":
185 root = self.get_root().name
186 link_xml = self.get_link_xml(root)
187 link = self.get_link(root)
189 joint_xml = self.get_joint_xml(joint_name)
190 link_xml = self.get_link_xml(joint_xml.child)
191 link = self.get_link(joint_xml.child)
193 link.rotation_mode =
"QUATERNION"
194 link.location = tf[
'translation']
196 q = mathutils.Quaternion([tf[
'rotation'][3]] + tf[
'rotation'][:3])
198 q.make_compatible(link.rotation_quaternion)
200 link.rotation_quaternion = q