ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

how to load a joint trajectory (moveit)?

asked 2022-12-15 18:11:55 -0500

mancio gravatar image

Hi! I'm losing my mind trying to understand it! I work with ubuntu 20.04 and ros noetic. I did my simulation using moveit and interfacing it with gazebo. I've obtained a trajectory though different joints goal, so using the movegroup commander i plan different trajectories. But i need one single trajectory so my aim is to save all the joints of the previous trajectories and load them all together. I thought to save all the joint waypoints from the topic (i'm not sure on how do that) but i can't understand then how to load it. Please help me! thanks

edit retag flag offensive close merge delete


save all the joint waypoints from the topic

From which topic?

Does your ros setup have a follow_joint_trajectory action server?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-16 08:01:49 -0500 )edit

I have /joint_states topic, that i already use to check two values for another work. So the idea is to save all the joints from that topic in a file and then use it. I have a follow_joint_trajectory action server (/effort_joint_trajectory_controller/command /effort_joint_trajectory_controller/follow_joint_trajectory/cancel /effort_joint_trajectory_controller/follow_joint_trajectory/feedback /effort_joint_trajectory_controller/follow_joint_trajectory/goal /effort_joint_trajectory_controller/follow_joint_trajectory/result /effort_joint_trajectory_controller/follow_joint_trajectory/status) but i don't know how to use it. Thank you for your help!!

mancio gravatar image mancio  ( 2022-12-16 08:11:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-12-16 14:56:19 -0500

Mike Scheutzow gravatar image

To make the arm follow a pre-determined path, you can dynamically create a JointTrajectory object, then send it to the follow_joint_trajectory action server using a SimpleActionClient object.

A JointTrajectory object contains a list of waypoints (JointTrajectoryPoint objects.) For best results you need to specify the position, velocity and timestamp of each JointTrajectoryPoint, so you must store appropriate data in your file. Also be aware that the first Point has to be close to the arm's starting joint state, or you'll trigger an error condition.

You can do this in either c++ or python. Also, keep in mind that a follow_joint_trajectory action server does not perform collision detection.

edit flag offensive delete link more


I think this answer would benefit from code examples for loading and writing a message. I remember wanting to do something similar when I started, never got around to it, and by the time I could have found my way around serialization/deserialization, I didn't need to anymore.

"save load message ros" does not give any useful results for this either.

fvd gravatar image fvd  ( 2022-12-17 02:35:41 -0500 )edit

Question Tools

1 follower


Asked: 2022-12-15 18:11:55 -0500

Seen: 203 times

Last updated: Dec 16 '22