|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
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]
|
|
#2
|
||||
|
||||
|
Re: Switch help
Quote:
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
||||
|
||||
|
Re: Switch help
Quote:
What motor controller will you be using? Last edited by Ether : 18-01-2014 at 16:53. |
|
#5
|
|||||
|
|||||
|
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?
|
|
#6
|
|||
|
|||
|
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! ![]() |
|
#7
|
|||||
|
|||||
|
Re: Switch help
Quote:
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. |
|
#8
|
|||
|
|||
|
Re: Switch help
Quote:
Thanks! |
|
#9
|
|||
|
|||
|
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;
|
|
#10
|
|||||
|
|||||
|
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.
|
|
#11
|
|||
|
|||
|
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/.
|
|
#12
|
|||||
|
|||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|