|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
General LabVIEW questions from a VERY new user
This is my first year programming on our Robotics Team and our previous programmer didn't teach me a thing. I do have prior experience in Basic, C++, Java, and my calculator (physics equations OP), but I saw LabVIEW for the first time about a weak ago. I'm trying to work my way through it slowly but surely and am finally making some good progress, so I'm using this thread for any general LabVIEW questions I get as I'm learning the language itself
Also: I'm using a Logitech F310 controller My first question: see this pic I understand the part on the left, however the circled part on the right is still confusing to me. I understand that the axis 1 (x) and axis 2 (y) relate to the left (i think) analog stick on my controller, and I also realize that in order to control the other (right side?) analog stick on my controller I need to make an axis 3 (x) and axis 4 (y) because the computer counts my entire controller as one big joystick. HOWEVER, I *don't* understand why the axis wire from Joystick 1 branches off to a 2nd vi -- "Cluster to Array" and what goes on in that part of the branch. Why doesn't it JUST use the axes of the joystick? What cluster is it referring to? The red circled part is un-edited from the starting code in Teleop.vi in a new cRIO Robot Project Question 2: Here is my current understanding of each file in a "cRIO Robot Project" Project file/folder that I made while taking notes. If I'm missing something important (or have a "?"), any extra insight would be really helpful Code:
Team Code file Begin.vi -Initializes everything to be used later in the project -Where motors and joysticks are "opened" i.e. initialized -First .vi file in the project that runs Autonomous Independent.vi -Defines what happens in the pre-game, while the robot is running a pre-dertimined list of duties Teleop.vi -Defines what happens in the main and post-game, while the robot is being controlled from the Driver station Test.vi -? Disabled.vi -? Vision Processing.vi -? -Assuming this is where I put stuff for the auto tracking system and the camera feed. Anything else? Periodic Tasks.vi -? Robot Global Data.vi -? -Assuming this is where I define global variables? What separates global data here compared to joysticks and motors I open/initialize in the Begin.vi file and use throughout the project? (that seems pretty "global" to me) Finish.vi -un-initialize everything, basically the same (but opposite) as Begin.vi -Where you close motors and joysticks, therefore rendering them disabled -The last .vi file in the project that runs Robot Main.vi (NOT part of team code folderr) -Where you deploy the LabVIEW project as a whole to the cRIO from -? Any other use ? Last edited by ctccromer : 10-01-2013 at 18:49. |
|
#2
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
While waiting for the picture to get posted...
See if any of this training stuff helps:
- It's run from a special mode, You can use this to test new vi's for sensors or manipulators while avoiding running autonomous or Teleop. This won't get run during a competition match, so you can leave partially tested code in here. Disabled.vi - stuff you want to have happen only while the robot is sitting disabled. Periodic Tasks.vi - stuff that runs in the background, like a compressor. Robot Global Data.vi - This is only one of the ways to pass information around in a LabVIEW program. There are other more common methods that you are already using, like the wires into a vi and the reference names we use for devices opened in Begin. A typical example might be when code running in Periodic Tasks needs to pass information to Teleop to make some decision. Robot Main.vi -Stitches everything together. We only use it for running in debug mode. The Run arrow doesn't deploy your program permanently to the robot, only temporarily. That lets you muck around with things, without risking the permanent program on the robot. Last edited by Mark McLeod : 10-01-2013 at 20:05. |
|
#3
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I am not 100% sure as to why the axes information is being put into another array, but it looks like unnecessary code to me. I haven't opened up LabVIEW 2013 yet - is this code part of the default project, or did you add it in from a tutorial online?
In regards to the different VI's, the guy above me did a good job. Perhaps a little clarification on Periodic Tasks. There are obviously a lot of functions going on in both autonomous and teleoperated mods, in relation to your robot. For example, you may be shooting frisbees in both modes or using some sensor. Rather than having duplicates of these particular functions in both the teleop and autonomous VI's, it is simpler to have them all in one place. That place is the Periodic Tasks VI, and it's nice because it runs in BOTH autonomous and teleop. Once again, I haven't looked at the vision processing VI, but typically it just holds the code for getting the video input from the camera and sending it to the driver's station. You can add in vision tracking code here - usually we are given this (basically all the work is done for you) in a separate VI, but I'm not sure where it is. Some teams choose to do their vision tracking on a separate onboard computer, or send the video data to the driver's station and do the vision processing there. Hope this helps somewhat. |
|
#4
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
What is it even putting INTO an array? The axis values? If so, I'll just delete and ignore that part of the provided example code Quote:
Thanks to both of you guys for the help. Right now I'm just trying to work my way through all of the example code provided by making a new cRIO project. As I slowly come to understand it all, I'm modifying it to fit my situation this year, like changing it from 2 joysticks each with 2 axes, to 1 joystick with 4 axes Which brings me to my Third question: When working with the axes of a joystick, how do I change the 3rd and 4th axes to "Axis 3 (x)" and "Axis 4 (y)" instead of the default "Axis 3 (Throttle)" and "Axis 4"? The reason I need to do this is because I'm using the controller linked in the OP, which LabVIEW picks up as ONE joystick, but it has 2 analog sticks, so the left will be Axes 1 and 2, and the right will be Axes 3 and 4. Question 4: So I know a cRIO Robot Project is the code you make, deploy to the cRIO, then run on a computer that's in communication with the cRIO. But what would I need to use a Dashboard Project for? Would that just be for if I wanted to add another feature to the dashboard/driver station windows? |
|
#5
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
Quote:
Quote:
Quote:
|
|
#6
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I added the vision processing walkthrough to my favorites already and will look at that as soon as I get our camera up and running (have another thread about that)
And I was not aware about the axis thing. When I tested the buttons (booleans) today, the following parts of the controller did not register: The left and right analog sticks obviously, the left and right triggers, and the d-pad. Does it consider the left and right triggers as 1 axis each then? And what does it consider the 8-way D-pad? My teacher and I were discussing it today and were kind of surprised it didnt show up as any of the 12 buttons. It seems like it would be a button/boolean value rather than a full axis |
|
#7
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
The triggers on game controllers are axis.
You can depress them halfway for half power. |
|
#8
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
Both directional pads and analog triggers usually show up in strange ways.
Analog triggers are typically mapped to a single axis for both. The axis will read 1 for 1 trigger fully depressed, -1 for the other and 0 for both. Partial depression of a single trigger will read a value between 0 and the extreme (1 or -1). Partial depression of both triggers will read something, or 0 (I recommend not having a control scheme that does this). D-pads show up in different ways depending on the controller, but also typically map to an axis. This thread has a mapping for the F310 in it: http://www.chiefdelphi.com/forums/sh...ighlight=d-pad |
|
#9
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
Most of the questions seem to have been answered, but as to the incomplete description of the various functions, the diagram of Robot Main contains a large string constant with just such a description.
If you really decide you need to change the name of a cluster element, you cast it to a different cluster. The Cast function looks like forcing a square peg through a round hole. As noted, this is largely a cosmetic thing. Names of elements serve as documentation and little else. Greg McKaskle |
|
#10
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Thank you to RufflesRidge for filling in my gaps. In regards to figuring out the mapping for any kind of controller, the simplest way I have found is to create indicators off of the clusters for the axes/buttons. Then run the program on a cRIO with the driver's station plugged in and the controller plugged into the driver's station. Start pressing analogue sticks and buttons, watching as the values change on your indicators. A quick way to document your joystick controls!
|
|
#11
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I'm trying to set up a program so that I can use one axis to simply turn a CIM motor. I did Open/Close the motor and Set the RefNumRegistry in Begin and Finish, and the attached picture is from Teleop.vi. I can't figure out how to attach the two parts together though
|
|
#12
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
Try changing your motor Get Output VI to a Set Output VI. That should help with figuring out where to wire in the axis.
|
|
#13
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
The input terminal on the Motor Set Output function that receives the motor speed value is called Output. That can be confusing if you're not thinking in the same way the writers of the function were.
|
|
#14
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I managed to get our drive system and D-Link wireless router set up! Now I'm moving on to our shooter system, which consists of two wheels (attached to two CIM Motors) and an arm to push the frisbees into the two wheels (we're THINKING a window motor, but not 100% sure yet)
The drive system was pretty easy since it was mostly done for me in the base code, but the shooter I have to do from scratch so I'm a little confused. I attached screenshots of my current begin.vi and teleop.vi. (not finish because that's straight-forward) How exactly do I attach two CIM motors to the values put out by axis 3? |
|
#15
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
One thing I notice is that you don't necessarily need to enable the safety for spinner motors. If you believe that your code needs to update the motors in order to be safe and in control, then leave the safety on and consider the rate at which you believe you need to update them. Otherwise turn the safety off.
I think the next thing for you to do is to retrieve the motors of the shooter by name, and connect the axis value to the value of both motor refnums. Greg Mckaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|