|
|
|
| My crate or yours? |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#31
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
They're both working fine. The problem is that one of them does something first, and then the other one immediately does something else, so what the first one did never has a chance to make itself seen.
What you're trying to do is easy, just not with parallel Case structures like that. Greg's code is simple, quick to implement, and hopefully easy for you to understand. |
|
#32
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
yeah, using select vi's instead of case structures worked perfectly, and is easier to understand ^^ And somewhat ironically, as soon as I checked that the Select vi's worked here, I went and programmed an addition to our drive system using a case structure, which worked fine. (I set it so that when a button is held down, to multiply the axis output values by 0.25 so we dont have to jerk the controls when aiming for a shot)
Thank yall so much for all the help. It really has been a huge help not just to me but our whole team. We now have a (theoretically) finished drive system and shooter. Now I'm about to start looking into pneumatics and what not for our climber, and camera, sonar, etc stuff for a tracking system I do have one question, though not about that: I know that when I DEPLOY the LabVIEW code to the robot, I can use the Front Panel to read indicators and what not. However, when I BUILD the LabVIEW code onto the robot, is there any way to read the axis/button outputs (whether by using the front panels or sending something to the driver station program)? |
|
#33
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
The dashboard shows a few values from the robot by default. It shows two joysticks with 12 buttons and 3 axes. Below are four graphs with the four motor outputs.
If you want to display more, make a dashboard project from the template, add the indicator to the Operation tab, name it the same as the SmartDashboard variable. Then on the robot, in appropriate location, write the value to the SmartDashboard variable of the same name. Greg McKaskle |
|
#34
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Okay so we finally got our Axis M1011 camera in and today I'm trying to do as much work as I can for it. I set it up with the Axis Camera Setup Tool and read the three whitepapers I found (1, 2, and 3) so now I have a pretty good understanding of how it works. I DON'T know why I need to use RoboRealms (though I've heard that I do), and I don't know how to get started coding our tracking system into the LabVIEW project.
Is there one specific thing I could start with and build up from? For example, when I was just starting to work on coding the teleop and was completely lost, I started with the drive system (since that's simple) and worked my way up. EDIT: also, is there a way to control how far a window motor turns? I currently have our window motor set for when x is true, it goes forward, and when y is true, it goes backwards, but i'd love to say "when x is pressed, go forwards __ degrees, then go back the same amount" Last edited by ctccromer : 26-01-2013 at 11:02. |
|
#35
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
To your first question, you have a number of ways to process images. One of those involves running RoboRealms on your dashboard or driver station computer and sending data to the robot. Others involve running LV code in your dashboard or running LV code on your cRIO.
To the second question, the window motors do not have a feedback mechanism. If you add a potentiometer or an encoder, possibly a limit switch in some cases, you can know how much they have turned. But the motors can't do that automatically, you have to build it. Greg McKaskle |
|
#36
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
For the window motor, would my best bet be to say "go forward at x speed for y seconds then go backwards at same speed for same seconds." and then just play around with it to get it the right speed/time? |
|
#37
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
My comment was about image processing for targeting. There are different ways of doing this with different tools. Look through the white paper links, though I'd suggest doing 3, then 2, then 1. Experiment a bit if you like, and decide on a tool you'd like to start with. You can always try another if you still have time.
Greg McKaskle |
|
#38
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I'm trying to figure out how to wire "-1 for 250 miliseconds, then 1 for 250 miliseconds, then 0/nothing" into a Set Motor Output vi's output node, but I'm not sure how. Which Vi(s) should I use? I've found Timed Sequence as well as all different kinds of Wait and what not
|
|
#39
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
You don't mention whether this is for autonomous, teleop, or more general. I'll give some options and try to explain the tradeoffs.
In autonomous, no other code is running, and there is no need to return to the scheduling code. This means that your code can be written the simplest. You can use a sequence and in frame 1, Set Motor to speed S1 and delay with D1 in parallel. Frame 2, Set to speed S2 and Delay with D2, etc. You can generalize this to use a loop and an array of S1, S2, S3, and D1, D2, D3 if you want to. In teleop, your code needs to return to the scheduler every 20ms or so. The delay block prevents this until the delay is over, meaning that your joysticks will be frozen for a few seconds. The way to code this in teleop code is not obvious, but a trick well worth putting in your tool chest. It is called a state machine. You code it by Setting the motor and noting when you started it. You update the state to Running A and let the function finish and return to the scheduler. Each time teleop is called, you check to see what state you are in. If in state A, you compare the current time to start time to see if 0.25 seconds have passed. If not, leave it alone. Once 0.25 seconds have passed, you change the motor speed and set the state to B and let it return. B does the same time compare and eventually goes to state C where it stops the motor. The third option is to put the code into Periodic Tasks and let auto and teleop communicate to it. When in Periodic Tasks, you can write it simply, like autonomous, but you put it in a mechanism loop so that it is started/stopped/canceled by a global or other communication mechanism. This is actually the approach I'd generally recommend, and I attached an image of the general code that would be pretty easy to duplicate and set to other mechanisms. The other case handles stop and delays for 20ms. Look through the code and see if you see any issues or have any questions. Greg McKaskle |
|
#40
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
That's very helpful, thanks! I'm trying to copy that into my periodic tasks but I don't recognize a few of those VI's. What is the array looking thing on the left? and the Start and Mechanism Op VI's? Also, I put it inside a While loop, but I don't see the slot at the top where "Go" is in your picture either
Thank you very much for the help ![]() EDIT: i compiled a video of our progress so far. Everything coded in the video has been done with your help here and I just want to thank you very much! Here's the video if you'd like to see Last edited by ctccromer : 27-01-2013 at 15:08. |
|
#41
|
|||
|
|||
|
Re: General LabVIEW questions from a VERY new user
The array looking thing is an array constant. In it I put a cluster constant and two numeric constants inside that. The array constant comes from the Array palette, Cluster from Cluster palette, etc.
The Mechanism Op is a global variable. You should probably open Robot Globals from the palette and add it there, but if you wish, you can make a new file to organize your globals into. The Global I added is an enum, largely because of readability, but a number or Boolean would also work, even a string. The slot at the top is the border of the Case structure. Reading the code from outside to inside, it is a While Loop, a Case Structure, then a For Loop, and a Sequence inside that. Do each of them make sense what they do and why they are being used? Greg McKaskle |
|
#42
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
I still can't find Stop or Mechanism Op. (tried going to global data.vi file but ctrl+e didnt bring up a block diagram and I couldn't figure out how to get it from the right click menus). What kind of vi is Stop?
Does it matter if my case structure says True/False instead of Go? Does it matter if my variables in the array don't have labels on them? Other than that, I think I've got it. Once I finish setting it up, I'll dive in and learn what each thing does. Attached what I have so far |
|
#43
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
http://www.fightingpi.org/Resources/...20Tutorial.pdf has some tutorial information about using global variables at the end of the document. |
|
#44
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
So by creating an enum on the Front Panel of Global Data.vi and renaming is Mechanism Op, I got it in my code. After wiring this up in the 3 places shown, the True/False changed to 1/0
Still not sure how to get the Stop thing. Once I finish this (and understand how it all fits together), is it just a function I can call in any other files in the project? How do I use it in teleop and autonomous? |
|
#45
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|