Page 1 of 1

Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Sun Feb 25, 2018 10:31 pm
by Abanoub.G
Hi,
I have written a piece of python code to achieve a certain manoeuvre. The manoeuvre works absolutely fine. I am achieving the manoeuvre by sending thrust, yaw, roll, pitch values to the crazyflie for certain periods of time. However, I need to get the thrust value being sent to each motor at an instant of time through out the manoeuvre.

1) First, is this feasible?? i.e. can these values be obtained from the crazyflie throughout a manoeuvre.

2) Secondly, if this is doable, I know there is a plotter on the client but I don't know how to integrate it with my python code. How would that be ideally done??

Would really appreciate reply as soon as possible.

Regards
AG

Re: Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Mon Feb 26, 2018 1:29 pm
by arnaud
Hi,

1. Yes it is possible, there is 4 log variables in the Crazyflie for the 4 motors PWM values. They are called "pwm.m1_pwm" to "pwm.m4_pwm". The value is between 0 and 65535, 0 means 0% PWM, 65535 means 100% PWM.

2. To log variables you can look at the basicLog.py and basicLogSync.py examples in the lib example folder: https://github.com/bitcraze/crazyflie-l ... r/examples. You should be able to add the log code to your script. If you want to use the client, you can use the ZMQ interface to control the Crazyflie through the client as I explained in your other thread. With the client, using the log block tab, you can save the logged values to a csv file.

Re: Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Tue Feb 27, 2018 2:57 pm
by Abanoub.G
Hi,
Thanks a lot for the quick reply. However, I'm afraid I am finding it a bit hard to change the logv variable I want i.e. from the stabiliser to the motor ones. I have tried a couple of things but they're not working. Is it alright if you can direct me in which part of the code I can change this. Sorry I am just finding it a bit hard to spot it out of the code.

Re: Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Tue Feb 27, 2018 6:53 pm
by Abanoub.G
Also in addition to my previous question I tried looking for the name of the motor variables on the logging code in crazyflie-firmware/src/modules/src/stabilizer. There are ones for acceleration, temperature, yaw, roll etc; but there aren't any for the motor data.

Re: Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Tue Feb 27, 2018 10:35 pm
by Abanoub.G
Ok I have managed to change the motors bit.

Thanks

Re: Urgent: Plotting thrust values being sent to crazyflie while in operation

Posted: Wed Feb 28, 2018 3:32 pm
by arnaud
The motors are handled by the power distribution module: https://github.com/bitcraze/crazyflie-f ... #L118-L123