PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.22k stars 13.39k forks source link

[Bug] The model I added to the simulation environment is not working properly. #23237

Closed serkanMzlm closed 3 months ago

serkanMzlm commented 3 months ago

Describe the bug

I added my own model and world to the PX4 Autopilot software. The model (Intel RealSense D435) works fine, but when I run it with the world model, the drone model does not load.

Depth Camera D435i model:

image

World:

image

Bug

image

To Reproduce

  1. I ran the PX4 Autopilot software in the simulation environment with my model on the default world model (it worked properly).
  2. When I tested the x500 with my own world model, it did not work properly

image

Expected behavior

I want PX4 to work properly in the world model I have prepared.

Screenshot / Media

No response

Flight Log

In the simulation environment...

Software Version

main branch

Flight controller

x500

Vehicle type

Multicopter

How are the different components wired up (including port information)

No response

Additional context

No response

xdwgood commented 3 months ago

@serkanMzlm see here:https://github.com/PX4/PX4-gazebo-models/pull/44#discussion_r1630505818

The modified drone can display normally, but I have the following two error: Unable to find file with URI [file://media/dem/data.dt2] Unable to find file with URI [file://media/dem/data.dem]

I really didn't see data.dem under the dem file.Curiously, data.dt2 exists, but it cannot be find.

serkanMzlm commented 3 months ago

@xdwgood Yes, I corrected the part with data.dem. It should indeed be data.dt2

xdwgood commented 3 months ago

image

try new,but not work

serkanMzlm commented 3 months ago

image

try new,but not work

Could you please first copy the model and necessary files to a separate directory and run 'gz sim -r'? (Don't forget to export GZ_SIM_RESOURCE_PATH)

xdwgood commented 3 months ago

Screenshot from 2024-06-07 16-06-15

serkanMzlm commented 3 months ago

@xdwgood Could you please follow the steps listed below in order?

Note: You need to install the requirements to run DEM files. sudo apt-get install gdal-bin libgdal-dev python3-gdal

# 1. Download my github page
git clone git@github.com:serkanMzlm/gz-sim.git
cd gz-sim/

# 2. set GZ_SIM_RESOURCE_PATH location
export GZ_SIM_RESOURCE_PATH=/home/${USER}/gz-sim/examples

# 3. run world
gz sim -r examples/worlds/mountain_fog.sdf 

image

serkanMzlm commented 3 months ago

Screenshot from 2024-06-07 16-06-15

You need to install the requirements to run DEM files. sudo apt-get install gdal-bin libgdal-dev python3-gdal

xdwgood commented 3 months ago

image

@serkanMzlm Thank you for your help.

xdwgood commented 3 months ago

Could we close this question now?

serkanMzlm commented 3 months ago

@xdwgood No, we cannot close this question now. The issue has not been resolved yet, particularly with the PX4 commands not working

serkanMzlm commented 3 months ago

image

@serkanMzlm Thank you for your help.

You don't have to use only the specified data. You can directly add a black and white image of any map to obtain this map :)

xdwgood commented 3 months ago

No, we cannot close this question now. The issue has not been resolved yet, particularly with the PX4 commands not working

I use this model to test the takeoff command, and the drone can take off(I can see drones taking off and rising in gazebo environment.), as shown in the following figure: Screenshot from 2024-06-11 08-47-52

But then I will encounter the following error, and then gz will stop working.

A: 0.9243 2547 -501.2 0.09919 2254 10.76 1.066 2255 10.71 -0.1081 2255 10.65 1.273 2254 10.82 -0.09417 2547 -501.4 0.0631 2546 -501.2 0.1326 2547 -501.5 0.2493 2546 -501.2 0.4691 2546 -501.1 -1.31 -1.31 -1.31 -1.31 0 0 2547 1.577e+07 1.706e+06 -2919 1.466e+07 3.642e+06 4624 1.467e+07 3.643e+06 -1882 1.467e+07 3.644e+06 3587 1.466e+07 3.641e+06 -3184 1.577e+07 1.706e+06 -3970 1.577e+07 1.705e+06 -1756 1.578e+07 1.706e+06 -2340 1.577e+07 1.705e+06 12.6 1.577e+07 1.705e+06 -4955 -4955 -4955 -4955 0 0 -501.2 1.706e+06 1.431e+07 -2137 3.653e+06 1.089e+07 3249 3.655e+06 1.09e+07 4793 3.656e+06 1.09e+07 -3681 3.651e+06 1.089e+07 574.9 1.707e+06 1.432e+07 -4682 1.705e+06 1.431e+07 798.8 1.707e+06 1.432e+07 -3104 1.705e+06 1.431e+07 61.13 1.706e+06 1.431e+07 8743 8743 8743 8743 0 0 0.09919 -2919 -2137 1.245 -2980 -2027 -0.7396 -2982 -2028 0.1748 -2982 -2029 0.3309 -2980 -2027 0.9411 -2919 -2137 1.753 -2918 -2136 0.6679 -2920 -2137 1.271 -2918 -2136 0.4604 -2918 -2136 -0.2784 -0.2784 -0.2784 -0.2784 0 0 2254 1.466e+07 3.653e+06 -2980 1.886e+09 -3.28e+09 4701 1.467e+07 3.649e+06 -1019 1.467e+07 3.648e+06 2740 1.466e+07 3.646e+06 -2825 1.466e+07 3.651e+06 -4313 1.466e+07 3.65e+06 -1488 1.467e+07 3.652e+06 -2592 1.466e+07 3.65e+06 20.45 1.466e+07 3.651e+06 13.23 13.23 13.23 8.404e+06 0 0 10.76 3.642e+06 1.089e+07 -2027 -3.28e+09 5.773e+09 3110 3.649e+06 1.089e+07 3279 3.651e+06 1.089e+07 -2196 3.643e+06 1.088e+07 -51.9 3.643e+06 1.09e+07 -4077 3.638e+06 1.089e+07 329.4 3.643e+06 1.09e+07 -2659 3.639e+06 1.089e+07 47.32 3.641e+06 1.089e+07 23.09 23.09 23.09 -1.475e+07 0 0 1.066 4624 3249 -0.7396 4701 3110 2.361 4703 3112 0.8905 4704 3112 0.7306 4700 3110 -0.2842 4624 3249 -1.521 4622 3247 0.148 4625 3249 -0.7701 4623 3248 0.4857 4622 3247 0.3516 0.3516 0.3516 0.3516 0 0 2255 1.467e+07 3.655e+06 -2982 1.467e+07 3.649e+06 4703 1.886e+09 -3.28e+09 -1020 1.468e+07 3.652e+06 2741 1.467e+07 3.651e+06 -2827 1.467e+07 3.653e+06 -4315 1.467e+07 3.652e+06 -1488 1.467e+07 3.654e+06 -2593 1.467e+07 3.652e+06 20.46 1.467e+07 3.653e+06 7.28 7.28 8.404e+06 7.28 0 0 10.71 3.643e+06 1.09e+07 -2028 3.649e+06 1.089e+07 3112 -3.28e+09 5.774e+09 3280 3.655e+06 1.089e+07 -2197 3.647e+06 1.088e+07 -51.86 3.644e+06 1.09e+07 -4079 3.64e+06 1.09e+07 329.7 3.645e+06 1.09e+07 -2660 3.641e+06 1.09e+07 47.35 3.642e+06 1.09e+07 32.28 32.28 -1.475e+07 32.28 0 0 -0.1081 -1882 4793 0.1748 -1019 3279 0.8905 -1020 3280 2.462 -1019 3281 -1.396 -1020 3278 1.175 -1882 4794 -0.5596 -1882 4791 1.029 -1882 4794 -0.2585 -1882 4792 0.49 -1881 4791 3.872 3.872 3.872 3.872 0 0 2255 1.467e+07 3.656e+06 -2982 1.467e+07 3.651e+06 4704 1.468e+07 3.655e+06 -1019 1.888e+09 -3.283e+09 2741 1.467e+07 3.653e+06 -2827 1.467e+07 3.655e+06 -4316 1.467e+07 3.653e+06 -1488 1.468e+07 3.656e+06 -2594 1.467e+07 3.654e+06 20.47 1.467e+07 3.654e+06 7.09 8.408e+06 7.09 7.09 0 0 10.65 3.644e+06 1.09e+07 -2029 3.648e+06 1.089e+07 3112 3.652e+06 1.089e+07 3281 -3.283e+09 5.779e+09 -2198 3.646e+06 1.089e+07 -51.79 3.645e+06 1.091e+07 -4080 3.64e+06 1.09e+07 329.8 3.645e+06 1.091e+07 -2661 3.641e+06 1.09e+07 47.36 3.643e+06 1.09e+07 25.38 -1.475e+07 25.38 25.38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A(10, 11): -3.283e+09 A(11, 10): -3.283e+09 gz sim --verbose=1 -r -s /home/xdw/PX4-Autopilot/Tools/simulation/gz/worlds/mountain_fog.sdf: ./dart/constraint/BoxedLcpConstraintSolver.cpp:229: virtual void dart::constraint::BoxedLcpConstraintSolver::solveConstrainedGroup(dart::constraint::ConstrainedGroup&): Assertion `isSymmetric( n, mA.data(), mOffset[i], mOffset[i] + constraint->getDimension() - 1)' failed. Stack trace (most recent call last):

31 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in

30 Object "gz sim --verbose=1 -r -s /home/xdw/PX4-Autopilot/Tools/simulation/gz/worlds/mountain_fog.sdf", at 0x602273a481c4, in _start

29 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a51629e3f, in __libc_start_main

28 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a51629d8f, in

27 Object "gz sim --verbose=1 -r -s /home/xdw/PX4-Autopilot/Tools/simulation/gz/worlds/mountain_fog.sdf", at 0x602273a4817e, in

26 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51aa8e19, in ruby_run_node

25 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51aa5317, in

24 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51c3a30c, in rb_vm_exec

23 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51c34c96, in

22 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51c31fc5, in

21 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51c2fc34, in

20 Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x752a5186644b, in

19 Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x752a51bfd088, in rb_nogvl

18 Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x752a51865d6b, in

17 Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x752a51857492, in

16 Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x752a5185ae2d, in

15 Object "/usr/lib/x86_64-linux-gnu/libgz-sim7-gz.so.7.7.0", at 0x752a4d75c8dd, in runServer

14 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x752a4c73a4f5, in

13 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x752a4c74960a, in gz::sim::v7::SimulationRunner::Run(unsigned long)

12 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x752a4c748cd0, in gz::sim::v7::SimulationRunner::Step(gz::sim::v7::UpdateInfo const&)

11 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x752a4c747412, in gz::sim::v7::SimulationRunner::UpdateSystems()

10 Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-physics-system.so", at 0x752a3454ffc6, in gz::sim::v7::systems::Physics::Update(gz::sim::v7::UpdateInfo const&, gz::sim::v7::EntityComponentManager&)

9 Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-physics-system.so", at 0x752a34550641, in gz::sim::v7::systems::PhysicsPrivate::Step(std::chrono::duration<long, std::ratio<1l, 1000000000l> > const&)

8 Object "/usr/lib/x86_64-linux-gnu/gz-physics-6/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x752a0ed96e3b, in gz::physics::dartsim::SimulationFeatures::WorldForwardStep(gz::physics::Identity const&, gz::physics::SpecifyData<gz::physics::RequireData, gz::physics::ExpectData<gz::physics::ChangedWorldPoses, gz::physics::Contacts, gz::physics::JointPositions> >&, gz::physics::CompositeData&, gz::physics::ExpectData<gz::physics::ApplyExternalForceTorques, gz::physics::ApplyGeneralizedForces, gz::physics::VelocityControlCommands, gz::physics::ServoControlCommands, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&)

7 Object "/lib/x86_64-linux-gnu/libdart.so.6.12", at 0x752a0e966e73, in dart::simulation::World::step(bool)

6 Object "/lib/x86_64-linux-gnu/libdart.so.6.12", at 0x752a0e9474a0, in dart::constraint::ConstraintSolver::solveConstrainedGroups()

5 Object "/lib/x86_64-linux-gnu/libdart.so.6.12", at 0x752a0e9442ca, in dart::constraint::BoxedLcpConstraintSolver::solveConstrainedGroup(dart::constraint::ConstrainedGroup&)

4 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a51639e95, in __assert_fail

3 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a5162871a, in

2 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a516287f2, in abort

1 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a51642475, in raise

0 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x752a516969fc, in pthread_kill

Aborted (Signal sent by tkill() 14653 1000)

@serkanMzlm

serkanMzlm commented 3 months ago

@xdwgood It doesn't get to this part. For some reason, it doesn't load the model; it loads the world environment but doesn't add the model part.

make px4_sitl gz_x500_mountain_fog

@xdwgood, is the collision part enabled for you?

serkanMzlm commented 3 months ago

I found the error. When sending the PX4-gazebo-models model, I corrected the <world name="mountain_fog"> part, but it remained as default when used, and the issue was resolved