ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

UR5 velocity control and trajectory recording/replaying

asked 2015-03-02 04:59:04 -0500

NRW_ROS gravatar image

Hello everyone,

I have the following two issues to solve:

#1 I would like to control the velocity of the path execution of the UR5 robot. At the moment, I'm using the UR5 ROS-Industrial driver and MoveIt!. In the of UR driver I've found a velocity vector, which is somehow looking like 'velocities=[0]*6'. In my application I would like to call the velocity function in C++ or Python code. Maybe someone could tell me how to use or call the velocity functions for path planning and executing.

#2 The second issue is, that I would like to record and replay a trajectory, which was calculated by the MoveIt! pathplanning. The idea behind this is to recall the existing trajectory instead of calculating it every time for a well known path. Solutions, which came into my mind are to record a bagfile for trajectory topic or to use the MongoDB. I'm not sure if this approach is the correct one. Particularly, I don't want to set up a database to record a trajectory in case of MongoDB. A single data file containing the trajectory values would be suitable for my issue.

Thanks for helping in advance. You will also find this post in the ROS-I mailinglist, but after quite some time of waiting I din't get any answers.

edit retag flag offensive close merge delete


Were you able to find a solution for #2?

Carollour gravatar image Carollour  ( 2015-10-29 13:42:21 -0500 )edit

Sadly not.

NRW_ROS gravatar image NRW_ROS  ( 2015-11-11 07:05:40 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2015-03-02 08:15:17 -0500

gvdhoorn gravatar image

updated 2015-03-04 10:12:22 -0500

I would like to control the velocity of the path execution of the UR5 robot.

Do you want to specify velocity constraints on path segments, or are you after actual velocity control (ie: control joint velocity instead of position)?

If the former: that is already supported, and should be specified in the trajectory that is send to the control_msgs/FollowJointTrajectoryAction Action server setup by the ur_driver. I just remembered: the current ur_driver does not actually use the velocity field in a JointTrajectoryPoint. Velocity (and also acceleration) are derived from the time_from_start field each JointTrajectoryPoint contains.

If the latter: the current ROS-Industrial driver for UR doesn't expose the velocity control functionality of the UR controller yet. There is however work ongoing to open up that interface for use from ROS. In the mean-time, you might want to look at alternatives, such as urx.

Actually, I want to specify the velocity on path segment like you described in your first solution. I’ve found the time_from_start in the JointTrajectoryPoint Message. But how to use and set velocity values properly?

Isn't time_from_start automatically calculated (and then recalculated in ur_driver)? Afaicr I've never had to set those fields manually. Especially not when using MoveIt. If you do need to set it by hand, then time_from_start for point n should be the time at which the previous segment should be finished. So for a distance x (whatever 'distance' means in your particular case) and velocity v, time_from_start for point n+1 should be (time_from_start for n) + x/v, if I'm not mistaken (see also Moving the arm using the Joint Trajectory Action - 1.4: The trajectory message).

edit flag offensive delete link more


Actually, I want to specify the velocity on path segment like you described in your first solution. I’ve found the time_from_start in the JointTrajectoryPoint Message. But how to use and set velocity values properly?

NRW_ROS gravatar image NRW_ROS  ( 2015-03-04 09:34:01 -0500 )edit

ATM Im using the MoveGroupInterface from MoveIt! and computeCartesianPath function for calculating a path. To get a trajectory I’m using robot_trajectory::RobotTrajectory and IterativeParabolicTimeParameterization to fill the trajectory with velocity values.Afterwards, Im executing the path.

NRW_ROS gravatar image NRW_ROS  ( 2015-03-04 09:37:44 -0500 )edit

Hello all, Late to the party but I'm also very interested to understand how to do velocity control. Specifically I would like to be able to execute a constant linear velocity. Changing the time from start only affects average velocity. Is there a way round this that anyone knows of? Cheers

homesick-nick gravatar image homesick-nick  ( 2016-08-05 05:29:25 -0500 )edit

Hi, did you find a solution for #1? I was wanting to do velocity control of the tip of the UR5 robot, but if I understood your question correctly, that is not possible to be done?

araujokth gravatar image araujokth  ( 2016-08-17 03:52:04 -0500 )edit

The ur_modern_driver does expose a velocity interface to the UR controller via a ROS topic, but it currently only supports this in joint space. You could perhaps use the /ur_driver/URScript topic to send speedl(..) commands directly.

gvdhoorn gravatar image gvdhoorn  ( 2016-08-18 10:16:59 -0500 )edit

answered 2016-08-23 04:29:23 -0500

homesick-nick gravatar image

By publishing a set of waypoints on /followjointtrajectory/goal using the joint_trajectory_aciton service with time_from_start = i*t (i in range 0, number of waypoints) and waypoint eef_step = x the speed will be equal to x/t. Though I'm not sure how accurate this technique is since I understand that there is a smooth velocity profile between each waypoint implying that the ee speeds up and slows down repeatedly between start and goal states. However, by setting the x value sufficiently small I'm able to achieve what appears to be a constant velocity. I have been unable to examine the velocity beyond what is discernible by sight.

edit flag offensive delete link more

answered 2016-12-15 18:05:22 -0500

For #2, you can save your plan to a variable once it's been made and execute it again.

In the python moveit commander interface you can use the "plan()" function from the move_group node which returns a plan that can be saved to a variable. For reference -

You can then call the "execute(plan)" function from the move_group node to execute a previously planned path. For reference -

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-02 04:59:04 -0500

Seen: 3,363 times

Last updated: Dec 15 '16