tygamvrelis / oil_lamp

Gimballed oil lantern motion recording & playback
1 stars 0 forks source link

Playback is not smooth for 1 Hz sine wave with amplitude 10 degrees #30

Closed tygamvrelis closed 4 years ago

tygamvrelis commented 4 years ago

During the first playback test, it was observed that a 1 Hz sine wave with amplitude 10 degrees was noticeably jerky. At 0.5 Hz, the jerk was far worse, and at 2 Hz the jerk was very small.

Furthermore, a 25 degree amplitude sine wave at 1 Hz and 2 Hz looked very smooth.

tygamvrelis commented 4 years ago

I am thinking that the choice to transmit playback angles to the microcontroller as ints instead of floats may be causing the jerk. For example, at 1 Hz we expect 25 angle transmissions between +/-10 and 0 degrees, which corresponds to the waveform shown below when using ints

image Source++from+t+%3D+0+to+t+%3D+0.25)

Angle Number of Samples
10 5
9 4
8 3
7 2
6 2
5 2
4 2
3 1
2 2
1 2
0 1

This means the servo will jerk from 10 degrees down to 9, and stay there for 4 transmission cycles, before moving to 8 degrees for 3 transmission cycles, and so on.

If we were to use floats for the angles, each transmission cycle would send a new position, which means it would remain in motion for a larger fraction of the time, and hence appear smoother.

tygamvrelis commented 4 years ago

Closed by mistake

tygamvrelis commented 4 years ago

Well, I have the change on a branch right now. It's working, so I might pull it in (since there's no harm in having float precision), but I didn't really notice a difference in the motion.

Will have to do some more thinking about what else to try. I know that at some point we will have to have a proper power supply for the servos, so maybe that would be a good next step. I'm sure other people have run into this sort of issue before, so internet research also seems like a good idea.

Also note that the servos only seem jerky when they are loaded—if I send them sine waves with nothing attached to them, they are perfectly smooth. This suggests to me that this issue could be due to a torque/current limitation

tygamvrelis commented 4 years ago

Quick update: tested Dynamixel AX-12As and they seemed to work smoothly. Not quite the desired form factor, which led us to try Lynxmotion ST1.

Just tried the LSS ST1 today and it was more jittery than expected. Not sure how to tune control. Made a forum post to ask for help: https://www.robotshop.com/community/forum/t/lss-st1-not-tracking-trajectory-smoothly-please-advise/55841