bitcraze / crazyflie-firmware

The main firmware for the Crazyflie Nano Quadcopter, Crazyflie Bolt Quadcopter and Roadrunner Positioning Tag.
GNU General Public License v3.0
1.21k stars 1.06k forks source link

Propeller test not reporting motorPass #1430

Open ttolbol opened 4 weeks ago

ttolbol commented 4 weeks ago

I am trying to get the automatic propeller test to work. I am using python cflib and doing the following:

cflib.crtp.init_drivers()
scf = SyncCrazyflie(uri, cf=Crazyflie(rw_cache="./cache"))
scf.open_link()
log_config = LogConfig(name="Motor Health", period_in_ms=100)
log_config.add_variable("health.motorPass", "uint8_t")
with SyncLogger(scf, log_config) as logger:
    scf.cf.param.set_value("health.startPropTest", "1")
    for log_entry in logger:
        print(log_entry[1])

I am getting {'health.motorPass': 0} despite all 4 propellers being on. When doing the test, two of the propellers spin, then I get 4 beeps (like when powering on the CF), followed by a repeating pattern of 4 quick red blinks and a pause.

tobbeanton commented 3 weeks ago

Perhaps there is something not working when running it from a script. Do you get the same behaviour if you launch the test from the cfclient->console tab?

ttolbol commented 3 weeks ago

Same behavior. This is what I'm getting:

SYS: ----------------------------
SYS: Crazyflie 2.1 is up and running!
SYS: Build 0:80ee72ad480a (2024.10) CLEAN
SYS: I am 0x203035545131500700400018 and I have 1024KB of flash!
CFGBLK: v1, verification [OK]
DECK_CORE: 1 deck(s) found
DECK_CORE: Calling INIT on driver bcLighthouse4 for deck 0
IMU: BMI088: Using I2C interface.
IMU: BMI088 Gyro connection [OK].
IMU: BMI088 Accel connection [OK]
IMU: BMP388 I2C connection [OK]
ESTIMATOR: Using Kalman (2) estimator
CONTROLLER: Using PID (1) controller
MTR-DRV: Using brushed motor driver
SYS: About to run tests in system.c.
SYS: NRF51 version: 2024.10 (CF21)
EEPROM: I2C connection [OK].
STORAGE: Storage check [OK].
IMU: BMI088 gyro self-test [OK]
SYS: Self test passed!
STAB: Wait for sensor calibration...
SYS: Free heap: 16624 bytes
LHFL: Lighthouse bootloader version: 2
STAB: Starting stabilizer loop
ESTKALMAN: State out of bounds, resetting
SUP: Can not fly
SUP: Ready to fly
LHFL: Bitstream CRC32: 112BC794 [PASS]
LHFL: Firmware version 6 verified, booting deck!
HEALTH: Acc noise floor variance X+Y:0.004323, (Z:0.038787)
HEALTH: Motor M1 variance X+Y: 5.26 (Z:4.70), voltage sag:0.33
HEALTH: Motor M2 variance X+Y: 0.49 (Z:0.57), voltage sag:0.37
SYS: ----------------------------
SYS: Crazyflie 2.1 is up and running!
SYS: Build 0:80ee72ad480a (2024.10) CLEAN
ash!
CFGBLK: v1, verification [OK]
DECK_INFO: Reading deck nr:0 [FAILED]. No driver will be initialized!
DECK_CORE: 0 deck(s) found
IMU: BMI088: Using I2C interface.
IMU: BMI088 Gyro connection [OK].
IMU: BMI088 Accel connection [OK]
IMU: BMP388 I2C connection [OK]
ESTIMATOR: Using Complementary (1) estimator
CONTROLLER: Using PID (1) controller
MTR-DRV: Using brushed motor driver
SYS: About to run tests in system.c.
SYS: NRF51 version: 2024.10 (CF21)
EEPROM: I2C connection [OK].
STORAGE: Storage check [OK].
IMU: BMI088 gyro self-test [OK]
SYS: The system resumed after a failed assert [WARNING]
SYS: Assert failed at ../src/modules/src/stabilizer.c:274
SYS: cfAssertNormalStart [FAIL]

It only does M1 and M2, then restarts and gets stuck at assert fail.

ttolbol commented 3 weeks ago

Interestingly it does not find the lighthouse deck after restarting.

ttolbol commented 3 weeks ago

The assertion is here:

void rateSupervisorTask(void *pvParameters) {
  while (1) {
    // Wait for the semaphore to be given by the stabilizerTask
    if (xSemaphoreTake(xRateSupervisorSemaphore, M2T(2000)) == pdTRUE) {
      // Validate the rate
      if (!rateSupervisorValidate(&rateSupervisorContext, xTaskGetTickCount())) {
        if (!rateWarningDisplayed) {
          DEBUG_PRINT("WARNING: stabilizer loop rate is off (%lu)\n", rateSupervisorLatestCount(&rateSupervisorContext));
          rateWarningDisplayed = true;
        }
      }
    } else {
      // Handle the case where the semaphore was not given within the timeout
      DEBUG_PRINT("ERROR: stabilizerTask is blocking\n");
      ASSERT(false); // For safety, assert if the stabilizer task is blocking to ensure motor shutdown
    }
  }
}

Any insight on how to fix it is greatly appreciated.

tobbeanton commented 2 weeks ago

Ahhh, this has been fixed in this PR. If you flash the latest release 2024.10.2 it should work again.

tobbeanton commented 2 weeks ago

Fixed in https://github.com/bitcraze/crazyflie-firmware/pull/1432

tobbeanton commented 2 weeks ago

I was way to fast. The PR does not fix this issue.