ros_control position controller maxing the motor speed

asked 2016-05-12 04:31:28 -0500

lonewolf gravatar image

I am using ros_control with position interface for my robotic arm which has dynamixel pro motors. The task I am trying to perform is to move one of the joints from 1 rad to 3.14 rad as fast as possible. So based on their data sheet, I made some calculations.

Max Speed = Velocity Limit / Gear Ratio = 16600 / 500 = 33.2 RPM = 3.476 radians/second
Increment between points in the trajectory = 0.06 radians 
Optimal time between the points = 0.06 / 3.476 = 0.01726 seconds

Based on the above calculations, I create a trajectory as below with 0.06 increments and 0.01s delay.

self._goal = FollowJointTrajectoryGoal()
self._time_since_start = 0

for pt in np.arange(1, 3.14, 0.06):
    point = JointTrajectoryPoint()
    point.positions = [pt, joint_angles[1:]] # Moving only the first joint
    self._time_since_start = self._time_since_start + 0.01
    point.time_from_start = rospy.Duration(self._time_since_start)


self._goal.trajectory.header.stamp = + rospy.Duration(delay)

I think based on this I should be able to hit the max motor speed. But I have not been able to do so. I also checked the speed of my control read -> update -> write loop speed and it is 250Hz. This is done by inserting the below code in the loop.

if (temp == 1)
    speed = ros::Time::now();

if (temp == 10000) {
    temp = 0;
    ros::Duration hz = ros::Time::now() - speed;
    ROS_DEBUG_STREAM_NAMED(ns_, "Hz " <<  (10000.0 / hz.toSec()));

Does anybody have experience working with problems like this and have any thoughts on how I can achieve the maximum speed?

edit retag flag offensive close merge delete


Not a solution, but an observation/comment: maximum motor speed is probably specced at 'no load'. I'm pretty sure your robot doesn't count as a 'no load'.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-12 04:47:53 -0500 )edit

Your math doesn't account for the acceleration or deceleration of the joint, either. In your situation, I would plot the joint position vs time to see the actual trajectory and analyze how the controller responds to your input.

ahendrix gravatar image ahendrix  ( 2016-05-12 09:56:34 -0500 )edit