示例#1
0
    def attach_cylinder(self,
                        name=u'cylinder',
                        height=1,
                        radius=1,
                        frame_id=None,
                        position=None,
                        orientation=None):
        """
        Add a cylinder to the world and attach it to the robot at frame_id.
        If pose is used, frame_id, position and orientation are ignored.
        :type name: str
        :type height: int
        :param height: height of the cylinder. Default = 1
        :type radius: int
        :param radius: radius of the cylinder. Default = 1
        :type frame_id: str
        :type position: list
        :type orientation: list
        :rtype: UpdateWorldResponse
        """
        cylinder = make_world_body_cylinder(name, height, radius)
        pose = PoseStamped()
        pose.header.stamp = rospy.Time.now()
        pose.header.frame_id = str(
            frame_id) if frame_id is not None else u'map'
        pose.pose.position = Point(
            *(position if position is not None else [0, 0, 0]))
        pose.pose.orientation = Quaternion(
            *(orientation if orientation is not None else [0, 0, 0, 1]))

        req = UpdateWorldRequest(UpdateWorldRequest.ADD, cylinder, True, pose)
        return self._update_world_srv.call(req)
示例#2
0
    def attach_cylinder(self, name=u'cylinder', height=1, radius=1, frame_id=None, position=None, orientation=None):
        """
        :type name: str
        :type size: list
        :type frame_id: str
        :type position: list
        :type orientation: list
        :rtype: UpdateWorldResponse
        """
        cylinder = make_world_body_cylinder(name, height, radius)
        pose = PoseStamped()
        pose.header.stamp = rospy.Time.now()
        pose.header.frame_id = str(frame_id) if frame_id is not None else u'map'
        pose.pose.position = Point(*(position if position is not None else [0, 0, 0]))
        pose.pose.orientation = Quaternion(*(orientation if orientation is not None else [0, 0, 0, 1]))

        req = UpdateWorldRequest(UpdateWorldRequest.ADD, cylinder, True, pose)
        return self.update_world.call(req)
示例#3
0
 def test_from_world_body_mesh(self, function_setup):
     wb = make_world_body_cylinder()
     urdf_obj = self.cls.from_world_body(wb)
     assert len(urdf_obj.get_link_names()) == 1
     assert len(urdf_obj.get_joint_names()) == 0
示例#4
0
 def test_from_world_body_cylinder(self, function_setup):
     wb = make_world_body_cylinder()
     urdf_obj = self.cls.from_world_body(wb,
                                         calc_self_collision_matrix=False)
     assert len(urdf_obj.get_link_names()) == 1
     assert len(urdf_obj.get_joint_names()) == 0