# UR5 velocity control and trajectory recording/replaying

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 test_move.py 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 close merge delete

Were you able to find a solution for #2?

( 2015-10-29 13:42:21 -0600 )edit

( 2015-11-11 07:05:40 -0600 )edit

Sort by » oldest newest most voted

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).

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?

( 2015-03-04 09:34:01 -0600 )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.

( 2015-03-04 09:37:44 -0600 )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

( 2016-08-05 05:29:25 -0600 )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?

( 2016-08-17 03:52:04 -0600 )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.

( 2016-08-18 10:16:59 -0600 )edit

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.

more

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 - https://github.com/ros-planning/movei...

You can then call the "execute(plan)" function from the move_group node to execute a previously planned path. For reference - https://github.com/ros-planning/movei...

more