Generate wheels turn code

Questions about Marilou Open Devices Access (MODA)
Post Reply
Posts: 24
Joined: Fri Apr 22, 2011 6:45 am

Generate wheels turn code

Post by jstoquica » Thu Sep 15, 2011 9:09 pm


i am programing my robot, but i have a problem with set a specific direction or movement. I need turn my robot 90 degrees, if i use servo motors, robot cant turn left o rifht because -180/-180 limit the movement. If i use a motor, do i have to develop my code in the main () of main.pp ???? i try this (viewtopic.php?f=3&t=185) , but i cant use a module programing (class myownrobot -> call it at main ()) for pConnection declaration.

I dont know how to move my robot 90 degrees or other specific rotation movement. do i have to put my robotics loop in the main()??? or is there other option for do it?


Posts: 20
Joined: Thu Jun 16, 2011 8:01 am

Re: Generate wheels turn code

Post by yusie.rizal » Fri Sep 16, 2011 1:58 am


I think you should put your code in
// put your code here
This is where system always looping forever.

I also have experience to use servo and dc motor.
In servo motor, I observed that i can rotate it for example from 0 to some degree of angles.
But, if it reach some angle (if i am not mistaken it was 270 deg or something), it will rotate opposite direction to reach that angle. Since I didn't know the 'real' servo is like that, I mean, I guess the real servo behave like that so i moved and used dc motor.
In dc motor, i just use command as follow :
pDeviceMotor0->SetVelocityDPS(90); to rotate motor
test = pDeviceMotor0->GetOdometerCounter(); to count the angle..

So from here we just need to do simple math..

Hope this will help!


Posts: 305
Joined: Mon Feb 12, 2007 11:55 pm
Location: FR

Re: Generate wheels turn code

Post by LR » Fri Sep 16, 2011 8:07 am


If you want to use servo for getting angle instead of using odometers, check the 'allow continuous rotation' and 'maintain absolute angle' servo properties.

So for making your robot to turn about 90°, you have to do it according to
- the wheels diameter,
- interwheels distance wheels .

Post Reply