Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Sensors (http://www.chiefdelphi.com/forums/forumdisplay.php?f=173)
-   -   navx-mxp AHRS.getAngle() method (http://www.chiefdelphi.com/forums/showthread.php?t=144092)

schleprock 18-02-2016 14:14

navx-mxp AHRS.getAngle() method
 
according to the documentation in the code for the AHRS.getAngle() method: the return value should be "continuous", so if the robot transitions in the positive direction past 359.9999 degrees, it should return 360 and so on. but according to our experiments, this is not true. the getAngle() method never returns any value >= 360 or <= -360. is there some parameter we need to set to get this behavior?

slibert 19-02-2016 18:44

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by schleprock (Post 1542283)
according to the documentation in the code for the AHRS.getAngle() method: the return value should be "continuous", so if the robot transitions in the positive direction past 359.9999 degrees, it should return 360 and so on. but according to our experiments, this is not true. the getAngle() method never returns any value >= 360 or <= -360. is there some parameter we need to set to get this behavior?

Let me take a look into it, sounds like a bug. Are you using Java?

schleprock 20-02-2016 10:57

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by slibert (Post 1542927)
Let me take a look into it, sounds like a bug. Are you using Java?

yes, using Java.

slibert 21-02-2016 01:44

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by schleprock (Post 1543134)
yes, using Java.

Thanks for helping us find this issue; an updated navX-MXP build is now available which fixes this issue in the Java library.

schleprock 21-02-2016 19:20

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by slibert (Post 1543525)
Thanks for helping us find this issue; an updated navX-MXP build is now available which fixes this issue in the Java library.

thanks for getting a fix out this quickly. unfortunately we did not have the time to test the new library and for now we have a method that normalizes the angle so we can get around this. i'm hoping to be able to look at this later in the week and get back to you.

thanks,

bill

Ether 21-02-2016 20:24

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by schleprock (Post 1543866)
we have a method that normalizes the angle

What's your method?



schleprock 21-02-2016 20:35

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by Ether (Post 1543896)
What's your method?



this is for our pid controller that rotates the robot to a heaing. in our code we now always set a target of 0 ie PIDcontroller.setSetpoint(0)

for the PIDsource we do the following:

public double pidGet() {
double gyroAngle = m_navX.getAngle();

//adding math to normalize the heading for a target of 0
//always
double diff = gyroAngle - m_headingToTurnTo;
if(diff <= -180){
diff += 360;
} else if(diff > 180){
diff -= 360;
}

return(diff);
}

the term normalize may be incorrect, but i couldn't come up with a better way to explain it.

unfortunately, trying to use this to tune the PID controller in test mode is rather difficult, but it does work in our code for commands to turn the robot to a specific heading. well, at least the robot doesn't just continuously spin as it was when we set a heading that caused the robot to spin past an angle of 0 or 360...

schleprock 21-02-2016 20:40

Re: navx-mxp AHRS.getAngle() method
 
Quote:

Originally Posted by schleprock (Post 1542283)
according to the documentation in the code for the AHRS.getAngle() method: the return value should be "continuous", so if the robot transitions in the positive direction past 359.9999 degrees, it should return 360 and so on. but according to our experiments, this is not true. the getAngle() method never returns any value >= 360 or <= -360. is there some parameter we need to set to get this behavior?

oops, it should be

value >= 360 or value < 0


All times are GMT -5. The time now is 20:02.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi