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
  • Implementation
  • Exercise (One Encoder, Two Slides)
  • Case Study
  1. Please Visit the New Link

Linear Slides

Commonly Used Extension Mechanism

PreviousTurretsNextKicker

Last updated 1 year ago

Prerequisites

Resources:

Implementation

Programming linear slides is usually as simple as setting a viable target position to your motors that control the slides. Note that encoders are required to do this.

When operating two motors together, we highly recommend that you remove any modules from the motors and test your positioning functions first. This will ensure that your motors are moving in the desired direction. Not doing this may lead to you risking breaking your motors or the slides! If one motor is not moving the correct way try setting another target position or reversing its direction.

public void extendVerticalSlides(int verticalSlideExtendPos) {
    verticalLeftSlide.setTarget(verticalSlideExtendPos); // the position you want the slides to reach
    verticalLeftSlide.retMotorEx().setTargetPositionTolerance(1); // set accuracy to 1 tick
    verticalLeftSlide.toPosition();
    verticalLeftSlide.setPower(1); // raise at some power

    verticalRightSlide.setTarget(verticalSlideExtendPos);
    verticalRightSlide.retMotorEx().setTargetPositionTolerance(1);
    verticalRightSlide.toPosition();
    verticalRightSlide.setPower(1);
 }

Exercise (One Encoder, Two Slides)

Due to a lack of encoder slots you may only have one encoder spot left to control both of your slides. To work around this issue you can use the encoder readings from one motor to control both slides via a custom PID loop. Note that this may not be as accurate as using two separate encoders.

Inside your opMode loop, implement the following psuedocode:

int error = leftSlide.getCurrentPosition() - destinationPosition;
leftSlide.executePID(error); 
rightSlide.exectutePID(error);  

Case Study

Take a look at the code of FTC Freight Frenzy world championship winning team, Delta Force!

Motors
FTC Team PIEaters Linear Slide Tutorial
GitHub - TAVii119/FTC-Freight-Frenzy-2021-2022: This is team's FTC 17713 (RO 119) Delta Force public repo. This contains all of our code for the 2021-2022 FTC "Freight Frenzy" season. More info about FTC can be found at: https://www.firstinspires.org/robotics/ftcGitHub
Logo