Go to Post I love science. :D - artdutra04 [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-2013, 01:21
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Unhappy Toggle Motor Using Button

This year with shooting something again I promised my team the ability to simply press a button on the joystick and a motor will run until pressed again (essentially a latch) as opposed to last year the motor being controlled by a joystick itself. I thought I had finally figured out the solution which I have a screenshot of below, but it doesn't seem to work right. When the button is pressed, the motor starts up for about a second, then shuts off. This repeats indefinitely until I press the button again to stop (or disable the robot). There are rare chances I can spam the button in certain ways and get it to run forever, but that is really inconsistent.


all 3 are of the same code but it is showing what is inside the case structures

Do you guys have a solution to this specific code, or a new code that works better for what I need?

Thanks
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2013, 08:21
Belovan Belovan is offline
Registered User
AKA: Alex Angelillo
FRC #0195 (Cyber Knights)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: United States
Posts: 6
Belovan is an unknown quantity at this point
Re: Toggle Motor Using Button

You could use a global that turns on/off with each press of the button, then check to see if the global is true/false when the button is pressed and then start or stop the motors depending on that.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2013, 09:22
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: Toggle Motor Using Button

The attached image shows some of the useful techniques that may help. You can even make some of these into subVIs for use elsewhere.

I'd encourage you to build this with the button, right click on the button and change the mechanical action to a "switch until released", and run it on the My Computer. You can place probes on any of the wires or add indicators to them to understand how the values change when you interact. Then, when you understand and trust it, move it to the robot simply by retargeting it or by copying the code or using the subVIs.

Ask questions if parts of it don't make sense or you want to compare it to your approach.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	92
Size:	107.3 KB
ID:	13754  
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2013, 13:27
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Toggle Motor Using Button

Quote:
Originally Posted by Greg McKaskle View Post
The attached image shows some of the useful techniques that may help. You can even make some of these into subVIs for use elsewhere.

I'd encourage you to build this with the button, right click on the button and change the mechanical action to a "switch until released", and run it on the My Computer. You can place probes on any of the wires or add indicators to them to understand how the values change when you interact. Then, when you understand and trust it, move it to the robot simply by retargeting it or by copying the code or using the subVIs.

Ask questions if parts of it don't make sense or you want to compare it to your approach.

Greg McKaskle
I either copied it wrong or I guessed what was in the case and diagram disable structures incorrectly because after many a run through it seemed ok but when I actually tested it the motor didn't move. Here is what I made:



I noticed that the stop on the while loop was set to false so I switched that to true and nothing changed.

Please give it to me straight, doc.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2013, 15:36
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Toggle Motor Using Button

As I explained in this thread, our team developed a very simple VI to toggle a boolean input, essentially making any input act like a latching button. I've attached both the VI and a screenshot of how you could use it in your particular situation.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	237
Size:	3.2 KB
ID:	13768  
Attached Files
File Type: vi Toggle.vi (9.4 KB, 112 views)
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2013, 22: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,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: Toggle Motor Using Button

I forgot to point out that you just want to place the code from inside the loop into your TeleOp. If you put an infinite while loop in Teleop, it messes with the framework and you won't process joysticks or move as you are supposed to.

And the Toggle VI worked well and is simpler than what I wrote. They are equivalent functionally.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2013, 17:26
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Toggle Motor Using Button

Quote:
Originally Posted by Greg McKaskle View Post
I forgot to point out that you just want to place the code from inside the loop into your TeleOp. If you put an infinite while loop in Teleop, it messes with the framework and you won't process joysticks or move as you are supposed to.

And the Toggle VI worked well and is simpler than what I wrote. They are equivalent functionally.

Greg McKaskle
I went with bv's and it works fine, thanks for the help.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2013, 17:34
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Toggle Motor Using Button

Okay so a follow up question I have would be:

How would I be able to control the speed of a motor using the "precise throttle" feature on the, specifically, Attack3 joystick (the little knob in the front that would be fantastic for constant control but in increments, unlike using the joystick itself)?

Thanks
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2013, 17:42
blackflame2996's Avatar
blackflame2996 blackflame2996 is offline
Alumni
AKA: David Donahue
FRC #2996 (Cougars Gone Wired)
Team Role: Alumni
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Colorado springs, CO
Posts: 67
blackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to all
Re: Toggle Motor Using Button

Do you mean proportional scaling of the motor speed?
__________________
2009 Regional Winners
2011 Regional Chairman's Award
2012 Regional Winners
2013 Regional Chairman's Award
Reply With Quote
  #10   Spotlight this post!  
Unread 04-02-2013, 20:29
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: Toggle Motor Using Button

Read the Attack 3 joystick's throttle button as "axis 3 (throttle)". It'll give a value between +1 (full back/down) and -1 (full forward/up).

If you want to turn that into a value between 0 and 1, just subtract one and divide by negative two.

Is that enough information? I'm not sure if you're asking how to read the throttle control, or how to set the speed of a motor, or something else.
Reply With Quote
  #11   Spotlight this post!  
Unread 04-02-2013, 20:41
James H James H is offline
Registered User
FRC #4256
 
Join Date: Feb 2013
Location: United States
Posts: 9
James H is an unknown quantity at this point
Re: Toggle Motor Using Button

Quote:
Originally Posted by Alan Anderson View Post
Read the Attack 3 joystick's throttle button as "axis 3 (throttle)". It'll give a value between +1 (full back/down) and -1 (full forward/up).

If you want to turn that into a value between 0 and 1, just subtract one and divide by negative two.

Is that enough information? I'm not sure if you're asking how to read the throttle control, or how to set the speed of a motor, or something else.
What you can do to take it a step further is something like this VI I designed for my team. The 4 can be changed to any number you want and it controls the fraction (in this case, 1/4) that putting the throttle all the way down will give while keeping the top value at 1.

http://www.chiefdelphi.com/forums/at...5&d=1360018159
Reply With Quote
  #12   Spotlight this post!  
Unread 05-02-2013, 02:01
fawkes32's Avatar
fawkes32 fawkes32 is offline
Programming and Electronics Mentor
AKA: Daniel
FRC #4635 (Eugenio)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Mexico
Posts: 3
fawkes32 is an unknown quantity at this point
Re: Toggle Motor Using Button

well we actually have it working this way on the four buttons on top of the joystick, so the robot can go forward, left, right and backwards with only the 4 buttons on top.

I will leave you with the vi.
Attached Files
File Type: vi Teleop.vi (27.0 KB, 10 views)
__________________
WE changes ME
Inspire Young Minds to Be Extraordinary
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 22:55.

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