Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   How do you program the navx mxp in labview? (http://www.chiefdelphi.com/forums/showthread.php?t=154752)

kjgerdes 04-02-2017 18:33

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!

flemdogmillion 04-02-2017 18:54

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.

kjgerdes 04-02-2017 18:58

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!

flemdogmillion 04-02-2017 20:22

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).

Hitchhiker 42 04-02-2017 22:34

Re: How do you program the navx mxp in labview?
 
1 Attachment(s)
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.

Jonathan L. 05-02-2017 18:56

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. :mad:

mshafer1 05-02-2017 22:42

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.

aeastet 06-02-2017 08:41

Re: How do you program the navx mxp in labview?
 
Quote:

Originally Posted by mshafer1 (Post 1640880)
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.

I just wanted to let you know that you do not need to store the yaw value in a global variable. If you place the Get_YPRHfH.vi directly into the auton it will read automatically if you have the navX main vi placed properly. This is the reason we moved to the action engine for all of our parameters. You can place this vi in as many locations as you need to get the value. This allows you to only read the value when you need it.

If you have questions please let me know.

Levansic 08-02-2017 23:34

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?

mshafer1 09-02-2017 09:24

Re: How do you program the navx mxp in labview?
 
1 Attachment(s)
Quote:

Originally Posted by Levansic (Post 1642337)
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?

I am attaching the vi's that we used last year to convert the yaw that we got from NavX (-180 to 180 if I remember correctly) to an absolute value (starting at zero and continuous counting from there, so -infinity to +infinity). I'm not sure what you mean by a modeled value, but this should give you an idea of how to do it if this is not what you meant.

aeastet 09-02-2017 12:41

Re: How do you program the navx mxp in labview?
 
1 Attachment(s)
Quote:

Originally Posted by Levansic (Post 1642337)
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?

OK I developed this a few minutes ago. I can not promise that it works perfectly yet. I am working with the other developers at navX to test it to release to the public. You can try this vi with no guarantees that it will do everything you are asking.

Attachment 21764

Try it and let me know if you need more capabilities.

Thank you for your input,

Tim

Levansic 10-02-2017 12:21

Re: How do you program the navx mxp in labview?
 
Thanks for the replies. I'll check out both of your codes in our setup later on today. We worked up our own code to do this, but it looks like we lose a little bit of truth when we reset the NavX heading to avoid the edge discontinuity.

I apologize for my less than clear explanation. We have some code that filters the user input and models what we want the robot to do. We then compare this desired movement model to the current state of the inertial devices to provide a corrected input to our drive code.

We are using a non-traditional holonomic drive, and the robot is not as controllable as we would like. For those who haven't looked it up, holonomic means rolling without slipping. As soon as you push a holonomic wheel hard enough to slip, you've then lost control of your rotation and translation. Likewise, if you accelerate hard enough that one wheel reduces its contact with the ground, you will lose rotation and translation control as holonomic drives work by balancing forces of non-parallel wheels/rollers. This makes your robot look like it is on the Lunacy "ice" rather than the relatively high traction carpeting. Modeling the desired motion, and then doing closed loop control to correct the robot position to match the model, is how we fix this.

Maybe a better explanation is that a driver commands velocity, not position, but views the motion of the robot in its trajectory of positions over time. Our model captures the commanded velocities, translates them to realistic positions (both rotational and translational), then controls the robot to hit the expected positions by using feedback to adjust the wheel velocities. You have to model the rotational orientation to be able to seek to that, and it can't be done if you have a discontinuity in the heading when you pass through a trigonometric singularity point.

aeastet 10-02-2017 15:44

Re: How do you program the navx mxp in labview?
 
1 Attachment(s)
OK here is the revised beta edition that also handles multi devices and has a reset. We may still change the overall function in the next release of this code.

Attachment 21771

orangeandblack5 10-02-2017 17:29

Re: How do you program the navx mxp in labview?
 
Okay, this is cool and all, but how do you even OPEN this gyroscope? All our LabView is giving us is Analog and XRS450 SPI. I'm assuming we need to download the code externally (like for our CAN Talons), so does anybody have a link to that?

Jonathan L. 10-02-2017 18:21

Re: How do you program the navx mxp in labview?
 
Quote:

Originally Posted by orangeandblack5 (Post 1643105)
Okay, this is cool and all, but how do you even OPEN this gyroscope? All our LabView is giving us is Analog and XRS450 SPI. I'm assuming we need to download the code externally (like for our CAN Talons), so does anybody have a link to that?

You can get the navX Device Library from
http://www.pdocs.kauailabs.com/navx-mxp/software/

There is a tutorial a couple of links under that page
http://www.pdocs.kauailabs.com/navx-...aries/labview/


All times are GMT -5. The time now is 19:51.

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