Tech Toolbox
  • Please Visit https://ftc-tech-toolbox.vercel.app/ for the new tech toolbox!!
    • Introduction
    • Choosing an IDE
    • Creating an OpMode
    • Motors and Encoders
    • Servos
    • Gamepad Controls
    • Drive Systems
    • Lynx Modules
    • Telemetry
    • Wireless Download
    • The Sleep Command
  • Please Visit the New Link
    • Tank Drive / Skid Steer (Part 1)
    • Mecanum Drive (Part 1)
    • Turrets
    • Linear Slides
    • Kicker
    • Active Intake / Sweepers
    • Flywheels / Shooters
  • Please Visit the new Link
    • Base Class (Step 1)
    • Module Classes (Step 2)
    • OpMode Classes (Step 3)
  • This domain is now depreciated and is no longer updated!
  • This domain is now depreciated and is no longer updated!
    • What is Localization?
    • General Odometry Logic
    • Tank (No Deadwheels)
    • Mecanum (No Deadwheels)
    • Deadwheel Odometry (Mecanum and Tank)
    • VSLAM
  • This domain is now depreciated and is no longer updated!
    • What is Control Theory?
    • Custom PID Loops
    • Essential Control Theory Concepts
    • Resources for Learning Advanced Control Theory
  • This domain is now depreciated and is no longer updated! Please visit this domain for the new TT!
    • Introduction
    • Mecanum Drive (Part 2)
    • Tank Drive (Part 2)
    • Introduction to Pure Pursuit
    • Pure Pursuit: Mecanum
    • Pure Pursuit: Tank
    • Advanced Pure Pursuit
    • Guided Vector Fields
    • Autonomous Movement Libraries
  • Sensors
    • IMU
    • Color Sensors
      • Advanced Sensing Code
    • Distance Sensors
    • Touch Sensor
  • Computer Vision
    • Setting up Camera/Intro to Computer Vision Tools
      • Intro to OpenCV
      • Vuforia
    • Streaming Frames
    • Color Thresholding
    • April Tags
    • Linear Regression
    • Machine Learning Toolchain
    • Object Distance Estimation
    • Object Tracking / Driving to an Object
    • Computer Vision Simulators
  • Simulators
    • Beta8397 Simulator
    • VRS
  • Cool Codebases
Powered by GitBook
On this page
  1. Please Visit the New Link

Kicker

Common Feeding Mechanism

PreviousLinear SlidesNextActive Intake / Sweepers

Last updated 1 year ago

Prerequisites

A kicker is a commonly used feeding mechanism that transports objects through a robot. This is typically accomplished by making a fast servo oscillate between two positions rapidly.

A use case for a kicker can be found in the FTC 2020-2021 game Ultimate Goal. Our robot made use of a kicker to feed in the rings that were collected by our intake sweeper into our flywheel shooter.

It is clear that servos need some amount of time to reach a given position, thus setting the close position of the kicker right after the open position will cause the servo to not move at all. Instead what you should do is maintain a timer of how long the servo has been running to reach a certain position. When the timer passes the threshold, make the servo move back to the original position to complete the oscillation.

We can implement this idea using the following steps:

  • Set a variable indicating the total amount of time one complete oscillation of the servo should take (moving from the start position to the end position and back to the start).

  • When the designated button for the kicker is not being held, constantly reset the timer so the kicker doesn't move from the start position.

  • When the button is being held, the timer will continue running until it reaches a point where it is high enough that you can make the servo go to its second position.

  • As the timer continues running even higher you will reach a point where the servo can go back to its original position, completing the oscillation.

We understand that this description can be quite confusing, but please take a look at the code, as a practical implementation may be more intuitive. Worst case, to use this code you simply need to replace the kicker bounds with positions you need your kicker to oscillate between and adjust your kickerCycleTime variable as needed.

The following code should make this description clearer.

@TeleOp(name = "KickerDemo", group = "FTC_Guide")
public class KickerDemo {
    Servo kicker; // servo
    double kickerCycleTime = 500; // total amount of milliseconds you want 
    //one oscillation to take
    boolean retDone = false, pushDone = true,
    ElapsedTime kTime = new ElapsedTime();
    double kickerEngPos = 0, kickerOpenPos = 1; // kicker positions 
    
    @Override    
    public void init() {
      kicker = hardwareMap.servo.get("kicker");
    }

    @Override
    public void start(){
        
    }

    @Override
    public void loop() {
             // Kicker (press and hold x to oscillate the servo)
            if(!gamepad2.x){
                kTime.reset(); // reset the timer when idle. 
                if(pushDone && !retDone){
                    kicker.setPosition(kickerOpenPos);
                }

                retDone = false;
                pushDone = false;
            }

            if(kTime.milliseconds() % kickerCycleTime > 10 && kTime.milliseconds() % 
            kickerCycleTime < kickerCycleTime / 2 && !pushDone){
                pushDone = true;
                retDone = false;
                kicker.setPosition(kickerEngPos);
            } else if(kTime.milliseconds() % kickerCycleTime > kickerCycleTime / 2 &&
             !retDone){
                pushDone = false;
                retDone = true;
                kicker.setPosition(kickerOpenPos);
            }
    }

    @Override
    public void stop(){
        
    }
}
Servos
Our control award video