Society of Robots - Robot Forum

Software => Software => Topic started by: vitalik53 on November 08, 2012, 12:08:23 PM

Title: Two Servo Wheel Improved Robotic Movement
Post by: vitalik53 on November 08, 2012, 12:08:23 PM
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.
Title: Re: Two Servo Wheel Improved Robotic Movement
Post by: newInRobotics on November 08, 2012, 12:52:36 PM
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.
Title: Re: Two Servo Wheel Improved Robotic Movement
Post by: zwarte on November 08, 2012, 01:12:09 PM
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.


Title: Re: Two Servo Wheel Improved Robotic Movement
Post by: vitalik53 on November 08, 2012, 03:15:20 PM
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.
Title: Re: Two Servo Wheel Improved Robotic Movement
Post by: vitalik53 on November 08, 2012, 03:31:43 PM
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?