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

Discussions about all things Bitcraze
Post Reply
Abanoub.G
Beginner
Posts: 12
Joined: Mon Jan 29, 2018 3:46 pm

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

Post 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
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

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

Post 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.
Abanoub.G
Beginner
Posts: 12
Joined: Mon Jan 29, 2018 3:46 pm

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

Post 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.
Abanoub.G
Beginner
Posts: 12
Joined: Mon Jan 29, 2018 3:46 pm

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

Post 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.
Abanoub.G
Beginner
Posts: 12
Joined: Mon Jan 29, 2018 3:46 pm

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

Post by Abanoub.G »

Ok I have managed to change the motors bit.

Thanks
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

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

Post by arnaud »

The motors are handled by the power distribution module: https://github.com/bitcraze/crazyflie-f ... #L118-L123
Post Reply