[From Adam Matic 1.4.2012.21.30 CET]
Greetings
I need some help with fine-tuning parameters of a robotic arm.
I used Vellman KSR10 (a.k.a OWI-535-Edge) robot arm kit and an Arduino to connect it to a computer. Since itās a pretty basic robot arm, it doesnāt have servos, but simple DC motors. I have a few pots to measure joint angles and do some very crude speed measurements. I used the Little Man and LCS3 arm models as template programs.
First level loops just barely work (motor speed control) and I hope they can be improved without replacing DC motors with servos.
Second level loops (reach, elevation and lateral displacement control) also work, they get the job done, but overall behavior is not at all smooth.
I attached a video of the arm increasing reach while maintaining elevation. If it didnāt get trough, try http://www.2shared.com/video/NtSFb7nW/Robot_Arm.html
As you can see, there is room for improvement.
Some basic info:
The arm has 4 DoF. Loop interval is 50 ms (probably could be a bit better with optimisation).
Code is written in C# and Arduino C (Arduino is an Atmel328 based board connecting the computer with sensors and motors).
This is the first level loop code:
double ro;
double s = CurrentPot - LastPot;
VelocityBuffer[BufferCounter++] = s;
LastPot = CurrentPot;
if (BufferCounter == BufferSize) BufferCounter = 0;
Qi = AverageSpeed();
p = Qi * Ki;
ro = (Math.SignĀ® * (47 + Math.AbsĀ®));
e = ro - p;
Qo = Qo + (e - 0.5*Qo)*dt;
if (r == 0) Qo = 0;
if (Qo > 100) Qo = 100;
if (Qo < -100) Qo = -100;
speed = (int)(Qo);
////
Qi is a āmoving averageā of last 10 readings.
The problem I had with getting the speed control to work is the minimum speed of the motor. It doesnāt go below 47 [pot values per 50 ms]. The speed range is basically 47 to 65 (no load). I use PWM to control the speed. So, any time reference signal is greater than zero, it becomes increased by 47. I tried reducing pot readings by 47 but that doesnāt work.
The āif (r == 0) Qo = 0ā line is probably not very pretty.
This is the main part of second level code:
Motor[0].r = (int)(LateralError);
Motor[1].r = (int)(-ElevationError - ReachError / 2);
Motor[2].r = (int)-ReachError;
Motor[3].r = (int)-ReachError;
///
Iāve tried everything I could think of to stabilise movement, this is the best I managed to do so far. I would appreciate any help.
Best
Adam
Robot Arm.3gp (2.68 MB)