Go to Post *sigh* Anything else we can do to get this thing to work? - domoarigato [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-06-2010, 12:30
isaacdl isaacdl is offline
I have a white hat..it's just dirty
AKA: Isaac Dontje Lindell
FRC #3018 (Nordic Storm)
 
Join Date: Oct 2009
Rookie Year: 2010
Location: St. Peter
Posts: 32
isaacdl is an unknown quantity at this point
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?
  #2   Spotlight this post!  
Unread 11-06-2010, 12:31
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: no control of bot when kicker is operating

Use Timers
  #3   Spotlight this post!  
Unread 11-06-2010, 12:33
isaacdl isaacdl is offline
I have a white hat..it's just dirty
AKA: Isaac Dontje Lindell
FRC #3018 (Nordic Storm)
 
Join Date: Oct 2009
Rookie Year: 2010
Location: St. Peter
Posts: 32
isaacdl is an unknown quantity at this point
Re: no control of bot when kicker is operating

You're going to have to give us more than that. How?
  #4   Spotlight this post!  
Unread 11-06-2010, 12:42
Chris is me's Avatar
Chris is me Chris is me is offline
no bag, vex only, final destination
AKA: Pinecone
FRC #0228 (GUS Robotics); FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Glastonbury, CT
Posts: 7,746
Chris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond repute
Send a message via AIM to Chris is me
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.
__________________
Mentor / Drive Coach: 228 (2016-?)
--2016 Waterbury SFs (with 3314, 3719), RIDE #2 Seed / Winners (with 1058, 6153), Carver QFs (with 503, 359, 4607)
Mentor / Consultant Person: 2170 (2017-?)
.
College Mentor: 2791 (2010-2015)
-- 2015 TVR Motorola Quality, FLR GM Industrial Design -- 2014 FLR Motorola Quality / SFs (with 341, 4930)
-- 2013 BAE Motorola Quality, WPI Regional #1 Seed / Delphi Excellence in Engineering / Finalists (with 20, 3182)
-- 2012 BAE Imagery / Finalists (with 1519, 885), CT Xerox Creativity / SFs (with 2168, 118)
Student: 1714 (2009) - 2009 MN 10K Lakes Regional Winners (with 2826, 2470)
2791 Build Season Photo Gallery - Look here for mechanism photos My Robotics Blog (Updated April 11 2014)
  #5   Spotlight this post!  
Unread 11-06-2010, 12:46
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,069
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
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.
__________________




.
  #6   Spotlight this post!  
Unread 11-06-2010, 12:49
isaacdl isaacdl is offline
I have a white hat..it's just dirty
AKA: Isaac Dontje Lindell
FRC #3018 (Nordic Storm)
 
Join Date: Oct 2009
Rookie Year: 2010
Location: St. Peter
Posts: 32
isaacdl is an unknown quantity at this point
Re: no control of bot when kicker is operating

We're using Timer.delay(xnumberofseconds). Is that what you mean?
  #7   Spotlight this post!  
Unread 11-06-2010, 12:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
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: 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
  #8   Spotlight this post!  
Unread 11-06-2010, 12:56
ATannahill ATannahill is offline
Registered User
AKA: Alex Tannahill
no team
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Southfield, Michigan
Posts: 3,259
ATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond reputeATannahill has a reputation beyond repute
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.
__________________

- Arizona North
  #9   Spotlight this post!  
Unread 11-06-2010, 12:59
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,069
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: no control of bot when kicker is operating

Quote:
Originally Posted by isaacdl View Post
We're using Timer.delay(xnumberofseconds). Is that what you mean?
I believe so... There should be a way of setting a timer to go off in X period of time. In C++ these would be the Timer.Start Timer.Stop and Timer.HasPeriodPassed (Referenced http://www.virtualroadside.com/WPILib/class_timer.html) Java should have an equivalent. This should not delay the loop you are in which is your problem. (If I am assuming your problem correctly)
__________________




.
  #10   Spotlight this post!  
Unread 11-06-2010, 13:01
isaacdl isaacdl is offline
I have a white hat..it's just dirty
AKA: Isaac Dontje Lindell
FRC #3018 (Nordic Storm)
 
Join Date: Oct 2009
Rookie Year: 2010
Location: St. Peter
Posts: 32
isaacdl is an unknown quantity at this point
Re: no control of bot when kicker is operating

Quote:
Originally Posted by Ether View Post
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

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 ) as opposed to IterativeRobot.
  #11   Spotlight this post!  
Unread 11-06-2010, 13:04
isaacdl isaacdl is offline
I have a white hat..it's just dirty
AKA: Isaac Dontje Lindell
FRC #3018 (Nordic Storm)
 
Join Date: Oct 2009
Rookie Year: 2010
Location: St. Peter
Posts: 32
isaacdl is an unknown quantity at this point
Re: no control of bot when kicker is operating

Quote:
Originally Posted by Andrew Schreiber View Post
I believe so... There should be a way of setting a timer to go off in X period of time. In C++ these would be the Timer.Start Timer.Stop and Timer.HasPeriodPassed (Referenced http://www.virtualroadside.com/WPILib/class_timer.html) Java should have an equivalent. This should not delay the loop you are in which is your problem. (If I am assuming your problem correctly)
As far as I can tell, it's literally a delay; if you set a state for something (ie motor 1 forward 50%) and then use that delay method for 2 seconds, motor 1 will continue to operate at 50% until the timer is done and you send a command to change the state.

Last edited by isaacdl : 11-06-2010 at 13:17. Reason: typo
  #12   Spotlight this post!  
Unread 11-06-2010, 13:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
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: no control of bot when kicker is operating

Quote:
Originally Posted by isaacdl View Post
We're trying option one right now, but having never had to program multiple threads, could you explain how to do it?
I wish I could give you more specific help, but I am unfamiliar with Java. I'm sure there's a way to do it. There are lots of good Java programmers on CD. One fellow is even currently writing a Java programming manual for FIRST:

http://www.chiefdelphi.com/forums/sh...ad.php?t=85836

maybe you could ask him.


~
  #13   Spotlight this post!  
Unread 11-06-2010, 21:34
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
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.
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
  #14   Spotlight this post!  
Unread 11-06-2010, 21:50
synth3tk's Avatar
synth3tk synth3tk is offline
Volunteer / The Blue Alliance
AKA: David Thomas
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Ohio
Posts: 2,005
synth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond repute
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.
  #15   Spotlight this post!  
Unread 11-06-2010, 22:03
synth3tk's Avatar
synth3tk synth3tk is offline
Volunteer / The Blue Alliance
AKA: David Thomas
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Ohio
Posts: 2,005
synth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond repute
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
        Watchdog.getInstance().feed();
        if(gamePad.getRawButton(7) == true && kickTimer.get() == 0.0)
        {
            kickTimer.start();
            sFire.set(true);
            sLatch.set(false);

            sExt.set(true);
            sRet.set(false);
        }
        if (kickTimer.get() > 0.75 && kickTimer.get() < 1.05)
        {
            sFire.set(true);
            sLatch.set(false);

            sExt.set(false);
            sRet.set(true);
        }
        if (kickTimer.get() > 1.05 && kickTimer.get() < 1.35)
        {
            sFire.set(false);
            sLatch.set(true);

            sExt.set(false);
            sRet.set(true);
        }
        if (kickTimer.get() > 1.35)
        {
            sFire.set(false);
            sLatch.set(true);

            sExt.set(true);
            sRet.set(false);
            kickTimer.stop();
            kickTimer.reset();
        }
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
842 Kicker On Bot kE7JLM General Forum 36 29-01-2010 11:51
How & where do you build the bot when it snows and your robo-base (school) is closed? Elgin Clock General Forum 28 03-03-2008 00:12
paper: Control an FRC bot with a Wiimote Greg Marra Extra Discussion 8 21-01-2008 12:41
1189 - Human-Bot Arm Control jmcr8on Robot Showcase 50 13-10-2007 22:58


All times are GMT -5. The time now is 23:19.

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