'steer(90)' gives unexpected results

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

Moderators: 99jonathan, roger, imaqine

'steer(90)' gives unexpected results

Postby rhsteach » Fri Mar 09, 2012 7:09 pm

The 'steer' command is giving me erratic results when used with one parameter. (It works as expected with two parameters specified.) I'm wondering what I'm doing wrong, or if there is a bug. I'm using ver 0.9.1 rev 6345.

The code below is intended to have the robot move in a rectangle. Instead of making a 90-degree turn, it makes an s-shaped movement (and then another; I think the travel(50) command is being skipped). If I insert a stop() after the steer, the steer command is ignored.

Code: Select all
int n=1;
     while (n < 3)
     {
     robot.travel(74);   
     robot.steer(90);
     robot.travel(50);
     robot.steer(90);
     n = n+ 1;
     }
rhsteach
New User
 
Posts: 13
Joined: Tue Dec 14, 2010 4:03 am

Re: 'steer(90)' gives unexpected results

Postby Xfel » Sun Mar 11, 2012 4:19 pm

I didn't try your code as I don't have a suitable robot, but in the documentation, it says that the single parameter is the turn rate, not the angle. It just starts driving in a circle until you call stop(). I think the first parameter is the turn rate in the two arg version too, so I am actually not suprised by that. I think you want the robot to turn in place, so you should use the rotate method.
Xfel
New User
 
Posts: 11
Joined: Mon Jan 30, 2012 3:29 pm

Re: 'steer(90)' gives unexpected results

Postby rhsteach » Tue Mar 13, 2012 3:25 pm

Thanks - I did indeed misread the API and was using the command improperly.
rhsteach
New User
 
Posts: 13
Joined: Tue Dec 14, 2010 4:03 am


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

more stuff