PolarRobotics / PolarRobotics/PR-ESPIDFCodebase
Refactor Quarterback code to combine the base and the turret
- Dominant language
- C++
- Stars
- 9
- Forks
- 1
- Avg merge
- 14m
- Merged PRs (30d)
- 3
Description
The Quarterback base and the Quarterback turret are being combined, and the goal is for the entire Quarterback to use a single ESP32, instead of 4. The ESP NOW communication will no longer be used, so any code related to it can be safely discarded.
There are if statements in the main loop that change the behavior if it is a QuarterbackTurret, as the QuarterbackTurret does not have any drive-related code. These if statements should be checked and if they are no longer needed, discarded.
The new single Quarterback will have 2 serial motors (the drive motors, which need only 1 pin dedicated for serial, TX2) and 5 PWM motors for the top motors. This means that with the new BotTypes configuration (differentiating BotTypes if they are serial or PWM drive) it will be considered a Serial robot, because that's what the drive wheels are. It should have combined controls from both the QuarterbackBase and QuarterbackTurret types. Since QuarterbackBase is basically just a glorified lineman, we should consider it's controls first and then add the turret controls on top.
Other pins are needed to read an input from the magnetometer, and another pin is needed to possibly read from a limit switch, and 2 pins are possibly needed for reading from an encoder for reading the turret heading relative to base. The new pins are listened in the ESP Pin Reference.
New Controls
The new Quarterback V3 controls are as follows (from the documentation:
Tasks
Quarterback V3 Controls
Turret Mode
| Stick | Action | Function |
|---|---|---|
| Left Y-Axis | Absolute Analog Flywheel Speed Control | setFlywheelSpeed |
| Right X-Axis | Aim Turret (Left = CCW, Right = CW) | moveTurret |
Driving Mode
| Stick | Action | Function |
|---|---|---|
| Left Y-Axis | Forward/Backward Movement (X/Y Axes) | drive->setStickPwr |
| Right X-Axis | Turning/Rotational Movement (Z Axis) | drive->setStickPwr |
Buttons (work in either mode)
| Button | Action | Function |
|---|---|---|
| PlayStation | Turn on Controller | (built-in) |
| Touchpad | Emergency Stop | drive->emergencyStop |
| Options | Change LEDs (Offense/Defense) | switchTackleSensor |
| Share | Toggle Auto/Manual Targeting | switchMode |
| D-Pad Up | Increase Flywheel Speed | adjustFlywheelSpeedStage |
| D-Pad Down | Decrease Flywheel Speed | adjustFlywheelSpeedStage |
| Triangle | Intake Ball from Mecanum Center | loadFromCenter |
| Cross | Handoff to Running Back | handoff |
| Square | Toggle DRIVING / TURRET Stick Modes | setEnabled |
| Circle | Startup and Zero Turret | reset, zeroTurret |
| Right Button (R1) | Target Receiver 2 | switchTarget, switchMode |
| Right Trigger (R2) | Launch (cradle forward) | moveCradle |
| Left Button (L1) | Target Receiver 1 | switchTarget, switchMode |
- Make a new bot type just called "Quarterback"
- Remove QuarterbackBase and QuarterbackTurret and combine functions into a new file Quarterback
- Remove all code related to Scan and Score (this included any automatic targeting code)
- Remove the if statements in
main_robot.cppthat are based on if thebotTypeis the QuarterbackTurret, since it will now never be a QuarterbackTurret. - Change the class name and combine the headers, but keep the code within the functions identical to how it was before (unless there are conflicting functions, which shouldn't be the case)
- Make Quarterback a serial drive robot
- Implement new controls
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.