Honey, will you tether your soul to mine?
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
  #31   Spotlight this post!  
Unread 22-01-2013, 21:12
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by ctccromer View Post
...only one of the two Case Structures will work!
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.
Reply With Quote
  #32   Spotlight this post!  
Unread 23-01-2013, 14:43
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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)?
Reply With Quote
  #33   Spotlight this post!  
Unread 23-01-2013, 14:57
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #34   Spotlight this post!  
Unread 26-01-2013, 10:37
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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.
Reply With Quote
  #35   Spotlight this post!  
Unread 26-01-2013, 12:29
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #36   Spotlight this post!  
Unread 26-01-2013, 12:37
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by Greg McKaskle View Post
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
We don't really need any image output on the drive station. We JUST want the tracking algorithm. So do we still need RoboRealms if we dont want the output on the driver station?

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?
Reply With Quote
  #37   Spotlight this post!  
Unread 26-01-2013, 12:48
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #38   Spotlight this post!  
Unread 27-01-2013, 10:43
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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
Reply With Quote
  #39   Spotlight this post!  
Unread 27-01-2013, 11:43
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	29
Size:	202.5 KB
ID:	13682  
Reply With Quote
  #40   Spotlight this post!  
Unread 27-01-2013, 13:28
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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.
Reply With Quote
  #41   Spotlight this post!  
Unread 27-01-2013, 15:08
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #42   Spotlight this post!  
Unread 28-01-2013, 09:19
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	16
Size:	113.4 KB
ID:	13696  
Reply With Quote
  #43   Spotlight this post!  
Unread 28-01-2013, 11:30
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by ctccromer View Post
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?
The Robot Global Data vi only has a front panel. There is no associated block diagram. Global variables are just controls on the vi's front panel. When you want to create a new global variable, just place a control of the appropriate type there. "Mechanism Op." is a global variable that Greg created for the example. "Stop" and "Go" are values of an enumerated data type that he created to make it easier to read the intent of the values. You can just use a boolean with values of True and False if you don't want to dive into enumerated types yet.

http://www.fightingpi.org/Resources/...20Tutorial.pdf has some tutorial information about using global variables at the end of the document.
Reply With Quote
  #44   Spotlight this post!  
Unread 28-01-2013, 12:28
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
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?
Reply With Quote
  #45   Spotlight this post!  
Unread 28-01-2013, 13:49
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by ctccromer View Post
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.
Edit the properties of the enum and give it named values of "Stop" and "Go".

Quote:
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?
The code Greg suggested goes in Periodic Tasks. Any time you want to trigger it, set the global variable to True (or 1, or Go, whatever you end up using). You can do that from any vi in the project.
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 04:16.

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