5 import robowflex_visualization
as rv
22 self.
collectioncollection = rv.utils.get_collection(name)
26 self.
collectioncollection = rv.utils.make_collection(name)
32 self.
shapesshapes[item.name] = item
39 self.
filepathfilepath = resolved = rv.utils.resolve_path(scene_file)
40 self.
yamlyaml = rv.utils.read_YAML_data(scene_file)
42 if "world" in self.
yamlyaml
and self.
yamlyaml[
"world"][
"collision_objects"]:
43 for co
in self.
yamlyaml[
"world"][
"collision_objects"]:
46 if "robot_state" in self.
yamlyaml:
47 if "attached_collision_objects" in self.
yamlyaml[
"robot_state"].keys():
48 for cao
in self.
yamlyaml[
"robot_state"][
"attached_collision_objects"]:
56 if 'primitives' in co:
57 shapes = co[
'primitives']
58 poses = co[
'primitive_poses']
61 poses = co[
'mesh_poses']
63 for shape, pose
in zip(shapes, poses):
64 self.
add_shapeadd_shape(co[
"id"], shape, pose)
73 if not 'color' in shape:
74 shape[
'color'] = (0.0, 0.9, 0.2)
76 obj = rv.primitives.add_shape(shape)
79 self.
shapesshapes[name] = obj
81 rv.utils.deselect_all()
82 rv.utils.set_pose(obj, pose)
83 rv.utils.select_all_children(obj)
84 rv.utils.move_selected_to_collection(self.
namename)
85 rv.utils.deselect_all()
91 return self.
shapesshapes[name]
Container for MoveIt planning scenes in Blender.
def add_collision_object(self, co)
Adds a collision object (moveit_msgs::CollisionObject) to the scene.
def load_scene(self, scene_file)
Loads a YAML moveit_msgs::PlanningScene into Blender.
def __init__(self, name, scene_file)
Constructor.
def get_object(self, name)
Retrieve a named object in the scene.
def add_shape(self, name, shape, pose)
Adds a shape (either shape_msgs::SolidPrimitive or shape_msgs::Mesh) to the scene.