Hi everyone!
I’m trying to send velocity to joint on my own robot. Everything works fine with position, however it doesn’t work with speed of Joint. I’m using code from example Rostopics.
Code with positions:
rospy.init_node("test_rosbridge", anonymous=True)
pub = rospy.Publisher("/joint_command", JointState, queue_size=10)
rate = rospy.Rate(20)
joint_state = JointState()
joint_state.name = [
"front_left_wheel",
"front_right_wheel",
"rear_left_wheel",
"rear_right_wheel"
]
num_joints = len(joint_state.name)
joint_state.position = np.array([0.0] * num_joints)
joints = np.array([0.0, 0.0, 0.0, 0.0])
while not rospy.is_shutdown():
joints += 0.1
joint_state.position = joints
pub.publish(joint_state)
rate.sleep()
Code with velocity:
rospy.init_node("test_rosbridge", anonymous=True)
pub = rospy.Publisher("/joint_command", JointState, queue_size=10)
rate = rospy.Rate(20)
joint_state = JointState()
joint_state.name = [
"front_left_wheel",
"front_right_wheel",
"rear_left_wheel",
"rear_right_wheel"
]
num_joints = len(joint_state.name)
joint_state.velocity = np.array([1.0] * num_joints)
while not rospy.is_shutdown():
pub.publish(joint_state)
rate.sleep()