output finally works

forgot to set standard values for controller when it's not connected
This commit is contained in:
2025-03-31 13:23:48 +02:00
parent 5c10f8fbfc
commit cfa8a9d74e

View File

@@ -283,10 +283,10 @@ DSM1024 DSM;
// Must match the sender structure // Must match the sender structure
typedef struct struct_message typedef struct struct_message
{ {
int PWMCH1; int PWMCH1 = 1500;
int PWMCH2; int PWMCH2 = 1500;
int PWMCH3; int PWMCH3 = 1500;
int PWMCH4; int PWMCH4 = 1500;
} struct_message; } struct_message;
// Create a struct_message called myData // Create a struct_message called myData
@@ -477,12 +477,12 @@ void loop()
// Print data at 100hz (uncomment one at a time for troubleshooting) - SELECT ONE: // Print data at 100hz (uncomment one at a time for troubleshooting) - SELECT ONE:
// printRadioData(); //Prints radio pwm values (expected: 1000 to 2000) // printRadioData(); //Prints radio pwm values (expected: 1000 to 2000)
// printDesiredState(); //Prints desired vehicle state commanded in either degrees or deg/sec (expected: +/- maxAXIS for roll, pitch, yaw; 0 to 1 for throttle) // printDesiredState(); //Prints desired vehicle state commanded in either degrees or deg/sec (expected: +/- maxAXIS for roll, pitch, yaw; 0 to 1 for throttle)
printGyroData(); //Prints filtered gyro data direct from IMU (expected: ~ -250 to 250, 0 at rest) // printGyroData(); //Prints filtered gyro data direct from IMU (expected: ~ -250 to 250, 0 at rest)
printAccelData(); // Prints filtered accelerometer data direct from IMU (expected: ~ -2 to 2; x,y 0 when level, z 1 when level) // printAccelData(); // Prints filtered accelerometer data direct from IMU (expected: ~ -2 to 2; x,y 0 when level, z 1 when level)
// printMagData(); //Prints filtered magnetometer data direct from IMU (expected: ~ -300 to 300) // printMagData(); //Prints filtered magnetometer data direct from IMU (expected: ~ -300 to 300)
printRollPitchYaw(); //Prints roll, pitch, and yaw angles in degrees from Madgwick filter (expected: degrees, 0 when level) // printRollPitchYaw(); //Prints roll, pitch, and yaw angles in degrees from Madgwick filter (expected: degrees, 0 when level)
printPIDoutput(); //Prints computed stabilized PID variables from controller and desired setpoint (expected: ~ -1 to 1) // printPIDoutput(); //Prints computed stabilized PID variables from controller and desired setpoint (expected: ~ -1 to 1)
// printMotorCommands(); //Prints the values being written to the motors (expected: 120 to 250) printMotorCommands(); //Prints the values being written to the motors (expected: 120 to 250)
// printServoCommands(); //Prints the values being written to the servos (expected: 0 to 180) // printServoCommands(); //Prints the values being written to the servos (expected: 0 to 180)
// printLoopRate(); //Prints the time between loops in microseconds (expected: microseconds between loop iterations) // printLoopRate(); //Prints the time between loops in microseconds (expected: microseconds between loop iterations)
// printDebugInfo(); //PWM 1 and 5 + Armed condition // printDebugInfo(); //PWM 1 and 5 + Armed condition
@@ -894,7 +894,7 @@ void calibrateAttitude()
Madgwick(GyroX, -GyroY, -GyroZ, -AccX, AccY, AccZ, MagY, -MagX, MagZ, dt); Madgwick(GyroX, -GyroY, -GyroZ, -AccX, AccY, AccZ, MagY, -MagX, MagZ, dt);
loopRate(2000); // do not exceed 2000Hz loopRate(2000); // do not exceed 2000Hz
} }
}
void Madgwick(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz, float invSampleFreq) void Madgwick(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz, float invSampleFreq)
{ {