Go to Post The point is that while having the abiltity to find information in a variety of reference sources is a useful skill, it does not replace a good, complete, fundamental knowledge of your subject material. - dlavery [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 13-02-2010, 11:24
tommy0019's Avatar
tommy0019 tommy0019 is offline
Registered User
FRC #2957
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Minnesota
Posts: 23
tommy0019 is an unknown quantity at this point
Button help

This is my first year programing and our team needs help programing buttons. We are looking to be able to run a CIM motor using imput from the joysticks but have run into some problems.

How can we get it so that the motor spins 360 degrees when the button is pushed and resets after the button is pushed. We don't want to hold down the button to have the motor go but have the motor go with one push of the button. Is is possible for us to get any examples of this?

Also how do we set up initializing the motor and joystick with the begin vi? There is some confusion among our team about how the main code flows and initializes and finishes things since the main project is different visually from last year. Do we have to set up each joystick in the Begin vi and add the motor there? Do we have to put our teleop code inside the case structure or can we leave it in the execute loop outside the case structure?

Thanks.

Last edited by tommy0019 : 13-02-2010 at 11:48.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2010, 13:07
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: Button help

The green comment to the left of the Robot Main loop gives some guidance, and so do the comments on the subVIs.

To follow the flow that was intended, place the code inside of the Teleop SubVI. This will help to keep the code more structured and will help to ensure that the initialization, execution, and finalization happen correctly.

So to repeat the comment, Begin is the appropriate place to put joystick and motor Opens and store them with a name.

Teleop can then read the refnums by name and use them to drive the robot.

Finish can Close them.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2010, 13:35
tommy0019's Avatar
tommy0019 tommy0019 is offline
Registered User
FRC #2957
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Minnesota
Posts: 23
tommy0019 is an unknown quantity at this point
Re: Button help

Okay then do we use the joystick refnum in teleop to get them initialized instead of the joystick open since that was already done in the begin.vi?
Reply With Quote
  #4   Spotlight this post!  
Unread 13-02-2010, 13: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,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: Button help

Yes. Open once, and store with a name in Begin. Get with the name everywhere you need the value.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 13-02-2010, 13:53
tommy0019's Avatar
tommy0019 tommy0019 is offline
Registered User
FRC #2957
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Minnesota
Posts: 23
tommy0019 is an unknown quantity at this point
Re: Button help

Okay in the begin.vi do we then wire the joystick and motor up to the build array function?
Reply With Quote
  #6   Spotlight this post!  
Unread 13-02-2010, 13:55
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: Button help

The errors are collected in a array. This makes it easy to see if anything is failing during initialization. You can do this if you like, but it isn't required. The errors will be reported to the Diagnostics page instead if they aren't wired.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 13-02-2010, 15:28
tommy0019's Avatar
tommy0019 tommy0019 is offline
Registered User
FRC #2957
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Minnesota
Posts: 23
tommy0019 is an unknown quantity at this point
Re: Button help

Okay we have the basic idea set up for pressing the button done and everything checks out, but when we deploy it to the robot nothing goes. Do we have to designate something else or what's not going on?

Here's an attachment of the teleop with buttons anything out of place that stopping the motor from running?
Attached Thumbnails
Click image for larger version

Name:	teleopbutton.JPG
Views:	31
Size:	139.6 KB
ID:	8648  
Reply With Quote
  #8   Spotlight this post!  
Unread 13-02-2010, 17:11
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: Button help

The Motor Open needs to be moved to Begin.vi and done the same way that all the other devices are opened.

What's happening is you are opening the motor 50 times a second and never closing any of them.
LabVIEW is very confused about which of the several thousand motors you have opened you're talking about...
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 13-02-2010 at 17:13.
Reply With Quote
  #9   Spotlight this post!  
Unread 13-02-2010, 17:44
tommy0019's Avatar
tommy0019 tommy0019 is offline
Registered User
FRC #2957
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Minnesota
Posts: 23
tommy0019 is an unknown quantity at this point
Re: Button help

Thanks for helping everyone, the motor's running great now!
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
Button programming help interplanetary Java 3 17-02-2010 13:01
Help Reading Joystick button Values PlaidPillagers NI LabVIEW 1 11-02-2010 11:27
Button Help brainsdmaner NI LabVIEW 3 11-02-2009 18:06
Joystick Button Motor!!! HELP!!! furiousgeorge Programming 3 07-02-2009 22:57
Joystick Button Programming in Labview Help Needed domoarigato NI LabVIEW 11 28-01-2009 10:55


All times are GMT -5. The time now is 22:01.

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