fake_wheels_pub.py 479 B

123456789101112131415161718
  1. #!/usr/bin/env python
  2. import rospy
  3. from sensor_msgs.msg import JointState
  4. rospy.init_node("fake_pub")
  5. p = rospy.Publisher('joint_states', JointState, queue_size=5)
  6. msg = JointState()
  7. msg.name = ["front_castor_joint", "left_wheel_joint", "rear_castor_joint", "right_wheel_joint"]
  8. msg.position = [0.0 for name in msg.name]
  9. msg.velocity = [0.0 for name in msg.name]
  10. while not rospy.is_shutdown():
  11. msg.header.stamp = rospy.Time.now()
  12. p.publish(msg)
  13. rospy.sleep(0.1)