Go to Post Pro-tip: Friends don't let friends play defense! (in qualifications) - Mr. Lim [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-02-2017, 18:33
kjgerdes kjgerdes is offline
Registered User
FRC #3669
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Ripon, California
Posts: 2
kjgerdes is an unknown quantity at this point
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!
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2017, 18:54
flemdogmillion's Avatar
flemdogmillion flemdogmillion is offline
Programmer, Builder, Driver...
FRC #3007
 
Join Date: Nov 2016
Rookie Year: 2015
Location: Minnesota
Posts: 149
flemdogmillion will become famous soon enoughflemdogmillion will become famous soon enough
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.
__________________
Team 4506: 2015-2016
Team 3007: 2017

Jack of all trades except C++ & Java
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2017, 18:58
kjgerdes kjgerdes is offline
Registered User
FRC #3669
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Ripon, California
Posts: 2
kjgerdes is an unknown quantity at this point
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!
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2017, 20:22
flemdogmillion's Avatar
flemdogmillion flemdogmillion is offline
Programmer, Builder, Driver...
FRC #3007
 
Join Date: Nov 2016
Rookie Year: 2015
Location: Minnesota
Posts: 149
flemdogmillion will become famous soon enoughflemdogmillion will become famous soon enough
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).
__________________
Team 4506: 2015-2016
Team 3007: 2017

Jack of all trades except C++ & Java
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2017, 22:34
Hitchhiker 42's Avatar
Hitchhiker 42 Hitchhiker 42 is offline
Roboter
AKA: Mark Lavrentyev
FRC #4557 (FullMetal Falcons)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: Cromwell, CT
Posts: 533
Hitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond repute
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.
Attached Thumbnails
Click image for larger version

Name:	snip.PNG
Views:	41
Size:	31.6 KB
ID:	21707  
__________________



2016 - NE District Championship Entrepreneurship Award
2016 - Hartford District Industrial Design Award
2016 - Waterbury District Engineering Inspiration Award
Reply With Quote
  #6   Spotlight this post!  
Unread 05-02-2017, 18:56
Jonathan L. Jonathan L. is offline
Programmer alumnus, mentor, and CSA
FRC #1094 (Channel Cats)
 
Join Date: Jan 2013
Rookie Year: 2011
Location: St. Louis MO
Posts: 88
Jonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the rough
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 05-02-2017, 22:42
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Texas
Posts: 64
mshafer1 is an unknown quantity at this point
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 06-02-2017, 08:41
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 135
aeastet is an unknown quantity at this point
Re: How do you program the navx mxp in labview?

Quote:
Originally Posted by mshafer1 View Post
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.
__________________
Team 6043 Allegan Tigers
LabVIEW Developer for Kauai Labs (navX and SF2 Libraries)
http://www.kauailabs.com/
Reply With Quote
  #9   Spotlight this post!  
Unread 08-02-2017, 23:34
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 187
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
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.
Reply With Quote
  #10   Spotlight this post!  
Unread 09-02-2017, 09:24
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Texas
Posts: 64
mshafer1 is an unknown quantity at this point
Re: How do you program the navx mxp in labview?

Quote:
Originally Posted by Levansic View Post
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.
Attached Files
File Type: zip ConvertToAbsolute.zip (12.3 KB, 4 views)
Reply With Quote
  #11   Spotlight this post!  
Unread 09-02-2017, 12:41
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 135
aeastet is an unknown quantity at this point
Re: How do you program the navx mxp in labview?

Quote:
Originally Posted by Levansic View Post
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.

Continuous Angle Tracker.vi

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

Thank you for your input,

Tim
__________________
Team 6043 Allegan Tigers
LabVIEW Developer for Kauai Labs (navX and SF2 Libraries)
http://www.kauailabs.com/
Reply With Quote
  #12   Spotlight this post!  
Unread Yesterday, 12:21
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 187
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
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.
Reply With Quote
  #13   Spotlight this post!  
Unread Yesterday, 15:44
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 135
aeastet is an unknown quantity at this point
Re: How do you program the navx mxp in labview?

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.

Get_Continuous_Angle.vi
__________________
Team 6043 Allegan Tigers
LabVIEW Developer for Kauai Labs (navX and SF2 Libraries)
http://www.kauailabs.com/
Reply With Quote
  #14   Spotlight this post!  
Unread Yesterday, 17:29
orangeandblack5 orangeandblack5 is offline
Hates LabView - Uses It Anyway
AKA: Ian Stewart
FRC #5498 (Wired Devils)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Grosse Ile, MI
Posts: 36
orangeandblack5 will become famous soon enough
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?
Reply With Quote
  #15   Spotlight this post!  
Unread Yesterday, 18:21
Jonathan L. Jonathan L. is offline
Programmer alumnus, mentor, and CSA
FRC #1094 (Channel Cats)
 
Join Date: Jan 2013
Rookie Year: 2011
Location: St. Louis MO
Posts: 88
Jonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the rough
Re: How do you program the navx mxp in labview?

Quote:
Originally Posted by orangeandblack5 View Post
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/
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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