Thread: Easy way to smooth Dynamixel Start/Stop motion?

1. Vacuum Tube
Join Date
Sep 2016
Posts
21
Rep Power
18

Easy way to smooth Dynamixel Start/Stop motion?

Hey guys, I am using Python and running some dynamixel motors at fairly low maxspeeds (12rpm or so). I am interested in smoothing out the motion at the beginning/end of a write command.

Currently, my rudimentary method of just taking the maxspeed when the current position is within a certain percentage of the goal/start position and multiplying it by a sin function that returns 1 at the 10% mark and 0 at the 0% mark. This isn't working as I'm getting jerky motion and no smoothing whatsoever.

I found another person's code (https://github.com/T-Kuhn/ScrewPicke...ervoHandler.py) writing in python for some AX-12As that is using a movement smoothing algorithm, but I'm having a hard time understanding and implementing it into my own code (things like what ramptime is).

Could anyone help me simplify this? I literally just want to write a dynamixel from position 1 to position 2 with a smooth start/stop motion.

Thanks!

2. Re: Easy way to smooth Dynamixel Start/Stop motion?

The easiest way is to turn up the D and I controller response values, and turn down the P response value.
PID tuning is a fair bit of magic and trial-and-error, though, so make sure you remember the original values if you find that you can't make it do what you want!

3. Vacuum Tube
Join Date
Sep 2016
Posts
21
Rep Power
18

Re: Easy way to smooth Dynamixel Start/Stop motion?

Originally Posted by jwatte
The easiest way is to turn up the D and I controller response values, and turn down the P response value.
PID tuning is a fair bit of magic and trial-and-error, though, so make sure you remember the original values if you find that you can't make it do what you want!
Hello again jwatte and thanks for your response!

I fear that solution may not work so well since I'm working with AX-12As as well.

4. Re: Easy way to smooth Dynamixel Start/Stop motion?

For AX-12A servos, you will have to create the position profile yourself, and keep writing it to the servos.
Make sure you write at least 60 times a second, ideally more often than that.

5. Vacuum Tube
Join Date
Sep 2016
Posts
21
Rep Power
18

Re: Easy way to smooth Dynamixel Start/Stop motion?

Originally Posted by jwatte
For AX-12A servos, you will have to create the position profile yourself, and keep writing it to the servos.
Make sure you write at least 60 times a second, ideally more often than that.
What do yo mean? could you explain further or give me an example?

6. Re: Easy way to smooth Dynamixel Start/Stop motion?

Make sure your main() loop runs 60 times a second.
Each time through the main() loop, calculate where you want the servos to actually be, based on the velocity profile you use.
Send those positions to the servos.
(You can also send the "desired movement speed" as part of the same write command.)

So, if the servo is at position 300 and you want it to go to position 800 with smooth acceleration, you will not simply send 800 all the time, but instead send 301, 302, 303, 305, 307, 310, 313, 318 ... (or whatever your acceleration profile is.)

Also note that there is a maximum resolution for the servos. The servo can't "slowly" move between position 112 and position 113, because there is no intermediate position that it can use to figure out the velocity. All you can do there is control how hard it pushes based on how far off it is (using slope in AX12 and PID in MX series.)

7. Vacuum Tube
Join Date
Sep 2016
Posts
21
Rep Power
18

Re: Easy way to smooth Dynamixel Start/Stop motion?

Originally Posted by jwatte
Make sure your main() loop runs 60 times a second.
Each time through the main() loop, calculate where you want the servos to actually be, based on the velocity profile you use.
Send those positions to the servos.
(You can also send the "desired movement speed" as part of the same write command.)

So, if the servo is at position 300 and you want it to go to position 800 with smooth acceleration, you will not simply send 800 all the time, but instead send 301, 302, 303, 305, 307, 310, 313, 318 ... (or whatever your acceleration profile is.)

Also note that there is a maximum resolution for the servos. The servo can't "slowly" move between position 112 and position 113, because there is no intermediate position that it can use to figure out the velocity. All you can do there is control how hard it pushes based on how far off it is (using slope in AX12 and PID in MX series.)
So I understand a bit more, I'd do that in something like a while loop in python I guess, but how would one "increasingly" raise the position gaps each iteration? And what if going to say position 313 to position 318 physically takes longer than 1/60 of a second, wouldn't it then jump to that position?

8. Re: Easy way to smooth Dynamixel Start/Stop motion?

what if going to say position 313 to position 318 physically takes longer than 1/60 of a second, wouldn't it then jump to that position?
If it physically takes longer, then it can't possibly "jump" to that location, because it's physically prevented from doing so.
The "jumpiness" happens when you tell it to go far, and it can go far, but you then don't have a next position to update it to for a bit.
Note, though, that the resolution of the servos is only so fine -- if you need to be at position 520 at some point, and then at 520.2, you can't express that, and the servo can only hold at 520 or 521.
Thus, if the position you want to express is: 520, 520.1, 520.2, 520.4, 520.7, 521.0, 521.3 ... then the servo can only see 520, 520, 520, 520, 520, 521, 521, ... and you will get "small jumps." The only way out of that is to use a different servo with more gearing and higher precision.

9. Vacuum Tube
Join Date
Sep 2016
Posts
21
Rep Power
18

Re: Easy way to smooth Dynamixel Start/Stop motion?

Originally Posted by jwatte
If it physically takes longer, then it can't possibly "jump" to that location, because it's physically prevented from doing so.
The "jumpiness" happens when you tell it to go far, and it can go far, but you then don't have a next position to update it to for a bit.
Note, though, that the resolution of the servos is only so fine -- if you need to be at position 520 at some point, and then at 520.2, you can't express that, and the servo can only hold at 520 or 521.
Thus, if the position you want to express is: 520, 520.1, 520.2, 520.4, 520.7, 521.0, 521.3 ... then the servo can only see 520, 520, 520, 520, 520, 521, 521, ... and you will get "small jumps." The only way out of that is to use a different servo with more gearing and higher precision.
Ok I understand, though im having some difficulty finding out how I would make my while loop update at 60hz (every iteration of the while loop writes a position). If I want to do it your way, would I use a for loop or something and utilize some increasingly incremental position value? I am writing in python

10. Re: Easy way to smooth Dynamixel Start/Stop motion?

You don't want a while() loop.
You want all real-time control systems to work by running the main loop over and over, and only react to "what time is it" and "what inputs changed."
If you are using the Arduino environment, check out a sample called "blink without delay" for how to do that.

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•