I'd like to know if it's possible to check the energy consumption of the drone? (after it covers a certain path, let's say). I'd like to use this information for path planning.
Just a very high level idea: I believe the drones in AirSim are modeled with the DJI E300 (2212) motors and the GWS 9X5 props in mind. There should also be a thrust calculation somewhere in the code. You should be able to relate the commanded throttle to the thrust, and subsequently to motor current through the thrust vs throttle and current vs thrust curves from the motor datasheets. Of course, this would be approximate and only for the motors.
EDIT: Just to add to sytelus's comment below, I believe the constant in the power equation comes out to be

where

I would suggest to look in to this introduction, page 3. The power consumed by a rotor is given by (torque * angular velocity * constant). These quantities are available in this function so you can easily compute power consumed per rotor. Then in this function you can sum total power consumed by all rotors + add some fixed amount for onboard electronics.
PS: Would love to get pull request if you add this feature :)
Hi, I was trying to calculate battery consumption of the drone, following the tip given by @sytelus . I could not find a way to access in code the info required to the calculations (torque, angular velocity) present in this file using the API or any other method.
Do you have a solution for this problem?
Closed due to inactivity. Doc update pending
Most helpful comment
I would suggest to look in to this introduction, page 3. The power consumed by a rotor is given by (torque * angular velocity * constant). These quantities are available in this function so you can easily compute power consumed per rotor. Then in this function you can sum total power consumed by all rotors + add some fixed amount for onboard electronics.
PS: Would love to get pull request if you add this feature :)