Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   LimitSwitches and Encoder Questions (http://www.chiefdelphi.com/forums/showthread.php?t=84369)

Dustin Shadbolt 17-03-2010 17:56

LimitSwitches and Encoder Questions
 
I have a few questions so I can finish working on some programming issues before tomorrow's Boiler Maker regional.

A) Limit Switches - My team wants to use to limit switches to control our climbing device. Like once one limit switch is pushed the motor can no longer go backwards. I have a basic understanding of limit switches from searching the forums but I don't know how you would incorporate that into the teleop vi. How would go about saying okay once the DIO input is true it prevents the motor from going backwards?

B)Encoder/Autonomous - I was also asked to try to make an autonomous program that goes forward for 4inches and kicks then goes forward 40inches and kick. For one is this possible? If so how would go about getting the encoder data and then setting it to run 4inches > kick > move 40 inches forward > kick > finish.

C) Toggle Button Issue - I have recently coded one of our buttons to toggle open and close one of our solenoids. The issue is it is really random in the way it acts. It will sometimes open sometimes close or it will open multiple times in one push. Yeah not pretty. I coded it just like the one found here (thanks team 358 for the wonderful resources!)

Again sorry for the all questions it's just I'm trying to get a basic idea of how to run all of this and get it done by myself lol. (yay for my first year)

bladetech932 17-03-2010 21:55

Re: LimitSwitches and Encoder Questions
 
A)dio is the condition for a case structure, if true, then it checks the value with a greater than 0 function,then inside with another case structure,if true, value carries through if not, set a constant 0
B)I dont know about the encoders but for autonomous you could use a set speed for example .4 to drive forward for the amount of time it takes to get to the first ball then kick then to the second and kick you can put this in a flat sequence for simplicity and to make sure the correct order is kept
C)if you are using a latching button there is an example provided with this years software it is found in C:\Program Files\National Instruments\LabVIEW 8.6\examples\FRC\Driver Station Inputs\Joystick Button Latching

Dustin Shadbolt 18-03-2010 06:11

Re: LimitSwitches and Encoder Questions
 
Thanks blade :)

Ether 18-03-2010 11:16

Re: LimitSwitches and Encoder Questions
 
Quote:

Originally Posted by dShad (Post 938814)
My team wants to use to limit switches to control our climbing device. Like once one limit switch is pushed the motor can no longer go backwards. I have a basic understanding of limit switches from searching the forums but I don't know how you would incorporate that into the teleop vi. How would go about saying okay once the DIO input is true it prevents the motor from going backwards?

If by "prevent the motor from moving backwards" you mean "stop powering the motor in the backward direction", then the best way is to connect the limit switch directly to the Jaguar (if you are using Jaguar). The Jaguar senses the limit switch and shuts off power. No code required.

~

Ether 18-03-2010 11:22

Re: LimitSwitches and Encoder Questions
 
Quote:

Originally Posted by dShad (Post 938814)
B)Encoder/Autonomous - I was also asked to try to make an autonomous program that goes forward for 4inches and kicks then goes forward 40inches and kick. For one is this possible? If so how would go about getting the encoder data and then setting it to run 4inches > kick > move 40 inches forward > kick > finish.

If you are using a relative encoder like the optical one from the KoP, and you are using autonomous independent:

- read and store the encoder count
- set motors to move forward at the desired speed
- poll the encoder count in a loop until it indicates a value that corresponds to a change of position of 4 inches
- kick the ball
- poll the encoder count in a loop until it indicates a value that corresponds to a change of position (from the original saved value) of 44 inches
- kick the ball
- stop the motors


~

Vikesrock 18-03-2010 11:52

Re: LimitSwitches and Encoder Questions
 
Quote:

Originally Posted by Ether (Post 939184)
If by "prevent the motor from moving backwards" you mean "stop powering the motor in the backward direction", then the best way is to connect the limit switch directly to the Jaguar (if you are using Jaguar). The Jaguar senses the limit switch and shuts off power. No code required.

~

:ahh:

Only do this ^ if you are using CAN!!

http://forums.usfirst.org/showthread.php?t=14956
Also in the manual, but I don't feel like grabbing the rule, it's referenced in the Q&A.

Ether 18-03-2010 12:50

Re: LimitSwitches and Encoder Questions
 
Quote:

Originally Posted by Vikesrock (Post 939213)
:ahh:

Only do this ^ if you are using CAN!!

http://forums.usfirst.org/showthread.php?t=14956
Also in the manual, but I don't feel like grabbing the rule, it's referenced in the Q&A.

GDC's response at the link you provided (appended verbatim below) says you MAY use limit switch inputs if you are using CAN, and you CAN NOT use them if you are controlling via PWM.

Either they made a grammar mistake ("can" not instead of "must not" or "shall not" or "are not permitted to"), or they know something about the Jag that is not in the technical documentation. The documentation I have in front of me says nothing about the limit switch functionality being limited to use only with CAN commands.


GDC's response:
Please see Rule <R60-L>. You may use the limit switch inputs to the Jaguar speed controllers IF you are controlling the Jaguar via a CAN-bus connection. You can not use external limit switch inputs to the Jaguars if you are controlling them via PWM inputs


~


All times are GMT -5. The time now is 11:05.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi