error in TachoNavigator.angleTo()???

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

Moderators: 99jonathan, roger, imaqine

error in TachoNavigator.angleTo()???

Postby stanton » Mon Mar 17, 2008 2:25 pm

Hi, I'm a italian student and for my university project I am using lejos!
I noticed that the method angleTo in TachoNavigator class return the angle to point the position x,y always reference at initial position of the robot and does not consider that the robot runs on himself!!!
for example if I call angleTo(10,10) and the robot is in 0,0 and angle 0, the method return 45°, but if the robot turn of +90°, recalling the method it return always 45° instead of -45°!
Why angleTo() not invoke the method normalize() in TachoNavigator as does the method rotateTo()???

Sorry for my bad english but I do not know do better :oops: !!!
stanton
New User
 
Posts: 1
Joined: Mon Mar 17, 2008 2:01 pm

Postby roger » Tue Mar 18, 2008 6:41 am

Hi Stanton,
The reason that the angleTo(x,y) does not change as the robot turns is the same reason the compass direction to your house from the university does not change as you turn. The method angleTo(x,y) returns the angle in cartesian coordinates of the direction vector to the point x,y from the robot location. It does not depend on the direction the robot is facing.
If you want the robot to turn so it faces that point,
Code: Select all
roatateTo(angleTo(x,y));
will do it.
roger
Moderator
 
Posts: 363
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff