ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.02k stars 17.57k forks source link

SITL: add correct battery estimator from vehicle type #10050

Open khancyr opened 5 years ago

khancyr commented 5 years ago

Feature request

Is your feature request related to a problem? Please describe. Following https://github.com/ArduPilot/ardupilot/pull/9900, we should create a correct way to implement battery consumption on SITL : Maybe with a battery object in SITL and with model of consumption on each vehicle backend.

Platform [ X] All [ ] AntennaTracker [ ] Copter [ ] Plane [ ] Rover [ ] Submarine

ongspxm commented 5 years ago

i would like work on this, is this still required?

From the code change in #9900 on libraries/AP_HAL_SITL/SITL_State.cpp and recommended approach for this, we should have a battery object that returns right throttle value dependent on the vehicle type.

Did i get the approach right?

khancyr commented 5 years ago

hello, yes this is still require ! We should do it step by step. The first one would be to have battery object in SITL, then each vehicle could implement its correct consumption based on motors output requested. Then we could improve the battery, adding new chemistry (lipo, NICD, lead battery, etc), custom discharge rate, temperature, etc etc.

ongspxm commented 5 years ago

Yep, i would like to work on this, i will first add a battery object in SITL.

ongspxm commented 5 years ago

I have explored creating a SIM_Battery, like that of SIM_Sprayer and SIM_Parachute.

But the function to calculate the the servo voltage (float get_servo_voltage()), I have plans to make it a function in SIM_Aircraft that can be overriden.

Is this the right track?

Also, one last thing, i have searched all over, and it seems like the battery voltage and current is used to set the simulated pin out. Is there anyplace where the battery level is lowered in the SITL, might have missed something.

ongspxm commented 5 years ago

pr open

ongspxm commented 5 years ago

@khancyr any update for this?

ongspxm commented 5 years ago

haha, any updates?

hendjoshsr71 commented 3 years ago

@khancyr should this one still be open? There is a sim_battery now. But I think there is still work to be done for vehicle type's other than multicopter?

khancyr commented 3 years ago

We got a proper SITL backend now, but it would deserve some work to be adapted to each vehicles type. So I think we could leave it open as that a good issue for newcomeers

hendjoshsr71 commented 3 years ago

Great! So as an update the things that still need to done for this issue:

Add the battery backend and an appropriate model to the following using SIM_MultiCopter.cpp as a guide

Badrivishal commented 1 year ago

I would like to contribute to this. Could you guide me on how? Thank you!

Badrivishal commented 1 year ago

I have made the changes for SIM_Plane here is the pull request,

23256

Please guide me if I am going in the correct direction.

peterbarker commented 1 month ago

@hendjoshsr71 could you evaluate this, please?