[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 574: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 630: sizeof(): Parameter must be an array or an object that implements Countable
Plum Geek Forum • GetHeading() and Navigation question
Page 1 of 1

GetHeading() and Navigation question

Posted: Mon Sep 21, 2015 4:04 am
by cbw060
1) I was trying to use this in the MoveWithOptions function call, as suggested in the new guide.

When I compile i get an error indicating that GetHeading() was not declared in this scope.

I have the latest version of the behaviour file ( 04_01)
2) I am curious in the "driveSquare" behaviour, why the "pause", "resume" and Calibrate functions are callled? I understand why Zero is called but not why the other calls are needed.

Any suggestions?

Re: GetHeading() and Navigation question

Posted: Wed Sep 23, 2015 4:34 am
by PapaBlaza
I'm not 100% sure but I think instead of GetHeading() you can use PresentHeading() or GetDegrees().

Re: GetHeading() and Navigation question

Posted: Fri Sep 25, 2015 8:50 pm
by Kevin
cbw,

I just realized I made a big mistake in the guide. It's "PresentHeading()" not "GetHeading()". I put "getheading" into the guide then when making final edits to the base code before releasing, I changed it to "PresentHeading()" because I though thought that was more clear when used inside MoveWithOptions.

About the Pause and Resume.... if the Gyro and Accelerometer aren't read at least every 80 milliseconds, their internal buffers will overflow. This isn't necessarily bad, it just means that any movement that happened during that time won't be calculated into the present heading and xy coordinates. So if you're going to run a delay, it's good practice to Pause and then Resume.

The reason we were running calibrate over and over is because we were using this behavior at a show and people were handling the bots a lot. If calibration is run when the bot isn't totally still, it'll navigate in strange ways following - so this basically just re-calibrates it a lot. Remember calibration just reads the sensors a few times and cancels out any existing non-zero acceleration in future calculations.