FRC1756-Argos / 2023-Robot

Robot code for 2023 FRC season
https://frc1756-argos.github.io/2023-Robot/
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

2023-Robot

CI Format Documentation

Robot code for 2023 FRC season

Key Features

LED Color Codes

Color Pattern Strips Meaning Trigger
Red/Blue Solid All Robot disabled; indicates alliance received from DS Robot disabled
Cat Yellow Solid All Robot disabled; no connection to FMS or driver station since startup Robot startup
Red/Blue Uniform fade in/out All Teleop enabled; indicates alliance received from DS Robot enabled in teleop mode
Red/Blue Fade sweeping from front to back All Autonomous enabled; indicates alliance received from DS Robot enabled in autonomous mode
Cone Yellow/Magenta Solid Top 10 LEDs of each strip Indicates game piece selected on operator control box for intake and placement positions Operator flips game piece switch
Cone Yellow/Magenta Flash All Request game piece Operator controller D-pad up/down
Green Flash All Game piece intake Game piece detected in intake while driver is intaking
White Flash All Game peice is lost Gampiece is no longer detected prior to placement
Green Solid Front left & right Vision alignment successful Vision alignment activated and cone node is detected in correct position
Cat Yellow Flash Front left/right Vision alignment adjusting; flashes in direction of adjustment Vision alignment activated and cone node is detected at lateral offset from desired position
Red Solid Front left & right Vision alignment no target Vision alignment activated and no cone node is detected
:fire: :fire: All :fire: :fire: :fire: Operator control box missile switch

Controller Vibration Feedback

Pattern Controller Meaning
Continuous 100% Both Swapping controllers activated. Swap occurs after vibration ends
500 ms pulse (along with green flash LEDs) Driver Game piece detected in intake while driver is intaking
500 ms right only (along with white flash LEDs) Driver Game piece lost

FTP

Commissioning A Robot

When commissioning a new robot, you should set the instance type to either "Competition" or "Practice" by creating a text file using FTP readable by lvuser on the RoboRIO at path /home/lvuser/robotInstance. The content of this file should be just the text Competition or Practice with no whitespace preceding. If no valid instance is found at runtime, competition instance will be used and an error will be generated.

Homing Swerve Drive

  1. When homing swerve modules figure out what is the front of the robot. The intake is the front.
  2. Rotate each swerve module to where each bevel gear is to the left side of the robot.
  3. Use something flat that is the length of the robot and line the swerve wheels up.
  4. Power on the robot and connect your computer. You will need one XBox controller. Make sure the controller says its controller 0(driver) in drivers station. Once connected, enable the robot and press your swerve homing buttons. We are using the buttons A, B, and X on the XBox controller. You have to hold the three buttons for 1.5 seconds.
  5. Once the homes have been set the homes will be put in a document. You will be able to open up the document.
  6. First open file explorer.
  7. Once you are in click in the white box at the top where you can type.
  8. Use one of the above FTP addresses.
  9. Then double click on the home folder.
  10. Then double click on the lvuser folder.
  11. Then double click on the homes folder.
  12. Then you can click on the swerveHomes file to see the homes of the swerve modules.

Wrist Homing

  1. Set up your wrist how you would like it homed. We have it where it is horizontal and the wheels are towards the ground.
  2. Power on the robot. Once it powered on connect the robot to your computer. You will need one XBox controller. Make sure the controller is controller 1(operator) in drivers station. Enable the robot and hold the buttons X and Y for 1.5 seconds. Once the homes have been set the homes will be put in a document. You will be able to open up the document.
  3. First open file explorer.
  4. Once you are in click in the white box at the top where you can type.
  5. Use one of the above FTP addresses.
  6. Then double click on the home folder.
  7. Then double click on the lvuser folder.
  8. Then double click on the homes folder.
  9. Then you can click on the wristHomes file to see the home of the wrist.

Shoulder Homing

  1. Set the arm to where it is perfectly horizontal over the front of the robot.
  2. Power on the robot. Once it powered on connect the robot to your computer. You will need one XBox controller. Make sure the controller is controller 1(operator) in drivers station. Enable the robot and hold the buttons A and B for 1.5 seconds. Once the homes have been set the homes will be put in a document. You will be able to open up the document.
  3. First open file explorer.
  4. Once you are in click in the white box at the top where you can type.
  5. Use one of the above FTP addresses.
  6. Then double click on the home folder.
  7. Then double click on the lvuser folder.
  8. Then double click on the homes folder.
  9. Then you can click on the shoulderHomes file to see the home of the shoulder.

Homing Extension

  1. Set arm to be in back n-stop position. Make sure it's ALL the way back!
  2. Power on robot. Connect the robot to your computer, no controller is needed for this homing.
  3. Open File Explorer
  4. Click in the white space in the bar at the top
  5. Use one of the above FTP addresses
  6. Double click on home folder
  7. Double click on lvuser folder
  8. Double click on homes folder
  9. Delete the extension homes file & restart code WITHOUT moving the arm extension

Vision

See vision readme for information on which pipelines to use and which indices to install these pipelines on.

Playing With Fusion Addressing

Go to http://10.17.56.2:5812 while connected to the robot to update firmware or change addresses.

Project Setup

Pre-Commit

This project uses pre-commit to check code formatting before accepting commits.

First install the prerequisites:

Then initialize:

pre-commit install
pre-commit run

The first run may take a moment, but subsequent automatic runs are very fast.

You'll now have the linter run before each commit! For compatibility with Windows, we recommend the pip version of clang-format, but wpi-format will find any installed clang-format binary in the system path.

Robot Startup

To properly start up, the following mechanisms need to be started up in a state such that:

The Oui Oui Placer is pointing upwards towards the sky, against it's n-stop.

The Bash Guards are all the way back, inside the robot to their n-stops.

The Arm assembly needs to be reasonably close to the stow position (not up and out).

Arm Extension Warning: Because of the use of the function ExtensionFromRotation(), the extension has a condition where it can believe it "wraps" around. To home, the extension treats some absolute value as zero degrees [0-360), if the extension is physically held beyond this zero, the absolute encoder might read 359° rather than 0° (or any other value beyond the home) causing the extension to "wrap around" and initialize the motor with completely incorrect soft limits, and current position.

Ex: You home the arm at absolute encoder 5° (which may map to 0 in extension depending on gearing of encoder rotation to extension), the arm is homed at an absolute encoder value of 3° because it was mechanically held past 5° before start. The extension now believes it's at 357° (which may be an extension of 30 in). A huge error!

Controls

Driver: Button Function
Left JS X Drive
Left JS Y Drive
Right JS X Turn
Right JS Y Unused
DPad Up Unused
DPad Right Unused
DPad Down Locks Wheels (in a cool x pattern)
DPad Left Unused
A Home Swerve (hold with B and X)
B Home Swerve (hold with A and X)
X Home Swerve (hold with A and B)
Y Field Home (hold)
LB Cube Intake
RB Cone Intake
LT Enable vision alignment
RT Cone/Cube Score (game piece selected by operator control box switch)
Back Swap (hold with Start)
Start Swap (hold with Back)
Left JS Button Unused
Right JS Button Unused
Operator: Button Function
Left JS X Extend/retract arm
Left JS Y Raise/lower arm
Right JS X Rotate wrist CW/CCW
Right JS Y Stick down articulates oui oui placer outside of robot, Stick up commands the opposite direction
A Home Shoulder (hold with B)
B Home Shoulder (hold with A)
X Home Wrist (hold with Y)
Y Home Wrist (hold with X)
DPad Up Request cone
DPad Right Reinitialize wrist from absolute position (hold alone)
DPad Down Request cube
DPad Left Unused
LB Intake Reverse
RB Intake Forward
LT Retract bash guard
RT Extend bash guard
Back Swap (hold with Start)
Start Swap (hold with Back)
Left JS Button Unused
Right JS Button Unused

Software Checkout

:memo: Note: Wrist should start near 0° orientation (wheels up, bar down).

Pits

Pits - Extended

Software Versions

We're using the following dependencies:

Special Thanks

License

This software is licensed under the BSD 3-clause license. If you would like to use this software under the terms of a different license agreement, please contact us.