Society of Robots - Robot Forum

Software => Software => Topic started by: byuri on February 02, 2009, 01:18:01 PM

Title: spin 90 degrees 50$ robot.
Post by: byuri on February 02, 2009, 01:18:01 PM
Hello, I need help with the code of the 50$ robot.
How to make robot turn around in 90 degrees?
I tried the following code
Code: [Select]
void robot_spin_right(void) //robot spin right 90 degrees
{
for (i=0 ; i<19 ; i++)
{
robot_turn_right();
delay_cycles(1000);
}
}

But there is a problem with this code. If the battery full, it spins about 90 degrees,
but as the battery voltage falls down the robot is not able to complete the spin.

Someone has an idea how to help me?
Title: Re: spin 90 degrees 50$ robot.
Post by: galannthegreat on February 02, 2009, 02:28:33 PM
Are you powering your MCU with a Voltage Regulator or raw battery power?
Title: Re: spin 90 degrees 50$ robot.
Post by: TrickyNekro on February 02, 2009, 02:30:53 PM
Yup.... but you gotta let yourself in some deeper water....
To do an exact 90 degree spin you need encoders...
encoders are like switches that measure a certain amount of "clicks" per revolution of one wheel...
Google about encoders and servos.... NOTE that RC servos are NOT real servos... They are a hybrid...
A real servo let's you know the position of the motor or it's speed... RC servos get a pulse and you assume
it will run at the speed requested.... :P


So do a little goggle and we will help you out more if we can!!! :P
Cheers!!!
Title: Re: spin 90 degrees 50$ robot.
Post by: galannthegreat on February 02, 2009, 02:36:56 PM
Good point, some really easy to use motors and encoders to use would probably be:

Encoders from Solarbotics:
              http://www.solarbotics.com/motors_accessories/wheels/3/ (http://www.solarbotics.com/motors_accessories/wheels/3/)
EDIT: from what I've been told via email from Dave at SB, they are either re-vamping the design of them or canning 'em for good.


Motors like these ones from them fit perfectly with it:
http://www.solarbotics.com/products/gm8/ (http://www.solarbotics.com/products/gm8/)
Title: Re: spin 90 degrees 50$ robot.
Post by: Razor Concepts on February 02, 2009, 04:31:29 PM
Also you could use a magnetic compass sensor.
Title: Re: spin 90 degrees 50$ robot.
Post by: Webbot on February 02, 2009, 05:44:13 PM
Or you could use stepper motors
Title: Re: spin 90 degrees 50$ robot.
Post by: byuri on February 03, 2009, 10:32:19 AM
i read about wave_front tutorial
http://www.societyofrobots.com/programming_wavefront.shtml
Admin use iRobot and like i saw at the movie, the robot spin exactly 90 degrees.
did Admin use encoders or digital compass to rotate the robot?

Title: Re: spin 90 degrees 50$ robot.
Post by: Admin on February 13, 2009, 12:57:14 AM
i read about wave_front tutorial
http://www.societyofrobots.com/programming_wavefront.shtml
Admin use iRobot and like i saw at the movie, the robot spin exactly 90 degrees.
did Admin use encoders or digital compass to rotate the robot?
The iRobot Create uses encoders . . . attached to a stretchable rubber belt . . . so the accuracy was horrible . . .

Anyway, its impossible to rotate 90 degrees exactly every time:
http://www.societyofrobots.com/robot_faq.shtml#robot_accuracy_tradeoff