# ros_control position controller maxing the motor speed

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.points.append(point)



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.

temp++;
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 close merge delete