Go to Post One wondered why they couldn't practice in the gym that day - because the robotics team had it reserved was the answer. "Oh, we have a robotics team?" Sigh. This is a team with a low number. They've been around for at least a dozen years. There's still a lot more culture-changing to do. - GaryVoshol [more]
Home
Go Back   Chief Delphi > CD-Media > White Papers
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

photos

papers

everything



LabVIEW Mecanum Programming

By: Jogo
New: 19-02-2011 23:36
Updated: 20-02-2011 08:24
Total downloads: 3748 times


This tutorial is a step-by-step implementation of mecanum drive in LabVIEW.

This tutorial is a step-by-step implementation of mecanum drive in LabVIEW. It is between beginner and intermediate LabVIEW, so it assumes some experience with LabVIEW and control loops.

Questions and comments are encouraged.

Attached Files

  • pdf LabVIEW Mecanum Programming (Rev 1)

    mecanum1.1.pdf

    downloaddownload file

    uploaded: 20-02-2011 08:24
    filetype: pdf
    filesize: 879.75kb
    downloads: 3746



Recent Downloaders

  • Guest

Discussion

view entire thread

Reply

20-02-2011 01:22

Ether


Unread Re: paper: LabVIEW Mecanum Programming


Nice presentation. This should prove helpful to teams just getting started with LabVIEW and mecanum.

There's a small error on Page 19 which may lead some astray:

Quote:
Wouldn't it be convienient to--on the push of a button--rotate to the direction you're traveling?
▪To calculate this angle, do Math.atan2(Joystick X, -Joystick Y)
▪Implement a PID loop--the setpoint is the joystick angle, and the process variable is the gyro angle
The above won't work very well. The joystick angle will be -180..+180, and the gyro angle will be 0..360+

You can't just pass the joystick angle and gyro angle to the PID as-is. The PID will not like that at all.

For example, if the joystick angle is -1 degree and the gyro is reading +359 degrees, the PID will calculate (and act upon) an error of -1-359 = -360 degrees... even though the vehicle is already pointing in the desired direction.

To use the LabVIEW PID in this situation, you need to do something like this:

Code:
angle_error = joystick_angle - gyro_angle;
angle_error -= 360*floor(0.5+angle_error/360);
setpoint = gyro_angle + angle_error;
process_variable = gyro_angle;

Example LabVIEW code for the second line in the code block above can be found here.






20-02-2011 08:26

Jogo


Unread Re: paper: LabVIEW Mecanum Programming

Thank you Ether. I added in a solution that I used but neglected to include in the first version. Now that I look at your solution closer, however, yours seems a great deal more elegant.



02-02-2012 20:04

maria_edu


Unread Re: paper: LabVIEW Mecanum Programming

I have a question on slide 9; what is the blue thing within the case structure? Sorry 1st time programming mechanum drive. Very helpful presentation



02-02-2012 21:16

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

I don't know what it is you're referring to. Can you describe the "blue thing" a little better? Blue typically means an integer value.



02-02-2012 21:22

maria_edu


Unread Re: paper: LabVIEW Mecanum Programming

Sorry about that; I mean in the true/false case structure, there is the"blue thing" that says"L1 rotate_mode." My question is where is that located in labview?



02-02-2012 21:30

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

rotate_mode is a global variable that was defined on the immediately preceding slides. L1 is an enumerated constant that was obviously created by right-clicking the input terminal of the variable and choosing Create Constant.



06-02-2012 20:26

2829ron


Unread Re: paper: LabVIEW Mecanum Programming

Hello,

I did all the steps in page 8, but can not get my robot global data to read the "rotate mode" enum. Any help would be appreciated.

Thanx,

David



06-02-2012 22:36

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

I'm not sure what you mean. The robot global data doesn't "read" or "write" the values. It just provides a place that contains them.

Are you trying to say you can't get the global variable to appear on the Teleop block diagram?



07-02-2012 09:26

2829ron


Unread Re: paper: LabVIEW Mecanum Programming

Yes sir. That is what I meant. I defined it's values in the Robot Global Value.vi but they won't show in teleoperated.

Thanks,

David



07-02-2012 10:56

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

It's not exactly obvious how to place a reference to an existing global variable. Here's how to do it:

Right-click on an empty spot in the block diagram to call up the function palette. Choose "Select a vi..." and navigate to the folder containing your robot project. Open "Robot Global Data.vi" and you'll have a global variable attached to your cursor (it will likely be named "Enable Vision" -- don't worry about it). Click to place that variable on the block diagram. Now you can click on the middle of the variable to bring up a list of all the globals that are part of the Robot Global Data vi. Choose the one you want.

The default is to make a "write" reference. To change it to "read", right-click on the variable and choose "Change To Read".



07-02-2012 23:00

2829ron


Unread Re: paper: LabVIEW Mecanum Programming

Okay. I got the global variable to show up, and I can connect the constant to it. But when I change the global variable to read, I can't connect my constants anymore. Did I totally mess up somewhere? This is my third year programming, but I've never messed with the global robot data vi.

Thanks,

David



07-02-2012 23:43

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

If you want to put a constant in the global variable, you need to write to it. You would read it if you want to do something with the value it contains.



08-02-2012 20:49

2829ron


Unread Re: paper: LabVIEW Mecanum Programming

Okay. On to page 14 I'm getting tired of asking questions. But thanks to everyone for your help. The rotate mode runs into the case structure and then connects to the symbol I can't seem to find. It's blue with an arrow and a box with a circle under it.

Also, do need to create a global variable called "header"? If so, what properties does it need to have?

And... what is connect to the PID on page 15?

Thanks again,

David



08-02-2012 22:53

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

Quote:
Originally Posted by 2829ron View Post
The rotate mode runs into the case structure and then connects to the symbol I can't seem to find. It's blue with an arrow and a box with a circle under it.
It's called a Feedback Node. You will find it in the Programming>Structures function subpalette. Its output is the value that was connected to its input the previous time through the loop. It changes color based on what type of data it's connected to; in this case it's blue because the data is an (enumerated) integer type.

(The Feedback Node look has changed slightly between LabVIEW 8.6 and LabVIEW 2011. The "box with circle" is now a wider box with an asterisk.)



11-02-2012 12:05

2829ron


Unread Re: paper: LabVIEW Mecanum Programming

Thanks for all your help. I've got a few more questions here, and then I think I'll have it.

Do I need to create a global variable called "header"? If so, what properties does it need to have?

And... what is connected to the PID on page 15?

Thanks again,

David



11-02-2012 22:04

Jogo


Unread Re: paper: LabVIEW Mecanum Programming

Hello David. You do need to add a global variable called "header" (numeric), which is used to store the gyro angle each time rotate_mode changes to "straight".

For tuning the PID function, first right click on the "PID gains" terminal and add a control or a constant, and follow the instructions on page 16. There are plenty of good resources around the web for PID tuning specifics: http://zone.ni.com/devzone/cda/tut/p/id/3782.

If you have more implementation-specific questions, feel free to PM me.



29-02-2012 11:53

Ernesto


Unread Re: paper: LabVIEW Mecanum Programming

Ok My names Ernesto
I am still stuck on the global header and would like to ask if you could explain more on how to make it.



03-04-2012 13:19

mjgard


Unread Re: paper: LabVIEW Mecanum Programming

I am also trying to figure out the global variable header. I wasnt sure where to create it or how. So i created a numeric and then create a local variable from the numeric and called it header and used that within my teleop code. Will this work or do i need to create a global somehow?



03-04-2012 13:41

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

The Robot Global Data.vi is where you create global variables (if you need them). It's only a front panel, with no block diagram. Place (or paste) a control of the appropriate type on the front panel, then right-click it and make its label visible if it isn't already. Change the label to whatever name you want the global variable to be.

To use a global variable, you can either copy one from elsewhere, or use the "Select a VI" item in the function palette to pick the Robot Global Data. You'll end up with something on your block diagram with a popup menu that lets you choose among all the globals. You can use the right-click menu to make it a "read" or a "write".



15-05-2012 19:18

xule


Unread Re: paper: LabVIEW Mecanum Programming

I followed the directions (somehow I must have missed something).








15-05-2012 21:05

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

Quote:
Originally Posted by xule View Post
I followed the directions (somehow I must have missed something).
If you double-click on the error, it should take you to the Case structure having the missing cases.

There are only two Case structures, right? The inner Case structure (inside the outer Straight case) should contain the True case you showed, along with an empty False case. The outer Case structure should contain a case for every possible value of the Rotation_mode enumeration. You're only showing us the Straight and L1 cases. Are any of the others missing?



15-05-2012 23:49

xule


Unread Re: paper: LabVIEW Mecanum Programming

L2,R2,and R1 are there as laid out in Step 4, same structure as L1 just different constant for rotation.

[IMG][/IMG]

[IMG][/IMG]

double clicking highlights the whole structure.



16-05-2012 07:44

Mark McLeod


Unread Re: paper: LabVIEW Mecanum Programming

Is there a blank in the enumeration list?
Sorry, I can't see your posted images. They get blocked where I am.



16-05-2012 07:57

xule


Unread Re: paper: LabVIEW Mecanum Programming

Thanks, that was it. A blank space in the enumerated list.



16-05-2012 08:06

Alan Anderson


Unread Re: paper: LabVIEW Mecanum Programming

Quote:
Originally Posted by xule View Post
double clicking highlights the whole structure.
You mean the outer Case structure, the one having Rotation_mode as its selection input, right?

Double-check the list of possible values of Rotation_mode. Make sure there are only the five you expect. You might accidentally have inserted an unnamed value at the end.



16-05-2012 08:33

xule


Unread Re: paper: LabVIEW Mecanum Programming

Thanks, that was it. Program runs.



22-11-2012 16:18

Priyesh69


Unread Re: paper: LabVIEW Mecanum Programming

Quote:
Originally Posted by Alan Anderson View Post
It's not exactly obvious how to place a reference to an existing global variable. Here's how to do it:

Right-click on an empty spot in the block diagram to call up the function palette. Choose "Select a vi..." and navigate to the folder containing your robot project. Open "Robot Global Data.vi" and you'll have a global variable attached to your cursor (it will likely be named "Enable Vision" -- don't worry about it). Click to place that variable on the block diagram. Now you can click on the middle of the variable to bring up a list of all the globals that are part of the Robot Global Data vi. Choose the one you want.

The default is to make a "write" reference. To change it to "read", right-click on the variable and choose "Change To Read".
I dont get how we do the stuff for the 9th slide, I mean i can't do ctrlE on the Gobal robot data. I'm accessing it by the projet explorer. I can acces the front panel but not the block diagram



22-11-2012 18:27

Mark McLeod


Unread Re: paper: LabVIEW Mecanum Programming

There is no Block Diagram for Global Data, so ignore that.

  1. Open the Global Data.vi (front panel) since you already discovered how from the Project Explorer.
  2. Right-click to get the front panel menu, choose an Enum control and place it on the Global Data.vi front panel.
  3. Follow the rest of the powerpoint directions.
Here is a simple step-by-step guide to adding global variables in general: CreateGlobal.PDF



13-08-2014 12:10

tr6scott


Unread Re: paper: LabVIEW Mecanum Programming

We purchased a Mecanum kit as an off-season project and played with the code last night. I believe there are some errors in the code, that I thought I would post here in case others also did not get the results expected.

First, let me thank you for taking the time to develop this, it was a huge asset with trying to get students to get the code working.

Now to the issues.

On page 14, I believe the feedback node needs to be outside of the case structure for "Straight"... What we saw is that the only way you can get into the "Straight" structure is for the rotate_mode to be equal to "Straight" and therefore the feedback node can only be equal to "Straight" and since they never not equal each other, you never update the "Header" value.

When you add the PID on page 15, the PID now will unwind whatever rotation you do, because the Header is not updated, and stuck at the default, which we set to 0. So spin the bot 3 times CCW, and the let go of the sticks, the PID runs the 3 times CW and stops.

The simple fix for this is to move the feedback node out, and the header updates correctly.

On slide 17, when you add the case structure to make sure the rotate momentum is less than 10, this also breaks Header updating. As written the Header can only update the first loop after you took your finger off the sticks, so if you are spinning faster than the 10, the Header will not update, and if spinning slower than 10, you really didn't need this case anyways....

I have not fixed this one yet. It seems we almost need another enumeration state.. Say the joysticks put you in a "WaitingForStraight" and the case structure for WaitingForStriaght would check that rate less than 10 while sending 0 to the rotation, once the rate is less than ten we would write Straight to the "Rotate_Mode"

I'll post back in a couple weeks on this fix, and debugging of page 21.



view entire thread

Reply

Tags

loading ...



All times are GMT -5. The time now is 13:38.

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