1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-16 15:17:23 +00:00

fixed servo center and initialized both lc and lc_processed

This commit is contained in:
bpmcgeeney 2021-11-22 14:04:10 -07:00
parent 166b8c5920
commit 71170e8985
3 changed files with 19 additions and 15 deletions

View File

@ -46,7 +46,8 @@
"chrono": "cpp", "chrono": "cpp",
"ratio": "cpp", "ratio": "cpp",
"thread": "cpp", "thread": "cpp",
"string_view": "cpp" "string_view": "cpp",
"*.tcc": "cpp"
}, },
"C_Cpp.clang_format_fallbackStyle": "LLVM", "C_Cpp.clang_format_fallbackStyle": "LLVM",
"editor.formatOnSave": true, "editor.formatOnSave": true,

View File

@ -52,11 +52,11 @@ void testGimbal(PWMServo &yaw, PWMServo &pitch) {
// Servo 1 Test // Servo 1 Test
for (servoTest = 0; servoTest < 7; servoTest += 1) { for (servoTest = 0; servoTest < 7; servoTest += 1) {
yaw.write(yaw_conv(90 + servoTest)); yaw.write(yaw_conv(servoTest));
delay(30); delay(30);
} }
for (servoTest = 7; servoTest >= 1; servoTest -= 1) { for (servoTest = 7; servoTest >= 1; servoTest -= 1) {
yaw.write(yaw_conv(90 + servoTest)); yaw.write(yaw_conv(servoTest));
delay(30); delay(30);
} }
@ -64,11 +64,11 @@ void testGimbal(PWMServo &yaw, PWMServo &pitch) {
// Servo 2 Test // Servo 2 Test
for (servoTest = 0; servoTest < 7; servoTest += 1) { for (servoTest = 0; servoTest < 7; servoTest += 1) {
pitch.write(pitch_conv(90 + servoTest)); pitch.write(pitch_conv(servoTest));
delay(30); delay(30);
} }
for (servoTest = 7; servoTest >= 1; servoTest -= 1) { for (servoTest = 7; servoTest >= 1; servoTest -= 1) {
pitch.write(pitch_conv(90 + servoTest)); pitch.write(pitch_conv(servoTest));
delay(30); delay(30);
} }
@ -76,13 +76,13 @@ void testGimbal(PWMServo &yaw, PWMServo &pitch) {
// Servo 1 & 2 Test // Servo 1 & 2 Test
for (servoTest = 0; servoTest < 7; servoTest += 1) { for (servoTest = 0; servoTest < 7; servoTest += 1) {
yaw.write(yaw_conv(90 + servoTest)); yaw.write(yaw_conv(servoTest));
pitch.write(pitch_conv(90 + servoTest)); pitch.write(pitch_conv(servoTest));
delay(30); delay(30);
} }
for (servoTest = 7; servoTest >= 1; servoTest -= 1) { for (servoTest = 7; servoTest >= 1; servoTest -= 1) {
yaw.write(yaw_conv(90 + servoTest)); yaw.write(yaw_conv(servoTest));
pitch.write(pitch_conv(90 + servoTest)); pitch.write(pitch_conv(servoTest));
delay(30); delay(30);
} }
@ -130,10 +130,15 @@ void initLoadCells(Vehicle &State) {
Serial.println("Load Cells Initialized"); Serial.println("Load Cells Initialized");
// Initializes State variables // Initializes State variables
State.lc0 = 9.81 * 0.001 * lc0.get_value() / lcGain0; State.lc0 = lc0.get_value();
State.lc1 = 9.81 * 0.001 * lc1.get_value() / lcGain1; State.lc1 = lc1.get_value();
State.lc2 = 9.81 * 0.001 * lc2.get_value() / lcGain2; State.lc2 = lc2.get_value();
State.lc3 = 9.81 * 0.001 * lc3.get_value() / lcGain3; State.lc3 = lc3.get_value();
State.lc0_processed = 9.81 * 0.001 * lc0.get_value() / lcGain0;
State.lc1_processed = 9.81 * 0.001 * lc1.get_value() / lcGain1;
State.lc2_processed = 9.81 * 0.001 * lc2.get_value() / lcGain2;
State.lc3_processed = 9.81 * 0.001 * lc3.get_value() / lcGain3;
} }
void initFile() { void initFile() {

View File

@ -57,8 +57,6 @@ void setup() {
initFile(); initFile();
// PLACE BUTTON HERE---------------------------------------------
initTime = micros(); initTime = micros();
} }