|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: navx-mxp AHRS.getAngle() method
Thanks for helping us find this issue; an updated navX-MXP build is now available which fixes this issue in the Java library.
|
|
#2
|
||||
|
||||
|
Quote:
thanks, bill |
|
#3
|
||||
|
||||
|
Re: navx-mxp AHRS.getAngle() method
What's your method?
|
|
#4
|
||||
|
||||
|
Re: navx-mxp AHRS.getAngle() 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... Last edited by schleprock : 21-02-2016 at 20:39. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|