I like the fact that you implemented a sinewave pattern for acceleration. Servo are often doing brutal movements and your arm movement are much more elegant.
I was quite surprised in your last video however, why is there such a lag between your movements and the movement of your robot? The PI CPU is a powerhouse compared to an Arduino so I don’t understand why the arm doesn’t follow your movements in real time.
I like your project and I’m curious, I might take an evening to peek into your code to see how you made it. :o)
You are of course right. The Raspberry Pi is a powerhouse and even I must admit that I probably should have done the position following in real time.
Here however is the reason, why I at the time considered this the best solution: I remember doing the following in real time. The movement was quite shaky and I didn’t like it. I wanted to use the sinewave start/stop controller. But the thing only works if there’s a fixed goal position. So the way the arm following works is that the joints wont except a new goal position until they reach their current goal position. Another thing I noticed was, that there can be a lot of shaking going on when all the joints move at the same time. It looked a bit clumsy sometimes. That’s why I decided that the joints should move one after another.
The result was acceptable movement, from the viewpoint of elegance. But with a lot of lag. I probably should have rewritten the controller… But you know how it is when hacking around on robots… Sometimes, other things seem more important; At the time I was all about getting a camera hooked on the thing and finally start with the Image processing algorithms. ^^
The smooth movement actually wasn’t that hard to do. The reason beeing that I used Dynamixel servos, which provide an easy way to control not only the goal position, but also the current speed!
Thanks for the comment. I’m actually not sure if there will be a “next step” for this project. At the Moment I’m giving the ancient quest of “making a Servo from a geared motor” a try. ^^
The construction is quite simple. Just go to the DIY center of your choice and buy some aluminium profiles. Some kind of quadratic profiles will do the job. Then you need a drill. And 4 Dynamixel AX-12As. Just drill some holes in such a way, that you can screw the profiles on the Dynamixels. The rotating part of the Dynamixel servo has 4 M2.5 (or M2 I’m not sure anymore) holes on it. just screw the aluminium profile on it and you’ll get the same thing I’ve done (or maybe even better, depending on how much time you spend on polishing the thing!). the profile should be about 12 cm long. I remember shorting at least one a little bit more because the servos reached their limits when doing some certain postures.
Can you expand on how you smoothed the movement? In laymens terms? How can I reproduce or learn from your code to implement the same smoothing in my own dynamixel motors?
The Smoothing is actually quite simple and I am sure there are plenty of better ways to do it. First, we need to keep in mind that the servos in this project are Dynamixel AX-12A servos. But since you also got some Dynamixels, this should be clear enough. The Dynamixels are controlled via a serial protocol. One of the parameters which can be set over the bus is the speed. This comes in really handy. Another big advantage of Smart Servos is that you can get the current position. Now all you have to do is to set a goal position. calculate some ramps for starting and stopping. and then, while resetting the speed and checking the current position in really fast succession, ramp up and down until you reach the goal position.
something like this: 1. Set Goalposition on Dynamixel 2. Calculate ramps (how many millisecs should the acceleration/deaccelation be?) 3. ramp up the Speed according to calculated tables (for example, if 10 ms have passed since start, the speed should be 10 or something like that) This is easiest if you are doing linear ramps. 4. also calculate the position after which the deramping should start. 5. after ramp up, the servo should move at some max speed. 6. after reaching the down ramp start value (some position), start the downramping of the speed.
As mentioned before, checking for position and resetting of speed parameter need to be done fast. Set the baud rate to some high value. I think I used 115200 as baudrate. query the servos as fast as every 10ms. I don’t remember how fast I did it. Experiment!
What did you use to attach the potentiometer shaft to the wood pieces? I have been looking for various solutions, but they seem either expensive or a bit unstable/cumbersome.