Software > Software

Two Servo Wheel Improved Robotic Movement

(1/1)

vitalik53:
How can a fluid/smooth movement of a robot with two servos can be achieved?, my application is object avoidance, and i have a scanning servo with two SHARP IR sensors which find the most open spaces in the room. I have a problem making the movement less "Jerky", i tried correlating the angle to pulse widths for the two servos. I just want to know if there is any general algorithms out there i can use to make the transition between angles more smoother.

Thank you for your help.

newInRobotics:
Easiest way to do it, in my opinion, is to use mean value, as opposed to current value from IR Sharp. The other option could be using PID or Fuzzy Logic.

zwarte:
I understand what you mean, what you want to perform is pure maths. WHen the robot changes route for example going to the left, the right wheel spins faster while the left wheel slows down to accomplish the change route.

It's actually pure math formula to calculate on which speed the servo's should turn.

vitalik53:
about the "pure math", here's what i came up with so far in terms of relationship between angle (0->180) and pulse widths to the two wheel servos:

if(pos<=90)
{
pulse_1=1300;
pulse_2=1300+(40/9)*pos;

}

if(pos>=90)
{
pulse_1=1300+(40/18)*(pos);
pulse_2=1700;

}

right_servo.writeMicroseconds(pulse_1);
left_servo.writeMicroseconds(pulse_2);
delay(20);

PS I'm using the Arduino Servo Library, on an Arduino Uno

HOWEVER, like my original question, the movements would be very rapid and "jerky' because of the constant change in the angle (pos variable) which represents that most open space.

vitalik53:
another question, if i use the fuzzy logic to get an adjustment angle relative to the direction of travel, proximity of obstacle, and angle of obstacle; how do i translate that angle into pulse widths for the servos, do i just rotate to that angle (for a certain number of pulses) or do something else?