def __init__(self): rospy.init_node('arm_trajectory') self.relaxedIK = RelaxedIK.init_from_config(config_file_name) self.left_js_pub = rospy.Publisher('/left_arm_controller/command', JointTrajectory, queue_size=1) self.weight_array = [0, 0, 0, 0, 0, 1, 1, 1, 1, 50, 1, 1] for ind, wi in enumerate(self.weight_array): self.relaxedIK.vars.weight_funcs[ind].set_value(wi)
def __init__(self): rospy.init_node('multiplex_node') self.control_state = None self.weight_array = [] self.right_pose = Pose() self.left_pose = Pose() self.relaxedIK = RelaxedIK.init_from_config(config_file_name) self.left_js_pub = rospy.Publisher('/left_arm_controller/command', JointTrajectory, queue_size=1) self.right_js_pub = rospy.Publisher('/right_arm_controller/command', JointTrajectory, queue_size=1) rospy.Subscriber('/controlState', String, self.cb_control_state, queue_size=1) rospy.Subscriber('/uiJointPose', JointState, self.cb_joint_control, queue_size=1) # rospy.Subscriber('/uiJointPose', JointState, self.cb_joint_control, queue_size=1) rospy.Subscriber('/uiCartesianPose', Pose, self.cb_cartesion_control, queue_size=1) rospy.Subscriber('/joint_states', JointState, self.cb_objective_control, queue_size=1) rospy.Subscriber('/gazebo/link_states', LinkStates, self.cb_ee_pose_state, queue_size=1) rospy.Subscriber('/uiRelaxedIk', JointState, self.cb_obj_weight, queue_size=1)
def __init__(self): rospy.loginfo("Follower Node started.") ''' you could put class data variables in here if you wanted to. current_joint_states = JointState() #eepg = None #def eePoseGoals_cb(data): # global eepg # eepg = data ''' rospy.Subscriber('/robot/joint_states', JointState, callback_pose) angles_pub = rospy.Publisher('/relaxed_ik/joint_angle_solutions', JointAngles, queue_size=3) config_file_name = 'second_victory.config' #rospy.get_param('config_file_name', default='second_victory.config') my_relaxedIK = RelaxedIK.init_from_config(config_file_name) num_chains = my_relaxedIK.vars.robot.numChains rospy.loginfo("rospy.spin()") rospy.spin()
joint_state_define, collision_file_name, fixed_frame, config_file_name from RelaxedIK.relaxedIK import RelaxedIK from RelaxedIK.GROOVE_RelaxedIK.relaxedIK_vars import RelaxedIK_vars from sensor_msgs.msg import JointState import rospy import roslaunch import os import tf import math if __name__ == '__main__': # Don't change this code#################################################################################### rospy.init_node('sample_node') #################################################################################################################### relaxedIK = RelaxedIK.init_from_config(config_file_name) #################################################################################################################### urdf_file = open(relaxedIK.vars.urdf_path, 'r') urdf_string = urdf_file.read() rospy.set_param('robot_description', urdf_string) js_pub = rospy.Publisher('joint_states', JointState, queue_size=5) tf_pub = tf.TransformBroadcaster() rospy.sleep(0.3) # Don't change this code ########################################################################################### uuid = roslaunch.rlutil.get_or_generate_uuid(None, False) roslaunch.configure_logging(uuid) launch_path = os.path.dirname( __file__) + '/../launch/robot_state_pub.launch'
joint_state_define, collision_file_name, fixed_frame, config_file_name from RelaxedIK.relaxedIK import RelaxedIK from RelaxedIK.GROOVE_RelaxedIK.relaxedIK_vars import RelaxedIK_vars from sensor_msgs.msg import JointState import rospy import roslaunch import os import tf import math if __name__ == '__main__': # Don't change this code#################################################################################### rospy.init_node('sample_node') #################################################################################################################### relaxedIK = RelaxedIK.init_from_config('hubo.config') #################################################################################################################### urdf_file = open(relaxedIK.vars.urdf_path, 'r') urdf_string = urdf_file.read() rospy.set_param('robot_description', urdf_string) js_pub = rospy.Publisher('joint_states', JointState, queue_size=5) tf_pub = tf.TransformBroadcaster() rospy.sleep(0.3) # Don't change this code ########################################################################################### uuid = roslaunch.rlutil.get_or_generate_uuid(None, False) roslaunch.configure_logging(uuid) launch_path = os.path.dirname( __file__) + '/../launch/robot_state_pub.launch'