Page 1 of 1

Automatic propeller test

Posted: Thu Jul 25, 2019 10:00 am
by crazyminecuber
Hi!
I want to imitate the propeller test in the console in cfclient. However i want to be able to write a python script that does that. I thought it would be as easy as setting that parameter like this.

Code: Select all

scf.cf.param.set_value('health.startPropTest', '1')
However nothing appear to happen. I have digged a little bit in the code for cfclient but have been unable to find something useful. Anyone got any ideas?

Re: Automatic propeller test

Posted: Fri Jul 26, 2019 7:50 am
by kimberly
Hi!

Have you tried something like this (change the URI to your crazyflies' URI):

Code: Select all

import time
import logging

import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.crazyflie.param import Param

URI = 'radio://0/56/2M/E7E7E7E706'

# Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)


if __name__ == '__main__':
    # Initialize the low-level drivers (don't list the debug drivers)
    cflib.crtp.init_drivers(enable_debug_driver=False)

    with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
       scf.cf.param.request_update_of_all_params()
       scf.cf.param.set_value('health.startPropTest', '1')
       time.sleep(5)
This seems to work for me to initialize the motor health test.

Re: Automatic propeller test

Posted: Mon Jul 29, 2019 7:25 am
by crazyminecuber
Thanks a lot! It did not work immediately for me but if Iadded a delay between the parameter-update and parameter-set, it works. Do you know of a way to print the same data that the real prop test does i.e.

Code: Select all

STAB: Acc noise floor variance X+Y:0.005075, (Z:0.002433)
STAB: Motor M1 variance X+Y:0.159692 (Z:0.678977)
STAB: Motor M2 variance X+Y:3.666144 (Z:16.641471)
STAB: Motor M3 variance X+Y:2.062783 (Z:2.178436)
STAB: Motor M4 variance X+Y:1.124510 (Z:0.959228)
STAB: Propeller test on M2 [FAIL]. low: 0.0, high: 2.50, measured: 3.66
?

Re: Automatic propeller test

Posted: Tue Jul 30, 2019 8:52 am
by kristoffer
To get the text for the console you would have to set up the console logging which is a bit tricky. I would recommend to take a look in the python client source code if you are interested in this.

Otherwise I have added log variables that you can use to get the result of the test, see https://github.com/bitcraze/crazyflie-f ... issues/448
Simply set up a subscription to health.motorPass and check bits 0-3. 0=FAIL, 1=OK
When the test is finished, bit 7 is set to 1

The accelerometer variances are available in motorVarXM1, motorVarYM1, motorVarXM2 and so on