Society of Robots - Robot Forum

Software => Software => Topic started by: Proctor on June 24, 2012, 04:40:57 PM

Title: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: Proctor on June 24, 2012, 04:40:57 PM
Hey Everyone!

I just finished my robot!!! I'm was so exited I couldn't sleep all night. Finally fell asleep at 6am this morning haha. I'll post a picture of my robot.

Ok so the title explained everything pretty much but ill recap.

Specs:
Atmega8
AvrIsp mkII USB programmer (had trouble connecting at first. solved by updating avr studio 4 to version 4.19)
9V battery through 5V regulator for electronics power.
4 AA batterys in single cell holder for servos.
Yogurt caster...muhaha (im going to rebuild the whole chassis)

My problem is simple (..i think) but uh I know you all your guys like showing off your skills  ;)
So my robot goes in clockwise circles when it should go strait :. (therefore) the left wheel is turning too fast or the right wheel too slow
Also totally related and hopefully the same problem but when the Bot chases the light and turns left it turns very slow. whereas when the Bot turns right it spins very fast.

Observations:
Left wheel spins too fast forwards.
Left wheel is slow going backwards.
Right wheel is slower then left wheel going forward.
Right wheel seems faster going backwards but may be the same speed as left wheel. (seems this way b/c it turns so fast right).
~Also the noise:
The robot is louder when turning right then left.

Help:
I'd like someone to explain to me how to change the speed for each servo, left and right. I'm trying to learn how to write C++ and this is my introduction to it. We are using C++ right?

Greatlyyyy Appreciate it!

~Proctor


Title: Re: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: newInRobotics on June 25, 2012, 12:36:30 AM
Hi there

I don't think this is code problem. I assume You have used servos that were modified to perform continuous rotation, it looks like problem lies in servos being not centered properly when pot was glued, that would explain servo spinning faster to one side than the other.
Title: Re: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: Proctor on June 25, 2012, 12:27:01 PM
Yeah that is the reason they are messed up but Admin or someone was saying that if you messed up and glued the pot in crooked you would be able to fix it. The only thing is it would reduce the range of speed.

So I need to reduce the speed in my left servo to match the speed of my right servo.
I need to increase the reverse speed of my left servo if possible.
Title: Re: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: newInRobotics on June 26, 2012, 01:13:48 AM
You need to find slowest overall speed and use it to run both servos in any given direction. So, if right servo goes CW at 20RPM and CCW at 25RPM, and left servo goes CW at 30RPM and CCW at 31RPM, You have to drive both servos to any direction no faster than 20RPM because that is the usable speed of right servo.
Title: Re: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: adanvasco on June 29, 2012, 08:06:44 PM
Also, if you don't want to sacrifice speed, you could open the servos again, I mean, completely, and measure the resistance from the pot at the servo going at good speed, and replace the pot from the other servo with a similar resistor. That's another way of modifying servos, btw.
Title: Re: $50 Robot. Need Help. Turns in circles. Doesn't go strait. How do I adjust code?
Post by: FrontierRobotics on July 03, 2012, 10:12:24 PM
You could also just take out the pots and pop a resistor in :D