Go to Post A solution will present itself, all you have to do is be ready to take advantage of it when it does. - James1902 [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 02-02-2009, 17:59
greatman05 greatman05 is offline
Registered User
AKA: Chavez Clemons Jr.
FRC #2224 (Phoenix Phenoms)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Detroit, MI
Posts: 32
greatman05 is an unknown quantity at this point
Send a message via AIM to greatman05 Send a message via MSN to greatman05 Send a message via Yahoo to greatman05
Button Programming: Is this right?

Hello. I'm learning LabVIEW, and I need to make a "simple" 3-button programming for controlling 2 motors attached to a lever. I have an image of what I've come up so far, and I would appreciate any feedback that I get. Also, I have a few questions:

1.) How do I set a specific PWM value for the motors I'm trying to control? Do I use the Motors_SetSpeed key or the Motor_Open key for controlling this?

2.) How do I tell a motor to stop?

Again, any and all input is appreciated.
Attached Thumbnails
Click image for larger version

Name:	Basic Program2.jpg
Views:	253
Size:	134.3 KB
ID:	7295  
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2009, 19:23
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: Button Programming: Is this right?

It seems you're opening multiple references for each set or get. All you need to do is open one reference for each physical device and wire it to as many get/set vi's as you want. Also, you're opening the motors within the while loop, which will slow the loop a lot. Move the Open Motor vi's to the left of the while loop and wire them to the get/set vi's in the while loop.

Motors take -1 to 1 for values, with 0 being don't move. I think if you fix the multiple references and opening motors in the loop, it will work.
__________________
Twitter Profile
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2009, 01:35
Acshi Acshi is offline
Registered User
FRC #2924
 
Join Date: Jan 2009
Location: WA
Posts: 12
Acshi is an unknown quantity at this point
Re: Button Programming: Is this right?

Ewww.... Thats just nasty...

Assuming you started with the Advanced Framework, you can just draw from the main RobotData cluster for your joystick and motor references, then use those whenever you need them -- I don't really know anything about the Basic one, only that it is much less organized and would be harder to do complicated things to.

I have included my team's teleop.vi, which has the robotData cluster heavily modified to suit our needs and delivers out control to other SubVis.

Note the cleanness, but LabView takes a lot of getting used to how control and data flow, as does programming in general. However you really must notice how much of your code was repeat, that is never good.
Attached Thumbnails
Click image for larger version

Name:	Teleop.png
Views:	185
Size:	24.5 KB
ID:	7309  
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2009, 15:47
Jranko311 Jranko311 is offline
Mentor-Programmer-Design Engineer
AKA: Jon Hrenko
FRC #0155 (Technonuts)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2002
Location: Berlin, CT
Posts: 12
Jranko311 is an unknown quantity at this point
Re: Button Programming: Is this right?

Could you be a little more specific as to what you are trying to do?
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2009, 16:37
greatman05 greatman05 is offline
Registered User
AKA: Chavez Clemons Jr.
FRC #2224 (Phoenix Phenoms)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Detroit, MI
Posts: 32
greatman05 is an unknown quantity at this point
Send a message via AIM to greatman05 Send a message via MSN to greatman05 Send a message via Yahoo to greatman05
Re: Button Programming: Is this right?

Basically, I want to have the first button tell the motor to go forward, the 2nd button to tell it to go in reverse, and the third button to tell the motor to stop...But now, I want to make the first and second buttons triggers so that only when you hold them down does the motor follow the command...otherwise, it doesn't move...
Reply With Quote
  #6   Spotlight this post!  
Unread 05-02-2009, 16:40
Jranko311 Jranko311 is offline
Mentor-Programmer-Design Engineer
AKA: Jon Hrenko
FRC #0155 (Technonuts)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2002
Location: Berlin, CT
Posts: 12
Jranko311 is an unknown quantity at this point
Re: Button Programming: Is this right?

The attached picture is the basic idea of what we did to run a motor using two switches, with one switch signals Forward, the other signals reverse. All you then need to do is set the different speeds for the different cases. Use the joystick buttons instead of the boolean button. Then Wire the Pink wires from the Open_motor.vi to the Set_Speed.vi.

Let me know if it was helpful.

We are using are using a three way toggle switch with the driver station user I/O, and a similar program to do about the same thing, (run a motor Forward, Reverse and Neutral). We have been successful.
Attached Thumbnails
Click image for larger version

Name:	Two_switch_program.jpg
Views:	153
Size:	37.2 KB
ID:	7327  
Reply With Quote
  #7   Spotlight this post!  
Unread 07-02-2009, 13:57
domoarigato's Avatar
domoarigato domoarigato is offline
Team #1208 CCO
AKA: Coony
FRC #1208 (Metool Brigade)
Team Role: Engineer
 
Join Date: Nov 2008
Rookie Year: 2008
Location: O'Fallon, Il
Posts: 32
domoarigato is an unknown quantity at this point
Re: Button Programming: Is this right?

Haha your code is a little messy... but basically, to clean that up, you should call all your "Motor: Open Jaguar" and such outside of the big case structure thing. (Ie. to the far left near the Joystick Opens). You can also close the motors easier outside of that case structure to help clean it up. (Also should get rid of those white/pink blocks that mean that the motors aren't being called in ever case of the structure.)

Attached is our main code... which isn't all that clean either but it works well enough. Basically what we have that is similar to your situation is when it's calling a motor outside the main case thing (the one with PWM 4) whichis then wired to a "Motor: Set Speed" inside a case structure that is wired to a button. In the true case (when the button is pressed) of the case structure, it will go full power (255) and the opposite in the false case (0). The motor is then closed outside that bigger case structure.

If that doesn't help, let me know.
Attached Thumbnails
Click image for larger version

Name:	buttons ex.jpg
Views:	112
Size:	111.7 KB
ID:	7351  
Reply With Quote
  #8   Spotlight this post!  
Unread 10-02-2009, 19:15
greatman05 greatman05 is offline
Registered User
AKA: Chavez Clemons Jr.
FRC #2224 (Phoenix Phenoms)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Detroit, MI
Posts: 32
greatman05 is an unknown quantity at this point
Send a message via AIM to greatman05 Send a message via MSN to greatman05 Send a message via Yahoo to greatman05
Re: Button Programming: Is this right?

OK, so looking at your suggestions and with some outside help, I decided to try this. (Pics at the bottom) However, I don't understand why only Butoon 2 activates and stay's activated until the robot is shut off. All of your help and suggestions would be greatly appreciated...Thanks!
Attached Thumbnails
Click image for larger version

Name:	Case Structure.JPG
Views:	76
Size:	98.9 KB
ID:	7385  Click image for larger version

Name:	Case Structure 2.JPG
Views:	46
Size:	95.0 KB
ID:	7386  Click image for larger version

Name:	Case Structure 3.JPG
Views:	44
Size:	99.5 KB
ID:	7387  
Reply With Quote
  #9   Spotlight this post!  
Unread 10-02-2009, 22: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,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: Button Programming: Is this right?

The first image shows that when both buttons are false, the motors are set to 0. If you delete the motor effects there, releasing a button will not change a motor -- assuming that is what you want.
Reply With Quote
  #10   Spotlight this post!  
Unread 11-02-2009, 18:03
greatman05 greatman05 is offline
Registered User
AKA: Chavez Clemons Jr.
FRC #2224 (Phoenix Phenoms)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Detroit, MI
Posts: 32
greatman05 is an unknown quantity at this point
Send a message via AIM to greatman05 Send a message via MSN to greatman05 Send a message via Yahoo to greatman05
Re: Button Programming: Is this right?

Well, I would like to create a switch so that the motors DO deactivate when the buttons for the specific direction are released, and I tried using the case structure shown, but like I said before, Only button 2 activates the motors and keeps them activated until the robot is shut off, which is NOT the behavior that I want...
Reply With Quote
  #11   Spotlight this post!  
Unread 11-02-2009, 18:17
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: Button Programming: Is this right?

I'm still not sure I understand what you want, but the reason buttons 1 and 2 behave differently is because you are wiring different motor refs to them. In the three images you attached, two of them take the motor refs wired into the top of the struct, one of them takes the motor refs wired into the left. I can't see the rest of the diagram, but I suspect those are different motors.

Make all three of them affect the same pair of motors.

Greg McKaskle
Reply With Quote
  #12   Spotlight this post!  
Unread 12-02-2009, 02:01
warpling warpling is offline
Registered User
AKA: Ryan McLeod
FRC #2984 (La Jolla High Vikings)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: San Diego
Posts: 5
warpling is an unknown quantity at this point
Send a message via AIM to warpling
Re: Button Programming: Is this right?

Quote:
I have included my team's teleop.vi, which has the robotData cluster heavily modified to suit our needs and delivers out control to other SubVis.
What is that Acc. Arcade, and the Acceleration Cap devref?
Reply With Quote
  #13   Spotlight this post!  
Unread 13-02-2009, 16:02
greatman05 greatman05 is offline
Registered User
AKA: Chavez Clemons Jr.
FRC #2224 (Phoenix Phenoms)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Detroit, MI
Posts: 32
greatman05 is an unknown quantity at this point
Send a message via AIM to greatman05 Send a message via MSN to greatman05 Send a message via Yahoo to greatman05
Re: Button Programming: Is this right?

Thanks to everyone for their help! We fixed the trigger and now our arm works like it should. However, I still can't get the motors to go in reverse...Am I supposed to do that from the default drive programming they gave us?
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
Programming a joystick button... programmr Programming 2 05-01-2009 16:13
button programming joesmomh00haha Programming 12 10-02-2007 10:36
Joystick Button programming Bharat Nain Programming 5 18-02-2005 11:48
IS THIS RIGHT?!?!? RebAl General Forum 22 31-03-2002 00:07
Arm Rotation (1 Button Programming!!) Joelster Technical Discussion 1 14-02-2002 13:15


All times are GMT -5. The time now is 04:26.

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