def __init__( self, initial_se3, structure, g_canvas, qlim, theta, axis_through=array([1, 0, 0])): if not isinstance( structure, float) and not isinstance(structure, PurePath): error_str = "structure must be of type {0} or {1}. Given {2}. " \ "Either give a length (float)," \ "or meshdata [filepath, scale, origindata]" raise TypeError(error_str.format(float, str, type(structure))) self.qlim = qlim self.theta = theta self.__scene = g_canvas.scene self.__pose = initial_se3 # Set the graphic # self.stl_offset = None self.__graphic_obj = self.__set_graphic(structure, axis_through) self.visible = True # Set the other reference frame vectors self.__graphic_ref = draw_reference_frame_axes( self.__pose, self.__scene) # Apply the initial pose self.update_pose(self.__pose)
def __init__( self, initial_se3, structure, g_canvas, qlim, theta, axis_through=array([1, 0, 0])): # Call super init function super().__init__( initial_se3, structure, g_canvas, qlim, theta, axis_through)
def __init__( self, initial_se3, structure, g_canvas, qlim, theta, axis_through=array([1, 0, 0])): super().__init__( initial_se3, structure, g_canvas, qlim, theta, axis_through) self.min_translation = None self.max_translation = None
def append_link(self, typeof, pose, structure, qlim, theta, axis_through=array([1, 0, 0])): """ Append a joint to the end of the robot. :param typeof: String character of the joint type. e.g. 'R', 'P', 'S', 'G' :type typeof: `str` :param pose: SE3 object for the pose of the joint :type pose: class:`spatialmath.pose3d.SE3` :param structure: either a float of the length of the joint, or a list of str of the filepath and scale :type structure: `float`, `list` :param qlim: A list of the angle limits for the joint :type qlim: `list` :param theta: The current angle of the joint in radians :type theta: `float` :param axis_through: The axis that the longest side goes through :type axis_through: class:`numpy.ndarray` :raises ValueError: typeof must be a valid character """ # Capitalise the type for case-insensitive use typeof = typeof.upper() if typeof == 'R': link = RotationalJoint(pose, structure, self.__scene, qlim, theta, axis_through) elif typeof == 'P': link = PrismaticJoint(pose, structure, self.__scene, qlim, theta, axis_through) elif typeof == 'S': link = StaticJoint(pose, structure, self.__scene, qlim, theta, axis_through) elif typeof == 'G': link = Gripper(pose, structure, self.__scene, qlim, theta, axis_through) else: raise ValueError( "typeof should be (case-insensitive) either 'R' (Rotational)" ", 'P' (Prismatic), 'S' (Static), or 'G' (Gripper)") # Append the joint to the robot self.joints.append(link) self.num_joints += 1 self.angles.append(theta)