7 from sensor_msgs.msg
import Joy
22 baudrate = rospy.get_param(
'~baudrate', 9600)
24 self.serialDev.port = rospy.get_param(
"~serial_device")
30 rospy.loginfo(
'velocities:%s\n' % self.
velocities)
31 rospy.loginfo(
'positions:%s\n' % self.
positions)
32 encoded_position = struct.pack(
"<fffffff",
41 self.serialDev.write(encoded_position)
57 SPEED_MULTIPLIER = 0.5
61 self.
velocities[
'base_yaw'] = data.axes[2] / 5.0 * SPEED_MULTIPLIER
65 self.
velocities[
'lower_elbow'] = data.axes[1] / 3.0 * SPEED_MULTIPLIER
69 self.
velocities[
'upper_elbow'] = data.axes[5] / 5.0 * SPEED_MULTIPLIER
73 self.
positions[
'camera'] = np.interp(data.axes[3],[-1,1],[7,77])
78 self.
velocities[
'wrist_roll'] = 0.35 * SPEED_MULTIPLIER
80 self.
velocities[
'wrist_roll'] = -0.35 * SPEED_MULTIPLIER
85 self.
velocities[
'wrist_pitch'] = 0.15 * SPEED_MULTIPLIER
87 self.
velocities[
'wrist_pitch'] = -0.15 * SPEED_MULTIPLIER
101 rospy.init_node(
"simple_arm")
def arm_joy_callback(self, data)