Difference between rotate and rotateTo

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Difference between rotate and rotateTo

Postby oceank2 » Fri Jun 15, 2012 6:06 pm

I don't undestand exactly the difference between rotate and rotateTO. Can anyone you give me an example of using ?
Thanks

Christophe
oceank2
New User
 
Posts: 7
Joined: Mon Jun 11, 2012 4:14 pm

Re: Difference between rotate and rotateTo

Postby gloomyandy » Fri Jun 15, 2012 6:19 pm

One is relative the other absolute...
Motor.A.rotateTo(90); // Rotates by 90 degrees to the absolute 90 degree point
Motor.B.rotate(90); // Rotates 90 degrees from current location, so in this case will move to 90 degrees
Motor.A.rotateTo(90); // Will not move as the motor is already at the absolute 90 degree point
Motor.B.rotate(90); // rotates by 90 degrees from current location, so at the end of the move the motor will be at 180 degrees

To understand this sort of thing the best way is simply to try it and see what happens....

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3881
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Difference between rotate and rotateTo

Postby oceank2 » Sat Jun 16, 2012 4:43 pm

Thanks for the answer. :)
oceank2
New User
 
Posts: 7
Joined: Mon Jun 11, 2012 4:14 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff