Skip to content

Onboarding Project

Juan Palomino edited this page Aug 20, 2023 · 2 revisions

Goal:

Be able to teleoperated drive a differential drive robot Create an autonomous to score taxi points in autonomous

Requirements:

Must be in Command-Based Code Structure Use XBox Controller

Given:

Use Sleeper for testing (2023 Comp Robot) Can test with electrical/test board

By the end of this exercise, students should have an understanding of:

  • the Command-Based Code Structure

  • how to find information regarding their issues understanding the CAN-Bus

  • how to code Neo motors to spin in a differential drive set up

  • Understand the difference between teleop and auto

  • how to link robot functionality with operator controls.

  • Important Robot-Specific Values/Math:

    • Gear Ratio on Drivetrain: 8.68
    • Wheel Diameter = 6 inches
    • Ticks/Gear Ratio = Rotations
    • Revolutions x Circumference of Wheel = Distance Traveled
    • Circumference Units = Units of Distance Traveled
    • Circumference = Wheel Diameter * Pi (2pi * Radius)

Hint: Use the Units and Math libraries to help with math (pls dont do manually 😭) Note: Other ways to solve for gear ratio pls dont get stuck here if you need help ask Note Before Beginning: This maps out individual steps, they do not need to be followed in order or even at all. It is encouraged for students to attempt solutions on their own, referencing this sheet only when necessary There are multiple ways to solve each problem! The steps below are specific, but feel free to stray and test different things out! Have a different solution? Try it! Stuck and the steps below don’t cover the issue? Ask! You’re here to learn and be creative! Follow your own path! Some things were left vague on purpose, try problem solving and ask if you need help! Students can choose to work by themselves or in pairs; however, it is encouraged to work as a team to grow teamwork abilities and have different eyes to help with unique problem solving Don’t be afraid to ask questions! We are here to help and teach! To Begin Create a Github account and a Slack Account Link both to our organization Inside of the DifferientialDrive repository Create a Github Issue titled [Student Name(s)] Differential Drive labeled “Good First Issue” Clone the DifferientialDrive Repository into personal folder Inside of the folder now labled DifferientialDrive, create a branch “feat#[Issue Number]-[Student(s) First and Last Initial All Uppercase”DifferentialDrive” off of Dev Create a Drivetrain Subsystem Find Motor and Encoder Types and Import Necessary Library(ies) Find Motor and Encoder CAN IDs Declare and Define Motors, Encoders, and Differential Drive type to the Subsystem Add PERMANENT UNCHANGING values to Constants Teleoperated Inside of Drivetrain Subsystem Create drive function(s) with parameters for joystick inputs (Tank and/or Arcade Drive) Create Subsystem inside of RobotContainer Call function inside of RobotContainer and add Joystick inputs as parameters Test Bugfix till consistently driveable

Autonomous There are two options: Option A (Easier): Time-Based Autonomous Create a Command Have a Parameter for the function be the Drivetrain Subsystem Have a WPILIB Timer Initialize by starting timer Execute by running motors End by stopping motors isFinished when timer hits specified time Option B (More Difficult): Distance-Based Autonomous Create a Command Have a Parameter for the function be the Drivetrain Subsystem Create a “getter” in your drivetrain subsystem for distance traveled Possibly Add Position Conversion Factor to convert ticks -> feet/meters Execute by running motors End by stopping motors isFinished when drivetrain position hits certain distance traveled

Links:

Notes:

Issues you may find is what if the drivetrain overshoots the specified position? How will you solve this if it is an issue? What happens if the drivetrain is moved prior to the auto? Will this affect it? Is this a concern? If yes, how will you solve it?

Then test either option until it consistently works (10 times in a row?)

Congrats Lol, you finished gg ez win :D

Clone this wiki locally