Go to Post Maybe Dean Kamen can appear in Levi's advertising? - David Brinza [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 06-02-2014, 14:03
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Using 4 joystick buttons with Case Statement

Dear CD,

I am trying to use 4 joystick buttons in conjunction with a case statement in order to select one motor speed but am not being successful.

My guess is that the execution order impacts the design and does not effectively allow me to select some options.

Can you recommend a design solution?
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2014, 14:05
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Exclamation Re: Using 4 joystick buttons with Case Statement

Dear CD,

Yeah, it helps to post a picture in the initial email.
Attached Thumbnails
Click image for larger version

Name:	Joystick 4Button.png
Views:	71
Size:	278.5 KB
ID:	16131  
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2014, 14:22
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,795
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: Using 4 joystick buttons with Case Statement

I'm on the road so I cannot offer up examples, but I can comment on what you have.

The code you posted has a chicken/egg issue.
None of the Latches are guaranteed to have been set by the loops on the left, before being used in the case statement to the right.
The case statement code on the right happens simultaneously with the checks you are performing on the left.

As far as using joystick buttons to select a motor speed, you can do something like this. Add more buttons (one speed and one Select per new button) for more variations in speed.
It just remembers (latches) the speed associated with the last button pushed.
I can't tell if this is in line with how you are trying to employ the buttons.

__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 06-02-2014 at 14:29.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2014, 14:23
Animal Control's Avatar
Animal Control Animal Control is offline
Registered User
FRC #2345
 
Join Date: Jan 2014
Rookie Year: 2007
Location: Kearney, MO
Posts: 72
Animal Control is infamous around these partsAnimal Control is infamous around these partsAnimal Control is infamous around these partsAnimal Control is infamous around these parts
Re: Using 4 joystick buttons with Case Statement

Could you be a little more specific, I'm a bit confused as to where some of the values are coming from. Also wouldn't it be easier to use a case structure with a choice of each value? Sorry if I'm not much help.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2014, 09:53
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Unhappy Re: Using 4 joystick buttons with Case Statement

Dear CD,

I can't figure out for the life of me why I cannot see the third button case while seeing cases 1, 2, and 4?

Please see pdf attachment.

My next set of experiments will use Mark's example above but I really think my latching button method using RS Bistable vi should work.

Thanks,

4 button Joystick Latch.pdf
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377

Last edited by marccenter : 07-02-2014 at 09:54. Reason: Update
Reply With Quote
  #6   Spotlight this post!  
Unread 07-02-2014, 12:44
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Using 4 joystick buttons with Case Statement

You still have the race condition that Mark pointed out. Putting the latches in a sequence helps some, but doesn't keep the case statement from executing before or after the sequence.

I think you can implement the whole thing using wires and feedback nodes, and then you would have no race conditions.

As for any specific debugging, that's almost impossible to do with a PDF of a portion of the code, and hardly any description of what the code is supposed to do. Post the VI and a detailed description and maybe someone can help. To me, it looks overly complicated, but since I don't know what its supposed to do, I can't say for sure.
Reply With Quote
  #7   Spotlight this post!  
Unread 07-02-2014, 12:51
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,112
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: Using 4 joystick buttons with Case Statement

There's an awful lot of complicated stuff going on there. I suspect LabVIEW provides a much simpler way to do what you want, but without knowing what you want to do, I don't want to risk giving inappropriate advice.

What exactly are you trying to do here?
Reply With Quote
  #8   Spotlight this post!  
Unread 07-02-2014, 14:12
chris.boyle's Avatar
chris.boyle chris.boyle is offline
Programming Mentor
FRC #0068 (Truck Town Thunder)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Truck Town Thunder (Brandon)
Posts: 36
chris.boyle is on a distinguished road
Re: Using 4 joystick buttons with Case Statement

If you are looking to create a latch on a variable, you can use this method:

It works very well for us and it only updates the variable when something changes. We use this method for almost all inputs from the driver station.
Attached Thumbnails
Click image for larger version

Name:	Shift.jpg
Views:	28
Size:	78.0 KB
ID:	16146  
__________________
2014 Chairman's Award--Michigan State Championship
2014 Chairman's Award--Waterford District
2014 Winner--Great Lakes Bay District
2013 Chairman's Award--Kettering District
2012 Championship Division Finalists--Thanks 330 and 639
Reply With Quote
  #9   Spotlight this post!  
Unread 08-02-2014, 22:38
Doc Wu's Avatar
Doc Wu Doc Wu is offline
Registered User
AKA: Al Gritzmacher
FRC #1507 (Warlocks)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Lockport NY
Posts: 207
Doc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant future
Re: Using 4 joystick buttons with Case Statement

Quote:
Originally Posted by marccenter View Post
Dear CD,

I can't figure out for the life of me why I cannot see the third button case while seeing cases 1, 2, and 4?
I wonder if the third button is generating a a value of 4 and your fourth button generates a value of 8?

When you convert a binary array to a number, each bit takes a power of 2 value. To get three, you'd need 1 and 2 simultaneously.
__________________
-= Mentor Lockport Warlocks -=- Team 1507 =-
Amateur Radio Callsign: AE2T

2016 Robot Inspector - Fingerlakes, Pittsburgh
2015 Robot Inspector - Pittsburgh, Champs. Judge Observer - Champs
2014 Robot Inspector - Tech Valley, Fingerlakes, Buckeye, Championship
2013 Robot Inspector - Fingerlakes, Buckeye, Championship
2012 Robot Inspector - Fingerlakes, Buckeye, Championship - Website Evaluator - Fingerlakes, Buckeye, Championship
2011 Robot Inspector - Fingerlakes 2011 Safety Advisor - Fingerlakes

Reply With Quote
  #10   Spotlight this post!  
Unread 12-02-2014, 14:28
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Re: Using 4 joystick buttons with Case Statement

Doc Wu,

That's it! I haven't tested it yet but I know that's the solution.

When I get a chance, I will post the problem and solution for CD reference.

Thanks,
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377

Last edited by marccenter : 12-02-2014 at 14:30. Reason: Update
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 09:51.

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