Robot code for 2023 FRC season
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 |
🔥 | 🔥 | All | 🔥 🔥 🔥 | Operator control box missile switch |
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://172.22.11.2 -USB only
- ftp://roborio-1756-frc.local -USB, Wifi, or Ethernet
- ftp://10.17.56.2 -Wifi or Ethernet
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.
- When homing swerve modules figure out what is the front of the robot. The intake is the front.
- Rotate each swerve module to where each bevel gear is to the left side of the robot.
- Use something flat that is the length of the robot and line the swerve wheels up.
- 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.
- Once the homes have been set the homes will be put in a document. You will be able to open up the document.
- First open file explorer.
- Once you are in click in the white box at the top where you can type.
- Use one of the above FTP addresses.
- Then double click on the home folder.
- Then double click on the lvuser folder.
- Then double click on the homes folder.
- Then you can click on the swerveHomes file to see the homes of the swerve modules.
- Set up your wrist how you would like it homed. We have it where it is horizontal and the wheels are towards the ground.
- 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.
- First open file explorer.
- Once you are in click in the white box at the top where you can type.
- Use one of the above FTP addresses.
- Then double click on the home folder.
- Then double click on the lvuser folder.
- Then double click on the homes folder.
- Then you can click on the wristHomes file to see the home of the wrist.
- Set the arm to where it is perfectly horizontal over the front of the robot.
- 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.
- First open file explorer.
- Once you are in click in the white box at the top where you can type.
- Use one of the above FTP addresses.
- Then double click on the home folder.
- Then double click on the lvuser folder.
- Then double click on the homes folder.
- Then you can click on the shoulderHomes file to see the home of the shoulder.
- Set arm to be in back n-stop position. Make sure it's ALL the way back!
- Power on robot. Connect the robot to your computer, no controller is needed for this homing.
- Open File Explorer
- Click in the white space in the bar at the top
- Use one of the above FTP addresses
- Double click on home folder
- Double click on lvuser folder
- Double click on homes folder
- Delete the extension homes file & restart code WITHOUT moving the arm extension
See vision readme for information on which pipelines to use and which indices to install these pipelines on.
Go to http://10.17.56.2:5812 while connected to the robot to update firmware or change addresses.
This project uses pre-commit to check code formatting before accepting commits.
First install the prerequisites:
-
python3 (with pip) - instructions
- Python 3.9.x from the Python website works well. Make sure to check the add to path option in the installer.
-
pip packages:
- You may need to add the pip install path to your shell's path if you're using Git Bash. In git bash:
- Open (or create) new file
~/.bashrc
by runningvim ~/.bashrc
- Add this to the end:
PATH=$PATH:$LOCALAPPDATA/Programs/Python/Python39/Scripts/
(changePython39
to match your python version)- Note: The actual path you need to add (
$LOCALAPPDATA/Programs/Python/Python39/Scripts/
in the above example) depends on your Python installation. If y ou do thepip install
steps first, pip will print the path you need to add. - To type in Vim, type i and you should see
INSERT
at the bottom of the window to indicate you're editing in insert mode
- Note: The actual path you need to add (
- Exit by pressing Esc then type
:wq
and press Enter - Run
source ~/.bashrc
to update your session
- Open (or create) new file
- wpiformat -
pip install wpiformat
- clang-format -
pip install clang-format
- pre-commit -
pip install pre-commit
Make sure to run
pip install <package>
commands in an administrator terminal if installing in windows - You may need to add the pip install path to your shell's path if you're using Git Bash. In git bash:
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.
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!
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 |
📝 Note: Wrist should start near 0° orientation (wheels up, bar down).
- Soft limit tests on extension, bash, shoulder
- Pick up & Place cone, go to High, Medium, Low
- Repeat with cube
- Bash guard deploys
- Field Centric Home
- Robot drives forward / left / back / right
- Robot turns as well
- Camera is sending data
- All fuses are in and secure
- No obvious errors in log or events list
- Check CAN devices should have: (23)
We're using the following dependencies:
- Our sponsors for the 2022 season. Thank you for your continued support
- Doxygen Awesome - for making our documentation look great
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.