|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do you program the navx mxp in labview?
Right now we are just trying to program our navx mxp in teleop so that when we press a certain button and drive forward it corrects the robot and keeps it straight. If anyone has an example code I could look at that would be great.
Thanks! |
|
#2
|
||||
|
||||
|
Re: How do you program the navx mxp in labview?
I'm unfamiliar with NavX, but what you're talking about would require a PID loop. PID loops take time to tune and basically what you're doing is handing off control of a movement axis to the robot, which is potentially dangerous.
|
|
#3
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
Ok, so is there a way to make your robot drive straight in autonomous independent mode using the navx? If so do you have an example code I could look at? Thanks!
|
|
#4
|
||||
|
||||
|
Re: How do you program the navx mxp in labview?
You'll need to get an angle from the NavX, is there a library function for that? Once you have an angle, you'll need to feed it in as the process variable of a PID loop. Hook up the PID VI's output to your rotation axis of your drive VI. Then, tune the PID loop.
I recommend using Select from the Comparison palette connected to a button on your joystick so that you can switch between manual and loop control by holding down a button for loop control. Also set it up so that the PID loop reinitializes whenever you press or release the button by using "Equal?" and a feedback node (in this case set it to feed forward). |
|
#5
|
||||
|
||||
|
Re: How do you program the navx mxp in labview?
See the attached image. What happens is that one side stays at a fixed speed (percent voltage in this case) and the PID loop varies the other side to match it and keep it straight on course.
|
|
#6
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
This is what we did last year. Our code is posted here.
There is a Drive subVI in TeleOp. The "Field Centric" case of the large case structure around the drive code never worked correctly...not enough time for testing it. ![]() |
|
#7
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
Breakaway has done this for a couple of years now.
Because we use the gyro in both modes, we put Get_YPRHfH.vi and store the gyro's position (yaw) into a global in Periodic tasks, and use that global in auto. ![]() The basic principal is that WPI has already provided great algorithms for a x/y control algorithm (Arcade drive). So we use a PID (target gyro angle as the setpoint, the global from the gyro for the process variable, and work out the tuning) as the x input to the Arcade Drive vi, and usually a constant into the y value. We have found that the gyro updates rapidly enough to support this (we've even translated vision analysis into a desired gyro angle because the gyro was updating fast enough and the vision was not.) The NavX library has updated some since we did this. You could combine this idea with the TeleopRotateToAngle.vi in the navX\Examples folder. |
|
#8
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
Quote:
If you have questions please let me know. |
|
#9
|
||||
|
||||
|
Re: How do you program the navx mxp in labview?
Is there any way to get a continuous fused heading or yaw that doesn't jump at 360/0 or -180/180 degrees? I ask, because we model and correct yaw in an ongoing basis to a modeled value. I know we could reset the gyro if the abs(yaw) > 120 or so, but we want to be able to do a 360 degree closed loop orbit for testing (without sparing at the point where yaw or heading magically jump 360 degrees).
It looks like those values are only being read off a registry, and not calculated in LabVIEW. Is there any way to tell the NavX to put the non-resetting values in those registers? Last edited by Levansic : 08-02-2017 at 23:39. |
|
#10
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
Quote:
|
|
#11
|
|||
|
|||
|
Re: How do you program the navx mxp in labview?
Quote:
Continuous Angle Tracker.vi Try it and let me know if you need more capabilities. Thank you for your input, Tim |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|