Preflight Fail: Battery unhealthy

I run the machine learning on the simulation
There is QGroundControl and

roslaunch px4 mavros_posix_sitl.launch

After running 184 times flying python script on PX4-autopilot

cd px-ws/src/PX4-Autopilot/integrationtests/python_src/px4_it/mavros/
python2 mavros_offboard_posctl_test.py

There is an error “Preflight Fail: Battery unhealthy”
Then, drone cannot fly in the simulation envrinoment

The error shows in the terminal of the roslaunch px4 mavros_posix_sitl.launch

The terminal of python2 mavros_offboard_posctl_test.py shows
“failed to send arm command” and the drone cannot take off


However, the QGroundcontrol show the battery is 100%

If reopen the QGroundcontrol can get the battery error like this

Thus, the issue may be due to roslaunch px4 mavros_posix_sitl.launch

Thanks a lot

Sometimes there is the
“Preflight Fail: position estimate error”


Compass needs calibration - Land now!
Preflight Fail: Attitude failure (roll)

What I heard is that px4 is not designed to run in a learning env, which is why I switched to using OpenAI gym with ros and gazebo for the training.

1 Like

It is very helpful to clean the ~/.ros
ref: Posix Sitl vehicles don’t work correctly · Issue #18299 · PX4/PX4-Autopilot · GitHub
ref: Simulation take off motion not vertical - #4 by AlexWUrobot

but the battery issue still sometimes happens

Also the document mentioned the battery should not have a issue in the simulated environment.

ref: Simulate Failsafes | PX4 User Guide