ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You don't need to publish multiple times
here is an example of using different message types:
pub = rospy.Publisher('/delta_robot/delta_robot_controller/command', JointTrajectory, queue_size=10)
joints_str = JointTrajectory()
joints_str.header = Header()
joints_str.header.stamp = rospy.Time.now()
joints_str.joint_names = ['motor_1_uleg_1', 'motor_2_uleg_2', 'motor_3_uleg_3']
point=JointTrajectoryPoint()
point.positions = [var1, var2, var3]
point.time_from_start = rospy.Duration(2)
joints_str.points.append(point)
pub.publish(joints_str)
rospy.loginfo("position updated")