![]() |
Limit switches in autonomous
Our limit switches [to regulate Jaguar-implemented 'elevator' for arm] are working fine in teleop but not in autonomous. I've tried putting a print to driver station in the limit-switch statement in autonomous, and it never prints:
Code:
// test if limit switch works: it doesn't. Here's the full autonomous code: Code:
LencVal = lEncoder->Get();Teleop limit switch stuff works perfectly. Code:
//compressor controlAny thoughts? Thanks! |
Re: Limit switches in autonomous
Nothing looks wrong in your code, so it might be some problem with your initialization -- or possibly your autonomous function isn't being called for some reason -- use the normal printf and check NetConsole's output to see if it ever actually happens.
As another suggestion, you can wire limit switches directly to the Jaguar, and it will automatically turn itself off when the switch is pressed. Refer to the Jaguar user's guide for more information. |
Re: Limit switches in autonomous
Quote:
The rest of our autonomous code is definitely running, so do you think the limit-switch if-statement itself is not getting called? Here is our initialization: We understand that it's not legal to control a Jag [actually, now we are using Victors] directly using a limit switch unless you are using CAN [which looked to be a bigger headache than it's worth] as per <R55> J. When we originally encountered this problem, we planned to workaround it by just running the elevator motor up in autonomous until we reach the scoring grid: we figured that we would reach the scoring grid about the same time the elevator reached the top and started to stall. This would have worked very nicely, except that we recently replaced our wimpy little window-motor with a Fischer-Price motor that cleanly sheared our elevator belt the other day when we ran it just a bit too far! Now I am very wary of running autonomous that way unless I scale the motor back to about 20% rather than 100%. I eagerly await our Week 4 regional.... Thanks again for any help you can give. Code:
#include "WPILib.h" |
Re: Limit switches in autonomous
Have you tried running JUST that else statement, (running the motor) in autonomous?
That will help you rule out if you just initialized things improperly. |
Re: Limit switches in autonomous
Quote:
I know we tried running just the if-statement, with no line-following code or anything like that. There may have been a print-to-driver-station or something like that as well, but nothing that should affect it, I believe. |
Re: Limit switches in autonomous
We normally test
if (topLimit.Get()) { do something } or if (!topLimit.get()) { do something else } The code that works is testing == true while the code that does not work is testing == false. I can't see anything wrong with the code; I just have the observation that your test is different between the code that is working and the code that is not working. You might want to rewrite the auto code to use a == true test. |
| All times are GMT -5. The time now is 13:32. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi