![]() |
no control of bot when kicker is operating
We are working on learning Java as a precursor to next years season by programming this years bot in Java. We have tank drive working just fine, and the pneumatic kicker works just fine. The one problem we have is that one kick (out and in) takes about a second to complete. (Half second delay each way is programmed in to provide time for the cylinder to fully extend and retract). During that second, the we have no control over the bot. If it was driving (ie the joystick was moved forward or backwards) when the kicker is activated, the bot will *continue* to move at that speed and direction until the kicker cycle is done, even if we release the stick or change directions. How should we solve that?
|
Re: no control of bot when kicker is operating
Use Timers
|
Re: no control of bot when kicker is operating
You're going to have to give us more than that. How?
|
Re: no control of bot when kicker is operating
We got stuck in a goal in Connecticut, twice, because of this very issue. We stopped kicking while moving for the rest of the event to correct it. Hope you find a solution.
|
Re: no control of bot when kicker is operating
I assume you are using Wait or some similar statement (for some odd reason I can never remember what the thing is called) just like you would in Auton?
Robototes2412 is correct if that is your problem and that using Timers is your problem. I am not familiar enough with Java to know exactly how but a quick bit of research should show you the solution. Sorry I couldn't be more help. |
Re: no control of bot when kicker is operating
We're using Timer.delay(xnumberofseconds). Is that what you mean?
|
Re: no control of bot when kicker is operating
It sounds like your "driving" code has to wait for your "kicking" code to complete.
If this is the case, there are two (at least) different ways to solve this: 1) put your kicking code and driving code into separate tasks so that the OS can multitask them for you, or 2) use a state machine for your kicker code, so that it doesn't bring everything to a halt while it's waiting for the delay |
Re: no control of bot when kicker is operating
What is happening is that your code is stopping there and is not checking for new values for the joystick.
I don't know much about java but what will probably work is assigning the time at the beginning of the kick to a variable. When the time is equal to or greater than the variable plus .5 move on with the kick. This will let your code loop and read the joysticks. |
Re: no control of bot when kicker is operating
Quote:
|
Re: no control of bot when kicker is operating
Quote:
We're trying option one right now, but having never had to program multiple threads, could you explain how to do it? We're trying various things we're finding on the internet, but none of it is exactly what we need. If it matters, we're using SimpleRobotTemplate (so like Independent from LabView :P ) as opposed to IterativeRobot. |
Re: no control of bot when kicker is operating
Quote:
|
Re: no control of bot when kicker is operating
Quote:
http://www.chiefdelphi.com/forums/sh...ad.php?t=85836 maybe you could ask him. ~ |
Re: no control of bot when kicker is operating
Another option is to create a kickerLoops variable, and allow a certain loops to go by before operating your cylinders. We did this for our kicker and it worked great, but getting the initial setup/timing down might take a while.
|
Re: no control of bot when kicker is operating
Give me a few minutes, and I can pull up our code, which an on-hand programming helper at the regional assisted us with. We had that exact same issue.
|
Re: no control of bot when kicker is operating
Notes:
This is setup so that a button on a USB gamepad triggers the kicker. Replace the sFire/sLatch/etc parts with your actual kicking code. Depending on how your kicker works, you may need more or less "sections". kickTime.start in the first block is required, and kickTimer.stop(); and kickTimer.reset();. Code:
// Set kicking loop to start when button 7 on gamepad is pressed and not in loop already |
| All times are GMT -5. The time now is 03:45. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi