Go to Post One team at the UTC regional scored over 2100 points in autonomous alone. I was highly impressed. - Greg Marra [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 23-10-2010, 09:58
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
How do i add two "True" values

What i want to do is this.

Only when one switch is true and the other switch is true, extend the solenoid and retract back when the third switch turns off. I do not know how to use ONLY the true values of the switches to make it do this in Autonomus. Because if either is false that means it is not safe to kick so dont kick yet. Help needed

1514
Whcirobotics
Reply With Quote
  #2   Spotlight this post!  
Unread 23-10-2010, 10:12
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: How do i add two "True" values

So to clarify...
Kick when:
  • switch 1 = true
  • switch 2 = true
  • switch 3 = false
Retract when:
  • switch 3 = true
Leave as is (kicking/retracting) for:
  • All other cases
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-10-2010 at 10:15.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-10-2010, 10:29
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: How do i add two "True" values

What i mean to say is this:
the three switches are this:

Proximity switch : switch 1
Safe Switch : switch 2
Armed Switch : switch 3

What i want to do in autonomous is this:

Retract the kicker when first autonomous is on.
As it is coming up, the proximity will come on. When proximity comes on, slow down the motor(motor is connected to the safe switch.

When Armed comes on (The switch that says the kicker is all the way to the top) turn the motor(or the safe switch. Same thing) in the negative direction. And when that safe switch comes on Stop the motor as it is all the way out of the way and it is safe to kick

When that is true.. The safe switch is ON and the Armed switch is ON then extend the solenoid. And extend till the Armed switch comes OFF and when it does go off retract back.

Our kicker works perfectly fine. But i just want it to do the kicking in autonomous without the user input (obviously).

This is what i have written in the code so far.. I dont know if it is right.

Pictures attached in word file.
Attached Files
File Type: doc autonomus pictures.doc (241.5 KB, 13 views)

Last edited by whcirobotics : 23-10-2010 at 10:45.
Reply With Quote
  #4   Spotlight this post!  
Unread 23-10-2010, 10:44
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: How do i add two "True" values

i realized i did something wrong. I also want it to retract when the Armed switch turns off. NOT only when Armed and Safe is false. So i added the solenoid retract to True in both Cases

When Armed switch is false

And

When Armed and Safe are false so here is another snippet included
Attached Files
File Type: doc autonomus pictures.doc (313.5 KB, 19 views)
Reply With Quote
  #5   Spotlight this post!  
Unread 23-10-2010, 11:45
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: How do i add two "True" values

Quote:
Originally Posted by whcirobotics View Post
What i want to do in autonomous is this:
...
You must have one heck of a kicker mechanism

Quote:
Originally Posted by whcirobotics View Post
Our kicker works perfectly fine. But i just want it to do the kicking in autonomous without the user input (obviously).
Would it work to move your (working) teleop code into a subVI that you could call from both autonomous and teleop? Make the inputs to the VI be whatever is normally controlled by your drivers, so your autonomous routine could supply these inputs instead.

It also sounds like your kicker code could benefit from a state machine: http://frcmastery.com/try-me/state-machines/

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote
  #6   Spotlight this post!  
Unread 23-10-2010, 15:05
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: How do i add two "True" values

I have tried to make the kicker by the state machine way,, with the Enums and everything. But it was a lot of case structures. i made it worked with just 3 if statements so that is not my problem.

But what is my problem is that i want it to kick when (2) values of 2 switches is true. I did it by adding another Case structure in autonomus over the two "True" cases and did the solenoid extend and retract.

I am asking if there is a better way > to do this. Like a ( + ) that adds the true values. maybe? i have written the code and posted it,, in my attachments above. If you know a way to do this tell me!

1514
Whcirobotics
Reply With Quote
  #7   Spotlight this post!  
Unread 23-10-2010, 15:49
Aren Siekmeier's Avatar
Aren Siekmeier Aren Siekmeier is offline
on walkabout
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: 대한민국
Posts: 735
Aren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond repute
Re: How do i add two "True" values

It looks like boolean operators would help simplify this. For example, where you have several nested case statements in which some of the cases do nothing, you could just have the appropriate ands, ors, xors, nots, etc. leading to a single case. Do a little exploration of the boolean pallete (functions >> programming >> boolean) with context help. And then maybe try some truth tables with all possible inputs and their desired outputs to figure which ones you need to use.

edit: The link Ether posted below explains all the boolean operators (except implies, but that's a derived one anyway) available on the boolean pallete. It also has the "truth tables" I was talking about, showing all pairs of inputs and their associated output. Also, check out the "Select" VI (also on the boolean pallete) for picking motor speeds. With some of the boolean tools you might be able to get rid of the case statements all together.

Last edited by Aren Siekmeier : 23-10-2010 at 17:12.
Reply With Quote
  #8   Spotlight this post!  
Unread 23-10-2010, 17:05
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How do i add two "True" values

Quote:
Originally Posted by whcirobotics View Post
what is my problem is that i want it to kick when (2) values of 2 switches is true. If you know a way to do this tell me!
The output of an AND gate is true if and only if both inputs are true. Is that what you are asking ?




Reply With Quote
  #9   Spotlight this post!  
Unread 23-10-2010, 17:28
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: How do i add two "True" values

Here's a LabVIEW example of what they're talking about.
The first picture ANDs two switches (they both must be TRUE to get the true case), the second ANDs three switches (and reverses one switch for good measure). The second way can be expanded to include as many switches as you like.
Attached Thumbnails
Click image for larger version

Name:	AND.jpg
Views:	30
Size:	10.4 KB
ID:	9367  Click image for larger version

Name:	AND2.jpg
Views:	32
Size:	14.4 KB
ID:	9368  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-10-2010 at 17:59.
Reply With Quote
  #10   Spotlight this post!  
Unread 23-10-2010, 18:22
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How do i add two "True" values

Quote:
Originally Posted by whcirobotics View Post
But what is my problem is that i want it to kick when (2) values of 2 switches is true. I did it by adding another Case structure in autonomus over the two "True" cases and did the solenoid extend and retract.

I am asking if there is a better way > to do this. Like a ( + ) that adds the true values. maybe? i have written the code and posted it,, in my attachments above. If you know a way to do this tell me!
If Mark's post was the answer you were looking for, and you want to learn more, then download this book and read chapter 7, especially the example in section 7.9



Reply With Quote
  #11   Spotlight this post!  
Unread 23-10-2010, 19:08
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: How do i add two "True" values

I have changed my code to what Mark suggested. I will try the code at school on Monday after school. If it does not work i will get back to you guys.

1514
Whcirobotics
Reply With Quote
  #12   Spotlight this post!  
Unread 26-10-2010, 20:46
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: How do i add two "True" values

For cases like these, where you have several boolean values that are used in evaluating for several situations, I use what I call a boolean state table to represent the desired functionality.
Here's a screenshot from my old software development guide:


The example this was for had a left and right drive control for inputs 1 and 2, bumper switches on 3 and 4, and an "auto navigation" toggle on input 5.

One way of coding this is to take each row and evaluate it with boolean logic, then bundle the results into a boolean array. With the boolean array you can use the following code:
__________________
-- Marshal Horn
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
cRIO "Magic" Values: Unresponsive Driver Station KRV NI LabVIEW 0 13-02-2009 17:33
"You've Been Sentenced" Robotics Add-On Deck Featured at the Duel on the Delaware Mr MOE General Forum 0 02-10-2008 07:32
Cannot access "double" values chantilly_team Programming 14 06-02-2005 13:39
Is the "Confirmed Game Information" rumor true? MJAdams Rumor Mill 8 02-01-2003 22:41
how tall is the ramp when in "up" and "balanced" position??? archiver 2001 1 24-06-2002 00:54


All times are GMT -5. The time now is 21:14.

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