View Single Post
  #6   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();
        }