My favourite chapter is ‘Using Ringo’s Navigation’.
Can anybody tell me the commands I should be looking for?
It seems clear to me how Ringo’s heading is determined. But not how Ringo can calculate the X Y offset with information from the accelerometer. Ringo may rotate to return back to an earlier heading. I would like it to make it return to an earlier position. Any pointers to get me started? Appreciated. Thanks.
Ringo keeps a memory of his X and Y location

 Posts: 6
 Joined: Sat Aug 08, 2015 11:16 pm
Re: Ringo keeps a memory of his X and Y location
NavigationXY() keeps track of x & y position. It has inputs GyroSensitivity and AccelSensitivity (100 and 800 are good values for most environments) which are used to determine if it is moving (global variable IsStationary). Kevin pointed out that this might be confusing so he is writing a function to encapsulate it.
Here's an example of how to use it:
NavigationBegin();//Ringo defined to be at {0,0} with heading 0 degrees.
ResumeNavigation();
while(1){
NavigationXY(100,800);//or use new function to be released in next update
degr=PresentHeading();//in degrees
x=GetPositionX();//in mm
y=GetPositionY();//see Navigation.h for more navigation query functions
}
The yaxis faces directly away from you and the xaxis is to the right (just like in any math textbook). 0 degrees is along the yaxis, 90 degrees is along the xaxis, and 90 degrees (or 270 if you got there by turning clockwise) is along the negative xaxis. The exact position is defined to be the center point between the wheels (the accelerometer is 30mm in front of this, between the headlights/eyes, but this offset is automatically compensated for so can be ignored).
If you were to turn the robot 90 degrees to the right (clockwise) and push it 100mm away from you then GetPositionX() and GetPositionY() will give a position of {0,100} and PresentHeading() will be 90 degrees. The acceleration for the zaxis (in mm/s^2) and rotation for the other 2 gyro axes (in degrees/s) can be queried but NavigationXY() doesn't do any additional calculations for them.
One thing that NavigationXY() does NOT compensate for is tipping forwards & backwards. Since gravity produces an acceleration much larger than the wheels can manage, this can produce a big effect for even 1 degree of tilt. Therefore, you may want to adjust the motor heights by carefully sliding them along their clips so that they barely touch the ground. There are other effects such as the vibrations produced by the motors themselves (also quite large though random so mostly cancels out), but we've found that you can still get as little as 10% error over a few seconds of movement.
Hope this helps,
Dustin Soodak
p.s. I wrote a version which looked at the gyro to compensate for tilt but found that the xaxis has too much drift for this to be useful without additional signal processing. You could probably also compensate for longterm error in velocity by looking at the robot's raw xaxis acceleration as it turns, but I haven't written any code for this yet.
Here's an example of how to use it:
NavigationBegin();//Ringo defined to be at {0,0} with heading 0 degrees.
ResumeNavigation();
while(1){
NavigationXY(100,800);//or use new function to be released in next update
degr=PresentHeading();//in degrees
x=GetPositionX();//in mm
y=GetPositionY();//see Navigation.h for more navigation query functions
}
The yaxis faces directly away from you and the xaxis is to the right (just like in any math textbook). 0 degrees is along the yaxis, 90 degrees is along the xaxis, and 90 degrees (or 270 if you got there by turning clockwise) is along the negative xaxis. The exact position is defined to be the center point between the wheels (the accelerometer is 30mm in front of this, between the headlights/eyes, but this offset is automatically compensated for so can be ignored).
If you were to turn the robot 90 degrees to the right (clockwise) and push it 100mm away from you then GetPositionX() and GetPositionY() will give a position of {0,100} and PresentHeading() will be 90 degrees. The acceleration for the zaxis (in mm/s^2) and rotation for the other 2 gyro axes (in degrees/s) can be queried but NavigationXY() doesn't do any additional calculations for them.
One thing that NavigationXY() does NOT compensate for is tipping forwards & backwards. Since gravity produces an acceleration much larger than the wheels can manage, this can produce a big effect for even 1 degree of tilt. Therefore, you may want to adjust the motor heights by carefully sliding them along their clips so that they barely touch the ground. There are other effects such as the vibrations produced by the motors themselves (also quite large though random so mostly cancels out), but we've found that you can still get as little as 10% error over a few seconds of movement.
Hope this helps,
Dustin Soodak
p.s. I wrote a version which looked at the gyro to compensate for tilt but found that the xaxis has too much drift for this to be useful without additional signal processing. You could probably also compensate for longterm error in velocity by looking at the robot's raw xaxis acceleration as it turns, but I haven't written any code for this yet.
Who is online
Users browsing this forum: No registered users and 1 guest