14 from jog_msgs.msg
import JogJoint
15 from sensor_msgs.msg
import Joy
20 self.
pub = rospy.Publisher(
'jog_joint', JogJoint, queue_size=1)
27 msg.header.stamp = rospy.Time.now()
28 msg.header.frame_id =
'base_link' 29 msg.name = [
'joint1',
'joint2',
'joint3',
'joint4',
'joint5',
'joint6']
31 msg.displacement = [0]*6
32 msg.displacement[0] = 0.05*(-joy.buttons[4] + joy.buttons[5])
33 msg.displacement[1] = 0.05*(joy.axes[0])
34 msg.displacement[2] = 0.05*(joy.axes[1])
35 msg.displacement[3] = 0.05*(joy.buttons[0] - joy.buttons[1])
36 msg.displacement[4] = 0.05*(joy.buttons[2] - joy.buttons[3])
37 msg.displacement[5] = 0.05*(joy.buttons[7] - joy.buttons[6])
42 rospy.Subscriber(
"joy", Joy, self.
callback)
46 if __name__ ==
'__main__':
47 rospy.init_node(
'joy_to_jog_joint', anonymous=
True)
49 republisher.republish()