Go to Post (Just remember to pack extra warm--when they say the state motto is Live, Freeze, or Die, they're not joking.) - Billfred [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 11-04-2009, 05:55
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Momentary On/Off

Well, for the flywheel we are adding, I need to add some code to the robot. I have a window motor that will be running off of a victor. The WM will be attached to the gimbal which the flywheel is attached. So, I want the WM to turn on for a certain speed and for a preset time when a button is pressed in. When the button is unpressed, I want the WM to return to the home position, doing so by running the speed in a negative direction, for the same amount of time.

1. Press button, motor runs at speed V for T time and shuts off when T expires, even when button remains pressed.

2.When button is unpressed, returning from being pressed, motor runs at -V for T time and shuts off when T expires. This returns the motor to home position.

Unfortunately, I have not had much time to put towards learning programming in LabView, and I'm pretty much clueless on how to use it. Don't ask me how I have working code on our robot right now, because I have no idea, haha.

Thanks!

-Sean, 3020
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
Reply With Quote
  #2   Spotlight this post!  
Unread 11-04-2009, 17:18
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,748
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: Momentary On/Off

From what I understand, you want a button press to trigger an action of turning on the motor for x seconds. It will stay there until the button is released, then a new action will run to negate the other movement. The reason I review is that a short click and release will then go through both actions with nothing in between? No canceling the first movement? You also need to decide what happens when the driver clicks and releases multiple times rapidly -- one movement or N movements, one for each click.

If my understanding is reasonably close to what you want, look up LabVIEW examples for state machines. I'll name the motor positions home and engaged. You state machine has states of Home, Engaging, Engaged, Disengaging.

From home, a button press moves to Engaging. Time moves from Engaging to Engaging. A button release or pending one moved from Engaged to Disengaging. Time moves from DisEngaging to Home.

I'd set up a periodic task that runs the motor for time and contains the state variable. You can read the joystick button state in that loop at a given rate, or you can leave it in your teleop code and update a local or global that indicates the position of the button, up or down.

Hopefully this helps you think about how to approach the problem. I'll leave the rest to you.
Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 11-04-2009, 20:51
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Re: Momentary On/Off

Honestly, I kind of understand how you described it, but I have no idea how to di it in LabView. Seriously, I really don't understand it, and don't have the time to learn it right now. Any links maybe?
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
Reply With Quote
  #4   Spotlight this post!  
Unread 12-04-2009, 12:52
Burmeister #279's Avatar
Burmeister #279 Burmeister #279 is offline
What Time Is It?
AKA: Nick Burmeister
FRC #0279 (TechFusion)
Team Role: Programmer
 
Join Date: Nov 2008
Rookie Year: 2007
Location: Toledo
Posts: 207
Burmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of light
Send a message via AIM to Burmeister #279
Re: Momentary On/Off

can you better describe the process of buttons pressed and movements for us?

what i'm getting is this:
your T time variable = 10 seconds
button A is held for T+5 seconds
Motor B is moved forward for T seconds and then stops [even though button A is still pressed]
button A is released
Motor B is moved reverse for T seconds

does this sound right?
if Button A is released after less than T seconds, what happens?
does the motor continue for the rest of the T time and then automatically reverse or does the motor reverse immediately when the button is released?
__________________
WHAT TIME IS IT? TWO SEVEN NINE!!! [Team B =) ] Awards: 4 Safety, 2 Ind. Design, 2 Xerox, 1 Nat. Champs
2009 Buckeye Semi-Finalists (1014 & 695) || 2008 GLR Safety Award || 2006 GLR Safety Award
2005 Buckeye Regional Champs (67 & 274) & GM Industrial Design Award & Safety Award GLR Quarter Finalist & Xerox Creativity Award & Safety Award National Xerox Creativity Award & Curie Quarter Finalist (1126 & 180)
2004 Buckeye Delphi Driving Tomorrows Technology Award & Quarter Finalist GLR Champs Nationals Curie Division Finalist
2003 GLR GM Industrial Design Award || 2001 National Newton Division Winner & National Champions
2000 MI DaimlerChrysler Team Spirit Award
Reply With Quote
  #5   Spotlight this post!  
Unread 12-04-2009, 16:47
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Re: Momentary On/Off

Preferably I'd want it to reverse and reset to it's home position if the button is released too soon. However, the motor will only run for about .5 seconds, so it shouldn't be too difficult to keep it pressed for at least 5 seconds. But as far as you described it, that's correct.
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
Reply With Quote
  #6   Spotlight this post!  
Unread 13-04-2009, 03:50
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Re: Momentary On/Off

Ok, I wrote a bunch of code in the past several hours.

I scrapped the original idea, and rather went with something slightly different.

1. Button is TAPPED
2. Motor Turns on for X seconds, for V speed
3. Motor reverses, at V/4 for 4X seconds
4. Motor is back at home position

To do this I used 2 case structures in my TeleOp Code. I used a joystick get button for, well, getting the button, and wired each joysticks button 1(trigger) to the case. When button is pressed, it is True, in turn running the code in that case. The code, how I have it written in the case, will take about 1.25 seconds to complete what I want it to do. However, I am concerned that the trigger, button 1, will have to be held for 1.25 seconds for the code to complete, insteads of just having to tap it to run the entire code. I haven't done anything like this, and obviously I can't test it on the robot. So, will the code finish if I only tap the trigger which activates it?

BTW, I am using Watchdog DELAY&FEED to do the timing. That is alright to do, right? I just finally understood autonomous coding today, so I applied the watchdog timing concept to this.
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
Reply With Quote
  #7   Spotlight this post!  
Unread 13-04-2009, 07:44
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,748
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: Momentary On/Off

You don't want to delay your teleop.

Move your code from the teleop loop into a parallel loop, like the one for periodic tasks. That way your teleop can return and be called again with more joystick info. I'd just move the joystick stuff to the parallel loop too. If it is in a parallel loop, you can use delay or delay and feed no problem.

Greg McKaskle
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Woot-off Greg Needel Chit-Chat 7 05-10-2007 14:25
Woot-Off JohnBoucher Chit-Chat 46 23-03-2007 22:15
437 Showing Off it's Off Season NextPerception Robot Showcase 7 06-02-2007 19:03
Momentary Switch Programming silv940 Programming 3 24-05-2006 02:19
hanging off off other robots that are hanging off the horiz bar Andrew Dahl Rules/Strategy 15 12-01-2004 19:14


All times are GMT -5. The time now is 03:59.

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