randomly changing directions

Questions about Marilou Open Devices Access (MODA)
Post Reply
travolta
Posts: 8
Joined: Tue Jan 12, 2010 5:31 am

randomly changing directions

Post by travolta » Tue Jan 12, 2010 2:18 pm

Random
Last edited by travolta on Thu May 13, 2010 12:02 am, edited 1 time in total.

bernardos
Posts: 24
Joined: Fri Mar 30, 2007 10:33 pm

Post by bernardos » Tue Jan 12, 2010 5:45 pm

hey,

you can run your robot using speed and random steering commands:

Code: Select all

void SetSpeedAndSteering(float speed, float steering)
{
_motor1->SetSpeedDPS(speed-steering);
_motor2->SetSpeedDPS(speed+steering);
}

....

float random_steering=180*(float(rand())/MAX_RAND);
SetSpeedAndSteering(360,random_steering);
Every 10 seconds (in your robotics loop) you change your random_steering using the randomizer (rand) ...

Bern

Post Reply