Go to Post If we can transform our culture to the point where girls swoon over guys as they pull their dremel off their belt and carve some speed holes in a smooth fluid motion, I think FIRST is half way to its goal. When we get the guys to swoon over the girls for their hot moves on the 5-axis, we have won. - EricVanWyk [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 15-02-2011, 08:24
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Code check ASAP

Hi CD, i wrote some code for teleop but i dont have te hardware to test the code because the electrical team is putitng it together and i dont think i will get much time to test after its put together becasue we have PD day friday and thursday its parents nights so we only have till thursday and the electrical team isnt done. Can someone just see if this code will do this:

When button for home is tapped ones, the motor will spin in the negative direction until the home switch comes on and then stops. Same goes for all the other buttons. But what i am wondering is, will it do it if i tap it ones, or will i have to hold it? tnx
Attached Files
File Type: doc teleop.doc (85.0 KB, 35 views)
__________________
"A team back in training !"
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2011, 10:09
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 545
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: Code check ASAP

With that you would have to hold it.

During every iteration of teleop, your code would set the motor to .4, then if the button was pressed, complete the true case. If the button is not pressed during any one iteration of teleop, the false case will be executed.
__________________
Team 2052- KnightKrawler
Mentor and volunteer
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2011, 15:46
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: Code check ASAP

Quote:
Originally Posted by Tanis View Post
With that you would have to hold it.
What do i have to change to make it work only by pressing it once? I do remember there was a extra library you had to download it was a little green thing, i remember in one of the Ben Zimmer's video, but i cant find it. Argh.
__________________
"A team back in training !"

Last edited by whcirobotics : 15-02-2011 at 17:23.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2011, 20:19
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 545
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: Code check ASAP

I don't use LabView myself, so I am not sure on what the best way to do it is, but here is how I would do it in a text-based language:

Create a boolean called "homeHasBeenPressed" that is initially false.
When the home button has been pressed, set that boolean to true.

if (homeHasBeenPressed)
doStuff();


I've always had a bit of a distaste for LabView's lack of variables, but you should be able to take the above and apply it to LV without too much trouble.
__________________
Team 2052- KnightKrawler
Mentor and volunteer
Reply With Quote
  #5   Spotlight this post!  
Unread 15-02-2011, 22:07
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Code check ASAP

Here's an example of an action only once per button press

Here's an example of A toggle button

The feedback node used for these can be found on the Programming -> Structures palette.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #6   Spotlight this post!  
Unread 16-02-2011, 20:55
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: Code check ASAP

@Mark

Does it matter if i use more than one node in teleop vi? like one node for each button on a joystick?
__________________
"A team back in training !"
Reply With Quote
  #7   Spotlight this post!  
Unread 16-02-2011, 21:27
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,752
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: Code check ASAP

It doesn't change the functionality. It is more a style issue and a diagram space tradeoff.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 18-02-2011, 12:35
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: Code check ASAP

I have another question, with the http://team358.org/files/programming...uttonPress.jpg
code, if i attach that to 3 buttons, button 1 , 2 and 3, if i want to go to position 3 but i accidentaly press 2 and then i suddenly press 3, will that override the code of me pressing the "2"? So basically will it do something different depending on the button press, even if i change it half way?

Whcirobotics
__________________
"A team back in training !"
Reply With Quote
  #9   Spotlight this post!  
Unread 18-02-2011, 12:58
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Code check ASAP

If I understand correctly, the last button pushed would win, immediately.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #10   Spotlight this post!  
Unread 18-02-2011, 13:03
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: Code check ASAP

The "once per button press" doesn't care what other buttons were pressed in the past unless you explicitly write the program to do so. The Button 3 code can do anything you want it to do, including changing things that the Button 2 code did.

Reminder: don't put any long-running loops inside those "run once" cases. That would stall the Teleop vi and the motor safeties for things like your drivetrain will trigger, shutting down the robot outputs until the loop completes. If you use the buttons to start a sequence of events, either that sequence will have to be written as a state machine in Teleop, or you will have to implement it in the Periodic Task vi.
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 20:32.

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