Go to Post It's not a problem, it's a feature! - smokescreen [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 18-01-2014, 15:52
nelson.ke@ nelson.ke@ is offline
Registered User
FRC #2883
 
Join Date: Jan 2012
Location: United States
Posts: 6
nelson.ke@ is an unknown quantity at this point
Switch help

So we are looking at a wheel that rotates and then hits a switch and stopping. Then a button or trigger is pressed and activates the motor to rotate one revolution to the switch and stopped by the switch. Thus the mechanism is loaded for the next shot. [IMG][url=http://s857.photobucket.com/user/Thanousay_Khamphoune/media/Switchexample_zpse97584df.png.html]
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2014, 16:27
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Switch help

Quote:
Originally Posted by nelson.ke@ View Post
So we are looking at a wheel that rotates and then hits a switch and stopping. Then a button or trigger is pressed and activates the motor to rotate one revolution to the switch and stopped by the switch. Thus the mechanism is loaded for the next shot. [IMG][url=http://s857.photobucket.com/user/Thanousay_Khamphoune/media/Switchexample_zpse97584df.png.html]
Are you asking a question, or just sharing?


Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2014, 16:32
nelson.ke@ nelson.ke@ is offline
Registered User
FRC #2883
 
Join Date: Jan 2012
Location: United States
Posts: 6
nelson.ke@ is an unknown quantity at this point
Re: Switch help

asking a question on how should I program that and maybe some pics of what teleop would look like. I want the motor to keep rotating until it hits the switch and then stop, a trigger on the controller would activate the cycle again so the motor goes around until it hits the switch again.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-01-2014, 16:51
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Switch help

Quote:
Originally Posted by nelson.ke@ View Post
asking a question on how should I program that and maybe some pics of what teleop would look like. I want the motor to keep rotating until it hits the switch and then stop, a trigger on the controller would activate the cycle again so the motor goes around until it hits the switch again.
How fast will this be rotating? Do you want it to reverse direction when the trigger activates the cycle, or continue on "through" the switch one complete rev?

What motor controller will you be using?



Last edited by Ether : 18-01-2014 at 16:53.
Reply With Quote
  #5   Spotlight this post!  
Unread 18-01-2014, 22:45
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: Switch help

Do you want it to stop at the switch even if the operator is still pressing the button, requiring the button to be released first and then pressed again in order to start another cycle? Or do you want the motor to run continuously if the button is held down?
Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2014, 10:30
nelson.ke@ nelson.ke@ is offline
Registered User
FRC #2883
 
Join Date: Jan 2012
Location: United States
Posts: 6
nelson.ke@ is an unknown quantity at this point
Re: Switch help

@Ether, we would like to continue through and use a talon as a motor controller

@Alan Anderson yes we would like the first option with the switch stopping the motor and then you have to release the trigger and press the trigger again to start the cycle.

Thanks!
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2014, 23:16
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: Switch help

Quote:
Originally Posted by nelson.ke@ View Post
...we would like the first option with the switch stopping the motor and then you have to release the trigger and press the trigger again to start the cycle.
That's going to involve something a little more complicated than simple combinatorial logic. I suggest implementing it as a flat sequence in Periodic Tasks.

In the first frame, halt the motor and wait for the trigger to be released. In the second frame, halt the motor and wait for the trigger to be pressed. In the third, set the motor to whatever value you want it to run at and wait for the limit switch to be activated. Put the entire sequence in a neverending while loop so it starts over every time it finishes.

The "wait for" parts can be programmed as while loops that terminate when the condition is seen. Make sure to put a delay inside each of those loops so they don't monopolize the cRIO's CPU.

If this isn't enough to start with, let me know and I'll give you some example code to look at.
Reply With Quote
  #8   Spotlight this post!  
Unread 22-01-2014, 10:52
nelson.ke@ nelson.ke@ is offline
Registered User
FRC #2883
 
Join Date: Jan 2012
Location: United States
Posts: 6
nelson.ke@ is an unknown quantity at this point
Re: Switch help

Quote:
Originally Posted by Alan Anderson View Post
That's going to involve something a little more complicated than simple combinatorial logic. I suggest implementing it as a flat sequence in Periodic Tasks.

In the first frame, halt the motor and wait for the trigger to be released. In the second frame, halt the motor and wait for the trigger to be pressed. In the third, set the motor to whatever value you want it to run at and wait for the limit switch to be activated. Put the entire sequence in a neverending while loop so it starts over every time it finishes.

The "wait for" parts can be programmed as while loops that terminate when the condition is seen. Make sure to put a delay inside each of those loops so they don't monopolize the cRIO's CPU.

If this isn't enough to start with, let me know and I'll give you some example code to look at.
I know only a little about labview, so I found the while loops and flat sequences and understand what you're saying. However, I'm not understanding how to program it. Can you send a pick of what you would do, like a pic of the program?

Thanks!
Reply With Quote
  #9   Spotlight this post!  
Unread 22-01-2014, 11:13
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: Switch help

Sure sounds to me like a snail cam based shooter mechanism with a limit switch for the 'cocked' position.

The pseudo-code for what you're looking for looks a little something like this:

Code:
if(camLoadedSwitch = on){
camMotor.setSpeed(0);
}

if(oldTriggerState = off AND currentTriggerState = on){
camMotor.setSpeed(1);
}
oldTriggerState = currentTriggerState;
That would start the motor on a rising edge of the trigger, and stop it when it hits the limit switch, assuming this code is in a function that's called periodically.
Reply With Quote
  #10   Spotlight this post!  
Unread 22-01-2014, 11:13
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: Switch help

I won't be near a computer with this year's installation of LabVIEW on it until later today. I'll be able to post a snippet of code implementing what I described tonight.
Reply With Quote
  #11   Spotlight this post!  
Unread 22-01-2014, 20:20
brycen66 brycen66 is offline
Registered User
FRC #1678 (Citrus Circuits)
Team Role: Electrical
 
Join Date: Jan 2013
Rookie Year: 2011
Location: United States
Posts: 34
brycen66 is just really nicebrycen66 is just really nicebrycen66 is just really nicebrycen66 is just really nice
Re: Switch help

I would recommend using a Hall sensor as opposed to a physical limit switch. My team has had experiences with limit switches failing before. You can get a good cheap sensor kit at west coast products http://www.wcproducts.net/hall-effect/.
Reply With Quote
  #12   Spotlight this post!  
Unread 23-01-2014, 10:41
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: Switch help

I attached a VI snippet of the sort of thing I was talking about. It goes in Periodic Tasks as its own loop, not inside anything else.

It will not work in its current form. Both of the limit switch while loops are configured to continue while the switch value is true. Depending on whether the switch is normally open or normally closed, one or the other of the loops needs to be changed to terminate when the switch value is true instead.

You will also need to use the appropriate Refnum names on the left side, and set the motor output to the proper value to make it run in the direction and at the speed you want.
Attached Thumbnails
Click image for larger version

Name:	loop-de-loop.png
Views:	26
Size:	65.8 KB
ID:	15934  
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:45.

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