Answers.Body: <p>You can read the tacho count and rotate a negative amount of degrees. Or you may want to use the Navigation class and create a path while you move, then you just need to follow the path back.</p>
  
  <p>But unless the robot is perfectly calibrated it will fail miserably. I explain it all here <a href="http://thetechnicgear.com/2014/06/howto-calibrate-differential-drive-robot/" rel="nofollow">http://thetechnicgear.com/2014/06/howto-calibrate-differential-drive-robot/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-02T09:13:59.263Z
Answers.Text: The robot is way too far from perfect calibration :) because it has lots of sensors and cables on it unfortunately it isn't well calibrated. Im thinking of other ways like calculating the distance to walls and finding the center, when the distances are equal I assume I will be in the middle, but an assumption...
Answers.UserDisplayName: Anarkie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-02T20:10:04.193Z
Answers.Text: It isn't a bad idea... in fact Montecarlo localization works with a similar idea... just rememeber EV3/NXT Ultrasonic sensors only reach 2m at most.
Answers.UserDisplayName: Miguel
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-02T20:37:05.757Z
Answers.Text: The room is a square 90 x 90 cm, another mate on the project is trying to implement the Montecarlo but till now no success...
Answers.UserDisplayName: Anarkie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-01T21:50:15.003Z
Answers.LastActivityDate: 2014-06-01T21:50:15.003Z
Answers.UserDisplayName: Miguel
Answers.Body: <p>Are you programming your robot to move? If so, then you could just keep a running log in your code of how far did each of the motors turn. Based on this log you could replay the whole log backwards to return to the starting point (with the approppriate precision of course). If your robot is moving due to external forces (e.g. someone is pushing it) then you can only rely on the decoding that you mentioned above.</p>
  
  <p>For code references see these resources:</p>
  
  <ul>
  <li><a href="http://social.msdn.microsoft.com/Forums/en-US/100f8d4a-df1c-49b8-9dea-b01948b06def/lego-nxt-motor-encoder-updates?forum=roboticstroubleshooting" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/100f8d4a-df1c-49b8-9dea-b01948b06def/lego-nxt-motor-encoder-updates?forum=roboticstroubleshooting</a></li>
  <li><a href="http://www.lejos.org/nxt/nxj/tutorial/AdvancedTopics/Advanced_Hardware.htm" rel="nofollow">http://www.lejos.org/nxt/nxj/tutorial/AdvancedTopics/Advanced_Hardware.htm</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-14T08:51:50.130Z
Answers.LastActivityDate: 2014-05-14T08:51:50.130Z
Answers.UserDisplayName: zovits
Body: <p>I have a LEGO NXT robot, and after some movements I would like it to return back where it started. After some research, it looks like my best option is to revert the motors. To decode their movements but I couldn't find any examples for it, could someone give me a hand? I'm using leJOS for programming.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-04T21:24:20.067Z
Comments.Text: This is fundamentally a variant of [How to remember initial position of a robot and return to it](http://bricks.stackexchange.com/q/2973/56) albeit with the NXT.
Comments.UserDisplayName: Zhaph - Ben Duguid
Tags: <mindstorms><nxt><motor><pathfinding>
Title: Return a robot to its start position?
UserDisplayName: Anarkie
ThreadText: # Return a robot to its start position?
  
  (Asked by: username_0 on 2014-05-01)
  
  I have a LEGO NXT robot, and after some movements I would like it to return back where it started. After some research, it looks like my best option is to revert the motors. To decode their movements but I couldn't find any examples for it, could someone give me a hand? I'm using leJOS for programming.
  
  **Tags:** mindstorms, nxt, motor, pathfinding
  > **Comments:**
  > **username_1**: This is fundamentally a variant of [How to remember initial position of a robot and return to it](http://bricks.stackexchange.com/q/2973/56) albeit with the NXT.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-01. Score: 2
  
  You can read the tacho count and rotate a negative amount of degrees. Or you may want to use the Navigation class and create a path while you move, then you just need to follow the path back.
  
  But unless the robot is perfectly calibrated it will fail miserably. I explain it all here <http://thetechnicgear.com/2014/06/howto-calibrate-differential-drive-robot/>
  
  > **Comments:**
  > **username_0**: The robot is way too far from perfect calibration :) because it has lots of sensors and cables on it unfortunately it isn't well calibrated. Im thinking of other ways like calculating the distance to walls and finding the center, when the distances are equal I assume I will be in the middle, but an assumption...  
  > **username_2**: It isn't a bad idea... in fact Montecarlo localization works with a similar idea... just rememeber EV3/NXT Ultrasonic sensors only reach 2m at most.  
  > **username_0**: The room is a square 90 x 90 cm, another mate on the project is trying to implement the Montecarlo but till now no success...  
  
  ---
  
  ### Answer by username_3 on 2014-05-14. Score: 0
  
  Are you programming your robot to move? If so, then you could just keep a running log in your code of how far did each of the motors turn. Based on this log you could replay the whole log backwards to return to the starting point (with the approppriate precision of course). If your robot is moving due to external forces (e.g. someone is pushing it) then you can only rely on the decoding that you mentioned above.
  
  For code references see these resources:
  
  * <http://social.msdn.microsoft.com/Forums/en-US/100f8d4a-df1c-49b8-9dea-b01948b06def/lego-nxt-motor-encoder-updates?forum=roboticstroubleshooting>
  * <http://www.lejos.org/nxt/nxj/tutorial/AdvancedTopics/Advanced_Hardware.htm>
  
  
  ---
  
  