Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Linear interpolation

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
21 postsPage 2 of 21, 2
21 postsPage 2 of 21, 2

Post by billyzelsnack » Sat Nov 22, 2008 12:23 am

Post by billyzelsnack
Sat Nov 22, 2008 12:23 am

I've not actually got to the point where I've solved the problem. I have some ideas though ( of course! haha. )

If you switched over to controlling velocity instead of position ( treat the servo like a motor with position feedback ) you'd at least have something to tweak. Unfortunately this is like implementing a PID on top of the servo's PID which is less than ideal.
I've not actually got to the point where I've solved the problem. I have some ideas though ( of course! haha. )

If you switched over to controlling velocity instead of position ( treat the servo like a motor with position feedback ) you'd at least have something to tweak. Unfortunately this is like implementing a PID on top of the servo's PID which is less than ideal.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by i-Bot » Sat Nov 22, 2008 10:54 am

Post by i-Bot
Sat Nov 22, 2008 10:54 am

Most of the controller code I have seen does not use the speed control ability of the servo. The servo runs at max speed.

An interrupt timer is set to a few millisec, and on the interrupt the servo position only is set.

I am thinking that setting the sped often, may mess with the servo internal code.

Might I suggest a timer based position only program to start and then to experiment with adding the speed.
Most of the controller code I have seen does not use the speed control ability of the servo. The servo runs at max speed.

An interrupt timer is set to a few millisec, and on the interrupt the servo position only is set.

I am thinking that setting the sped often, may mess with the servo internal code.

Might I suggest a timer based position only program to start and then to experiment with adding the speed.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by billyzelsnack » Sat Nov 22, 2008 7:07 pm

Post by billyzelsnack
Sat Nov 22, 2008 7:07 pm

i-Bot wrote:I am thinking that setting the sped often, may mess with the servo internal code.


I'm not sure if you were referring to my post above, but either way I should explain a bit more..

By velocity I mean tracking velocity and position yourself. The way you set the servo can be by setting positions, just that you are setting the position not exact, but more based upon the direction where you want to go.
i-Bot wrote:I am thinking that setting the sped often, may mess with the servo internal code.


I'm not sure if you were referring to my post above, but either way I should explain a bit more..

By velocity I mean tracking velocity and position yourself. The way you set the servo can be by setting positions, just that you are setting the position not exact, but more based upon the direction where you want to go.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by petej » Sat Nov 22, 2008 11:28 pm

Post by petej
Sat Nov 22, 2008 11:28 pm

Most of the controller code I have seen does not use the speed control ability of the servo. The servo runs at max speed.

An interrupt timer is set to a few millisec, and on the interrupt the servo position only is set.

I am thinking that setting the sped often, may mess with the servo internal code.

Might I suggest a timer based position only program to start and then to experiment with adding the speed.


You know, this matches what Bullit said in this thread:

... the bioloid firmware sets the compliance slope to 0x20,0x20 whenever it plays a page. Margin is left at 0. Speed is set to 0, torque is set to 0x3ff.


How would this work? You have to have different speeds on each servo in order to have all the servos reach the destination at the same time, and in order to ever implement an S-curve, you'd have to adjust the speed continually during the ramps, right?

Further, in the BLV012 code from the University of Plymouth, they send the goal speed with every packet, calculated in a similar way as my code (I derived mine from theirs).
Most of the controller code I have seen does not use the speed control ability of the servo. The servo runs at max speed.

An interrupt timer is set to a few millisec, and on the interrupt the servo position only is set.

I am thinking that setting the sped often, may mess with the servo internal code.

Might I suggest a timer based position only program to start and then to experiment with adding the speed.


You know, this matches what Bullit said in this thread:

... the bioloid firmware sets the compliance slope to 0x20,0x20 whenever it plays a page. Margin is left at 0. Speed is set to 0, torque is set to 0x3ff.


How would this work? You have to have different speeds on each servo in order to have all the servos reach the destination at the same time, and in order to ever implement an S-curve, you'd have to adjust the speed continually during the ramps, right?

Further, in the BLV012 code from the University of Plymouth, they send the goal speed with every packet, calculated in a similar way as my code (I derived mine from theirs).
petej
Robot Builder
Robot Builder
User avatar
Posts: 12
Joined: Fri Jun 13, 2008 7:37 pm
Location: Silicon Valley, CA

Post by cosa » Thu Nov 27, 2008 5:03 am

Post by cosa
Thu Nov 27, 2008 5:03 am

How would this work? You have to have different speeds on each servo in order to have all the servos reach the destination at the same time, and in order to ever implement an S-curve, you'd have to adjust the speed continually during the ramps, right?

You can control the average speed of the servo by sending position values to it. If you assume/set a pretty high acceleration/speed the servo will be able to reach every position within a few milliseconds. Then the average speed just depends on the position values you send in a specific time frame (f.e. the values 100 101 102 will be slower than 100 200 300). Of course, the problem is, that the ax-12 controller tries to reach every position with a fixed acceleration and max velocity which results in a jerky motion. But the higher your update frequency is the smaller the error of the resulting trajectory will be. Therefore you can limit the jerk by using small timesteps and a smooth precalculated trajectory (which should take the dynamics into account).

For me, a timestep of ~10ms, a smooth trajectory (f.e. cubic spline or s-curve) and (optional) a simple pid controller for the torque value works okay, but I don't want to draw straight lines. ;) I don't have up-to-date videos but you can find a few old ones here.

You'll get better results if you take the dynamics into account and calculate "correct" position, speed and torque values but it's not that easy (and you'd need information about how the ax-12 controller works). Using max torque and max velocity has the advantage that you can't underestimate the values ;)
How would this work? You have to have different speeds on each servo in order to have all the servos reach the destination at the same time, and in order to ever implement an S-curve, you'd have to adjust the speed continually during the ramps, right?

You can control the average speed of the servo by sending position values to it. If you assume/set a pretty high acceleration/speed the servo will be able to reach every position within a few milliseconds. Then the average speed just depends on the position values you send in a specific time frame (f.e. the values 100 101 102 will be slower than 100 200 300). Of course, the problem is, that the ax-12 controller tries to reach every position with a fixed acceleration and max velocity which results in a jerky motion. But the higher your update frequency is the smaller the error of the resulting trajectory will be. Therefore you can limit the jerk by using small timesteps and a smooth precalculated trajectory (which should take the dynamics into account).

For me, a timestep of ~10ms, a smooth trajectory (f.e. cubic spline or s-curve) and (optional) a simple pid controller for the torque value works okay, but I don't want to draw straight lines. ;) I don't have up-to-date videos but you can find a few old ones here.

You'll get better results if you take the dynamics into account and calculate "correct" position, speed and torque values but it's not that easy (and you'd need information about how the ax-12 controller works). Using max torque and max velocity has the advantage that you can't underestimate the values ;)
cosa
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 40
Joined: Mon Dec 04, 2006 1:00 am

Post by petej » Thu Nov 27, 2008 10:29 am

Post by petej
Thu Nov 27, 2008 10:29 am

Ah, of course... that makes sense. I'm obviously a little slow on the uptake.

In an attempt to reduce complexity, I've rearranged the arm to be all in the X/Y plane (as was previously suggested), which allowed me to reduced the number of servos from 5 to 3, and significantly shortened the throw.

Running the original algorithm (calculate speeds for each servo based on target position, SYNC_WRITE speed and position once per pose) seems to work somewhat better with the reduced DOF. It's still more inaccurate than I would like, but at least there are less variables to pay attention to. :-)

I'll try implementing your suggestion. Thanks!
Ah, of course... that makes sense. I'm obviously a little slow on the uptake.

In an attempt to reduce complexity, I've rearranged the arm to be all in the X/Y plane (as was previously suggested), which allowed me to reduced the number of servos from 5 to 3, and significantly shortened the throw.

Running the original algorithm (calculate speeds for each servo based on target position, SYNC_WRITE speed and position once per pose) seems to work somewhat better with the reduced DOF. It's still more inaccurate than I would like, but at least there are less variables to pay attention to. :-)

I'll try implementing your suggestion. Thanks!
petej
Robot Builder
Robot Builder
User avatar
Posts: 12
Joined: Fri Jun 13, 2008 7:37 pm
Location: Silicon Valley, CA

Previous
21 postsPage 2 of 21, 2
21 postsPage 2 of 21, 2