### Author Topic: Two Servo Wheel Improved Robotic Movement  (Read 1126 times)

0 Members and 1 Guest are viewing this topic.

#### vitalik53

• Jr. Member
• Posts: 18
• Helpful? 0
##### Two Servo Wheel Improved Robotic Movement
« 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.

#### newInRobotics

• Supreme Robot
• Posts: 1,015
• Helpful? 48
• N.I.R.
##### Re: Two Servo Wheel Improved Robotic Movement
« Reply #1 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.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

#### zwarte

• Jr. Member
• Posts: 24
• Helpful? 0
##### Re: Two Servo Wheel Improved Robotic Movement
« Reply #2 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.

#### vitalik53

• Jr. Member
• Posts: 18
• Helpful? 0
##### Re: Two Servo Wheel Improved Robotic Movement
« Reply #3 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.

#### vitalik53

• Jr. Member
• Posts: 18
• Helpful? 0
##### Re: Two Servo Wheel Improved Robotic Movement
« Reply #4 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?

Get Your Ad Here

data_list