Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev/quarterback into dev/experimental #106

Open
wants to merge 95 commits into
base: dev/experimental
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
5618b80
updated qb positions, imported mecanum center data
RyzenFromFire Jan 25, 2024
711ea97
outline qb turret class
RyzenFromFire Jan 25, 2024
dccc88c
outline quarterback functions
RyzenFromFire Feb 1, 2024
1c800dd
start qb stage array
RyzenFromFire Feb 6, 2024
97242f5
added fields
RyzenFromFire Feb 6, 2024
1b9a6a0
add manual override state var
RyzenFromFire Feb 6, 2024
f305da1
Flywheel Functions
a-nelson6 Feb 6, 2024
56a1067
Merge branch 'dev/quarterback' of https://github.com/PolarRobotics/ES…
a-nelson6 Feb 6, 2024
bfee22b
prototype of qb code
RyzenFromFire Feb 6, 2024
3bf4b48
add remaining def stubs
RyzenFromFire Feb 8, 2024
c33d407
cradle actuator
RyzenFromFire Feb 8, 2024
c39e7e6
cradleActuator.write
a-nelson6 Feb 8, 2024
8384377
prototype QB integration
RyzenFromFire Feb 15, 2024
1a32dd2
qb integration part 2
RyzenFromFire Feb 15, 2024
d3fec6a
fix bot name idx error + update ver str
RyzenFromFire Feb 15, 2024
c273d1a
nah, I'd NPE
RyzenFromFire Feb 15, 2024
7c1c9df
start for debug, need to figure out why motor won't turn
RyzenFromFire Feb 15, 2024
e8d1529
fixed turret movement
RyzenFromFire Feb 16, 2024
5213ef1
critical fix, minor additions and revisions
RyzenFromFire Feb 17, 2024
febc9f0
laser go brr
RyzenFromFire Feb 17, 2024
4f10f60
minor updates
RyzenFromFire Feb 17, 2024
98268db
loadFromCenter and handoff
a-nelson6 Feb 17, 2024
ec7510d
setup for macro blocking
RyzenFromFire Feb 17, 2024
e2c68f2
qb encoder pins
RyzenFromFire Feb 17, 2024
f003c9d
started debouncer class
RyzenFromFire Feb 17, 2024
2ac7415
change laser pin
RyzenFromFire Feb 19, 2024
92c1fe5
qb-laser
a-nelson6 Feb 22, 2024
55bcf1a
debouncer work
RyzenFromFire Feb 22, 2024
eb8cbc8
Undo change to bot index
RyzenFromFire Feb 22, 2024
82067d5
fix debouncer
RyzenFromFire Feb 27, 2024
043f90d
debounce working
RyzenFromFire Feb 27, 2024
66ce1e8
qb debounced
RyzenFromFire Feb 27, 2024
a272567
Merge branch 'dev/quarterback' into dev/quarterback-laser
RyzenFromFire Feb 27, 2024
8ee491f
Merge pull request #73 from PolarRobotics/dev/quarterback-laser
RyzenFromFire Feb 27, 2024
a86c3a3
cradle fixes
RyzenFromFire Feb 27, 2024
c0e31d0
uncomment laser debug
RyzenFromFire Feb 29, 2024
1ee728d
flywheel constraints
RyzenFromFire Feb 29, 2024
19a0cf8
fix laser input
RyzenFromFire Feb 29, 2024
43ad795
zeroTurret
a-nelson6 Feb 29, 2024
97c1aa3
fix turret
RyzenFromFire Feb 29, 2024
0a6dfe8
fix turret homing
RyzenFromFire Mar 5, 2024
ccda020
turret count work
RyzenFromFire Mar 5, 2024
6f9b26f
various fixes
RyzenFromFire Mar 7, 2024
e618c7d
work on turret position control
RyzenFromFire Mar 7, 2024
064eb84
refactor estop/enable-disable functions
RyzenFromFire Mar 7, 2024
5241f98
added position control for turret
RyzenFromFire Mar 7, 2024
7e4d6ac
Merge branch 'dev/main' into dev/quarterback
rdavies02 Mar 10, 2024
c3a9b94
merged dev/main changes in, Quarterback base plate driving
rdavies02 Mar 10, 2024
4264c32
fix imminent npe
RyzenFromFire Mar 18, 2024
ecd89f5
make double float
RyzenFromFire Mar 18, 2024
ebdcedc
return speed control to stick, working on handoff
RyzenFromFire Mar 18, 2024
d1c4868
working on turret
RyzenFromFire Mar 19, 2024
94c3e4f
add `moveTurretAndWait()`
RyzenFromFire Mar 19, 2024
014523b
zero prototype
RyzenFromFire Mar 21, 2024
7ffe809
fix dec
RyzenFromFire Mar 22, 2024
d928918
zeroing is pretty okay
RyzenFromFire Mar 23, 2024
c528de3
add slop handling
RyzenFromFire Mar 26, 2024
8309c2a
docs and move
RyzenFromFire Mar 26, 2024
4639bd6
wrong default arg place
RyzenFromFire Mar 27, 2024
1d2ca01
qb testing and repin
RyzenFromFire Apr 1, 2024
40135b9
qb accuracy
RyzenFromFire Apr 2, 2024
bdf142d
minor changes for qb
RyzenFromFire Apr 4, 2024
8a6ed20
Magnetometer fully implemented, turret angle is accessed through new …
Tw1ZZLER Apr 4, 2024
c917346
Merge branch 'dev/quarterback' of https://github.com/PolarRobotics/ES…
Tw1ZZLER Apr 4, 2024
ecd2612
Changed turretAngle from float to int16_t
Tw1ZZLER Apr 4, 2024
3cf052a
Quick change to serial print
Tw1ZZLER Apr 4, 2024
511da01
rename turretAngle
RyzenFromFire Apr 4, 2024
f0bb5aa
updated pins
RyzenFromFire Apr 4, 2024
a218fb4
Magnetometer Homing Changes (V1)
Stonegoblin9 Apr 7, 2024
5323151
P Kinda Works
Stonegoblin9 Apr 8, 2024
20ea57d
Commit now
Stonegoblin9 Apr 8, 2024
c323762
changed a few values
Stonegoblin9 Apr 8, 2024
00e11e1
minor qb fixes
RyzenFromFire Apr 9, 2024
8d52ee7
comment out magnetometer temporarily
RyzenFromFire Apr 9, 2024
43ce66f
Removed Mag functions and commented
Stonegoblin9 Apr 9, 2024
0e2c1b3
Something is wrong still
Stonegoblin9 Apr 10, 2024
a7b137d
Removed magnetometer and made spin faster
Stonegoblin9 Apr 10, 2024
588cf5a
Tried to make the stick less sensitive for the hold steady code
Stonegoblin9 Apr 19, 2024
3d4fe47
qb improvements
RyzenFromFire Apr 23, 2024
5817d59
attempt to zero magnetometer to front of robot
Stonegoblin9 Apr 19, 2024
6a41a28
this kind of homes mostly to the correct position
RyzenFromFire Apr 25, 2024
f176c1f
Imported WiFi code from PR-Sandbox into Quarterback.cpp
Tw1ZZLER Apr 30, 2024
4ed9327
Implemented setDriveObj function (broken)
Tw1ZZLER Apr 30, 2024
f3d7fd9
Revert "Implemented setDriveObj function (broken)"
Stonegoblin9 May 1, 2024
87603f8
moved QB base functionality to new class
Stonegoblin9 May 2, 2024
47b40a0
Kinda works
Stonegoblin9 May 2, 2024
d8e523e
.
Stonegoblin9 May 2, 2024
0430617
UART Update
Stonegoblin9 May 14, 2024
5ef4470
UART Update
Stonegoblin9 May 14, 2024
7c7be00
UART
Stonegoblin9 May 14, 2024
ea124ad
Turret Speed Limiting
Stonegoblin9 May 14, 2024
343d7ef
comments
Stonegoblin9 May 14, 2024
76f1a94
Commenting Update
Stonegoblin9 May 14, 2024
722017c
Merge pull request #85 from PolarRobotics/dev/quarterback-wifi
RyzenFromFire May 14, 2024
6b1883e
Fixed compilation issues with FastLed
rdavies02 Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 41 additions & 40 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,54 @@ board = nodemcu-32s
board_build.mcu = esp32
upload_protocol = esptool
lib_deps =
fastled/FastLED@^3.5.0
https://github.com/PolarRobotics/PR-Lib.git
fastled/FastLED @ ~3.6.0
https://github.com/PolarRobotics/PR-Lib.git
adafruit/Adafruit LIS3MDL@^1.2.4

[env:robot]
build_src_filter =
+<*>
-<Pairing/depairingStation.cpp>
-<Pairing/getAddress.cpp>
-<Robot/Quarterback_old.cpp>
-<Utilities/ReadBotInfo.cpp>
-<Utilities/WriteBotInfo.cpp>
build_src_filter =
+<*>
-<Pairing/depairingStation.cpp>
-<Pairing/getAddress.cpp>
-<Robot/Quarterback_old.cpp>
-<Utilities/ReadBotInfo.cpp>
-<Utilities/WriteBotInfo.cpp>

[env:depairing]
build_src_filter =
-<*>
+<PolarRobotics.h>
+<Pairing/depairingStation.cpp>
+<Pairing/pairing.h>
+<Pairing/pairing.cpp>
+<Robot/builtInLED.h>
+<Robot/builtInLED.cpp>
+<Robot/Lights.h>
+<Robot/Lights.cpp>
-<*>
+<PolarRobotics.h>
+<Pairing/depairingStation.cpp>
+<Pairing/pairing.h>
+<Pairing/pairing.cpp>
+<Robot/builtInLED.h>
+<Robot/builtInLED.cpp>
+<Robot/Lights.h>
+<Robot/Lights.cpp>

[env:write_bot_info]
build_flags = -D CFG_WRITABLE=1
build_src_filter =
-<*>
+<PolarRobotics.h>
+<Utilities/WriteBotInfo.cpp>
+<Utilities/BotTypes.h>
+<Utilities/BotTypes.cpp>
+<Utilities/MotorTypes.h>
+<Utilities/MotorTypes.cpp>
+<Utilities/Pair.h>
+<Utilities/ConfigManager.h>
+<Utilities/ConfigManager.cpp>
build_src_filter =
-<*>
+<PolarRobotics.h>
+<Utilities/WriteBotInfo.cpp>
+<Utilities/BotTypes.h>
+<Utilities/BotTypes.cpp>
+<Utilities/MotorTypes.h>
+<Utilities/MotorTypes.cpp>
+<Utilities/Pair.h>
+<Utilities/ConfigManager.h>
+<Utilities/ConfigManager.cpp>

[env:read_bot_info]
build_src_filter =
-<*>
+<PolarRobotics.h>
+<Utilities/ReadBotInfo.cpp>
+<Utilities/BotTypes.h>
+<Utilities/BotTypes.cpp>
+<Utilities/MotorTypes.h>
+<Utilities/MotorTypes.cpp>
+<Utilities/Pair.h>
+<Utilities/ConfigManager.h>
+<Utilities/ConfigManager.cpp>
build_src_filter =
-<*>
+<PolarRobotics.h>
+<Utilities/ReadBotInfo.cpp>
+<Utilities/BotTypes.h>
+<Utilities/BotTypes.cpp>
+<Utilities/MotorTypes.h>
+<Utilities/MotorTypes.cpp>
+<Utilities/Pair.h>
+<Utilities/ConfigManager.h>
+<Utilities/ConfigManager.cpp>
14 changes: 13 additions & 1 deletion src/Drive/Drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Drive::Drive(BotType botType, MotorType motorType, drive_param_t driveParams, bo
this->R_Min = driveParams.r_min;
this->R_Max = driveParams.r_max;

if (botType == quarterback) {
if (botType == quarterback_old) {
this->BIG_BOOST_PCT = 0.8;
this->BIG_NORMAL_PCT = 0.4;
this->BIG_SLOW_PCT = 0.3;
Expand Down Expand Up @@ -440,5 +440,17 @@ void Drive::update() {

M1.write(requestedMotorPower[0]);
M2.write(requestedMotorPower[1]);

trackingMotorPower[0] = requestedMotorPower[0];
trackingMotorPower[1] = requestedMotorPower[1];
}

int Drive::getMotorWifiValue(int motorRequested) {
int valueToReturn = 0;
if (motorRequested >= 0 && motorRequested < NUM_MOTORS) {
float value = trackingMotorPower[motorRequested] * 100;
valueToReturn = value;
}
return valueToReturn;
}

2 changes: 2 additions & 0 deletions src/Drive/Drive.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Drive {
float turnPower;

float requestedMotorPower[NUM_MOTORS];
float trackingMotorPower[NUM_MOTORS];
float lastRampPower[NUM_MOTORS];
float turnMotorValues[NUM_MOTORS];

Expand Down Expand Up @@ -128,6 +129,7 @@ class Drive {
void printSetup();
virtual void printDebugInfo();
virtual void printCsvInfo();
int getMotorWifiValue(int motorRequested);

//* The following variables are initialized in the constructor
// maximum speed for these is 1.0
Expand Down
6 changes: 3 additions & 3 deletions src/PolarRobotics.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Utilities/MotorTypes.h>
#include <Utilities/DriveParameters.h>

#define PR_CODEBASE_VERSION "2.3.2 @ production"
#define PR_CODEBASE_VERSION "2.4.0 @ dev/quarterback"

// [PIN DECLARATIONS]
// please follow:
Expand All @@ -36,8 +36,8 @@
// Encoder pin definitions
#define ENC1_CHA 35
#define ENC1_CHB 34
#define ENC2_CHA VP
#define ENC2_CHB VN
#define ENC2_CHA 36 // VP
#define ENC2_CHB 39 // VN

// pin for ws2812 LEDs to indicate positions
#define LED_PIN 4
Expand Down
3 changes: 2 additions & 1 deletion src/Robot/Quarterback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,5 @@ void Quarterback::changeFWSpeed(SpeedStatus speed) {

lastDBFWChange = millis();
}
}
}

29 changes: 29 additions & 0 deletions src/Robot/QuarterbackBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "QuarterbackBase.h"

//This for some reason has to be declared in the .cpp file and not the .h file so that it does not conflict with the same declaration in other .h files
HardwareSerial Uart_Base(2); // UART2

QuarterbackBase::QuarterbackBase(Drive* drive) {
this->drive = drive;

// Setup digital WiFi pin
pinMode(WIFI_PIN, OUTPUT);

//Setup UART Pins
Uart_Base.begin(115200, SERIAL_8N1, RX2, TX2);
}

void QuarterbackBase::action() {
// Send data to wifi ESP
updateWriteMotorValues();
}

void QuarterbackBase::updateWriteMotorValues() {
motor1Value = drive->getMotorWifiValue(0);
motor2Value = drive->getMotorWifiValue(1);
UARTMessage = String(motor1Value) + "&" + String(motor2Value);
UARTMessage = UARTMessage + "~";
Uart_Base.print(UARTMessage);
//Serial.print("Sent Message To ESP: ");
Serial.println(UARTMessage);
}
44 changes: 44 additions & 0 deletions src/Robot/QuarterbackBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#ifndef QUARTERBACK_BASE_H
#define QUARTERBACK_BASE_H

#include <Robot/Robot.h>
#include <Robot/MotorControl.h>
#include <Drive/Drive.h>

// Wifi Connectivity Pin
#define WIFI_PIN 18

//UART Pins
#define RX2 16
#define TX2 17

#include <HardwareSerial.h>


/**
* @brief Quarterback Base Subclass Header
* @authors Max Phillips, George Rak, Corbin Hibler
*/
class QuarterbackBase : public Robot {
private:

Drive* drive;

/* VARIABLES FOR WIFI CONNECTIVITY
- motor1Value motor2Value: The current drive motor values
- UARTMessage: The string version of the message to send from the base of the QB to it's server ESP also mounted on the base
*/
int motor1Value = 0;
int motor2Value = 0;
String UARTMessage = "";

public:
QuarterbackBase (Drive* drive);
void action() override; //! robot subclass must override action
void updateWriteMotorValues();
void bottomQBSetup();
};

#endif // QUARTERBACK_H
Loading