Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The problem of running simulation #5

Open
GLtangzero opened this issue Apr 5, 2024 · 18 comments
Open

The problem of running simulation #5

GLtangzero opened this issue Apr 5, 2024 · 18 comments

Comments

@GLtangzero
Copy link

Dear sir:
I have the problem of running the gazebo:
~/PX4-Autopilot$ PX4_SYS_AUTOSTART=4002 PX4_GZ_MODEL_POSE="268.08,-128.22,3.86,0.00,0,-0.7" PX4_GZ_MODEL=x500_depth ./build/px4_sitl_default/bin/px4


| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /
| |
| | / /^\ \ ___ |
_| / / |_/

px4 starting.

INFO [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
env SYS_AUTOSTART: 4002
INFO [param] selected parameter default file parameters.bson
INFO [param] importing from 'parameters.bson'
INFO [parameters] BSON document size 310 bytes, decoded 310 bytes (INT32:13, FLOAT:3)
INFO [param] selected parameter backup file parameters_backup.bson
INFO [dataman] data manager file './dataman' size is 7872608 bytes
INFO [init] Gazebo simulator
INFO [init] starting gazebo with world: /home/tang/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf
INFO [init] PX4_GZ_MODEL_POSE set, spawning at: 268.08,-128.22,3.86,0.00,0,-0.7
INFO [gz_bridge] world: default, model name: x500_depth_0, simulation model: x500_depth
INFO [gz_bridge] Requested Model Position: 268.08,-128.22,3.86,0.00,0,-0.7
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[Err] [SDFFeatures.cc:843] The geometry element of collision [collision] couldn't be created
[Err] [SDFFeatures.cc:843] The geometry element of collision [collision] couldn't be created
[Err] [SDFFeatures.cc:843] The geometry element of collision [collision] couldn't be created
[Err] [SDFFeatures.cc:843] The geometry element of collision [collision] couldn't be created
ERROR [gz_bridge] timed out waiting for clock message
ERROR [gz_bridge] Task start failed (-1)
ERROR [init] gz_bridge failed to start and spawn model
ERROR [px4] Startup script returned with return value: 256
tang@tang-GL502VSK:~/PX4-Autopilot$ [Err] [FuelClient.cc:691] Failed to download model.
Server: https://fuel.ignitionrobotics.org
Route: openrobotics/models/sonoma raceway/2/sonoma raceway.zip
REST response code: 504
[Err] [SystemPaths.cc:432] URI [https://fuel.ignitionrobotics.org/1.0/openrobotics/models/sonoma raceway/2/files/meshes/Raceway.obj] resolved to path [/meshes/Raceway.obj] but the path does not exist
[Err] [SystemPaths.cc:525] Could not resolve file [https://fuel.ignitionrobotics.org/1.0/openrobotics/models/sonoma raceway/2/files/meshes/Raceway.obj]
[Err] [MeshManager.cc:193] Unable to find file[https://fuel.ignitionrobotics.org/1.0/openrobotics/models/sonoma raceway/2/files/meshes/Raceway.obj]

And after that the GAZEBO could show the drone and car but can't show the world and it also can't connect to the MicroDDS and QgroundControl.

And also I can't running ros2 run ros_gz_image image_bridge /camera it show like:
$ ros2 run ros_gz_image image_bridge /camera
Package 'ros_gz_image' not found

Thanks for your model it looks very good, i really wish to running it.

@monemati
Copy link
Owner

monemati commented Apr 5, 2024

@GLtangzero Hello there. In your first problem it looks like the raceway model can not be downloaded from server, you can try to download the model from this link and put it in right directory in .gz model path.

For your second problem you can try the MicroDDS "v2.4.1" version (git checkout v2.4.1) and try 97cb933cff6d837e59dd55123804cd78abdca22a tag for PX4-Autopilot (git checkout 97cb933cff6d837e59dd55123804cd78abdca22a)

For your last problem you can try this command:
sudo apt install ros-humble-ros-gzgarden
if it is not fixed reinstall ros 2 humble again.

@GLtangzero
Copy link
Author

Dear sir:
First of all, thanks for your reply, after I download the new model it could be show in the gazebo.
Screenshot from 2024-04-06 14-13-14

But the drone still can't take off, the QgroundControl show like this
(1)Compass sensor 0 missing
(2)No valid local position estimate
(3)No manual control input
Screenshot from 2024-04-06 14-24-47

And if I change the world to the origin PX4 default world the drone could be control, so I guess it's something problem happened in the world sdf document.

The camera could be used.

But control can't work:
(1)pygame 2.5.2 (SDL 2.28.2, Python 3.10.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
Waiting for drone to connect...
-- Connected to drone!
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<getKeyboardInput() done, defined at /home/tang/PX4-ROS2-Gazebo-YOLOv8/keyboard-mavsdk-test.py:12> exception=ActionError(<mavsdk.action.ActionResult object at 0x7e1ad339ad40>, 'arm()')>
Traceback (most recent call last):
File "/home/tang/PX4-ROS2-Gazebo-YOLOv8/keyboard-mavsdk-test.py", line 36, in getKeyboardInput
await my_drone.action.arm()
File "/home/tang/px4-venv/lib/python3.10/site-packages/mavsdk/action.py", line 328, in arm
raise ActionError(result, "arm()")
mavsdk.action.ActionError: COMMAND_DENIED: 'Command Denied'; origin: arm(); params: ()

(2)ros2 run px4_ros_com offboard_control
Starting offboard control node...
[INFO] [1712381251.842813578] [offboard_control]: Arm command send
Screenshot from 2024-04-06 14-28-12

@monemati
Copy link
Owner

monemati commented Apr 6, 2024

@GLtangzero Hello again. I did not try QGC back then with this repo. You said it can run with the default world so you can check the differences, for example in line 15 there is
<plugin name='gz::sim::systems::NavSat' filename='gz-sim-navsat-system'/>
which I do not have in my sdf document.

And another thing is that my PX4-Autopilot version is a little bit old, maybe there is a miscommunication with the newer QGC.

@GLtangzero
Copy link
Author

@monemati
Thank you for your help sir.
My px4-Autopilot is the newest type, I will try to check the problem.
If i get the resolve I will return again.
Thanks for your return again!

@wyattPol
Copy link

@monemati Thank you for your help sir. My px4-Autopilot is the newest type, I will try to check the problem. If i get the resolve I will return again. Thanks for your return again!

hey I have the same problem with you. Did you find any solution?

@GLtangzero
Copy link
Author

GLtangzero commented May 13, 2024

@wyattPol First please delete all model which you using in the gazebo, open the world/default.sdf and delete all

Screenshot from 2024-05-13 13-51-53

this type code and then run the progress again, if you can open it, then add the model one by one, I think is the problem of the model with gazebo and px4, please check it.

@AlbertoRemus
Copy link

Hi! I think the problem is this missing part:

    <spherical_coordinates>
      <surface_model>EARTH_WGS84</surface_model>
      <world_frame_orientation>ENU</world_frame_orientation>
      <latitude_deg>47.397971057728974</latitude_deg>
      <longitude_deg> 8.546163739800146</longitude_deg>
      <elevation>0</elevation>
    </spherical_coordinates>

@GLtangzero
Copy link
Author

@AlbertoRemus
Thanks, I will try later.

@evellynnicole
Copy link

@AlbertoRemus Obrigado, vou tentar mais tarde.

I don't understand how you solved the control problem, I have the same problem:

Task exception was never retrieved
future: <Task finished name='Task-3' coro=<getKeyboardInput() done, defined at /home/evellyn/PX4-ROS2-Gazebo-YOLOv8/keyboard-mavsdk-test.py:12> exception=ActionError(< mavsdk.action.ActionResult object at 0x7b0de69f3730>, 'arm()')>
Traceback (most recent call last):
File "/home/evellyn/PX4-ROS2-Gazebo-YOLOv8/keyboard-mavsdk-test.py", line 36, in getKeyboardInput
await my_drone.action.arm()
File "/home/evellyn/.local/lib/python3.10/site-packages/mavsdk/action.py", line 336, in arm
raise ActionError(result, "arm()")
mavsdk.action.ActionError: COMMAND_DENIED: 'Command Denied'; origin: arm(); params:()

Also, I can't view the drone's camera.

In terminal 2, I have this problem:
WARN [commander] Arming denied: Resolve system health failures first

@GLtangzero
Copy link
Author

@evellynnicole
Hello, please try to use the below solution:
<1>Please check which gazebo you used in, if it's gazebo classic it will need QControground software to help arm, and if it's gazebo garden you need check the drone type.
<2>Input commander takeoff in your Px4 terminal, than try to move the drone.
If anyother problem there please report detail and add some pictures.
Thanks!

@evellynnicole
Copy link

I installed QGroundControl, now how do I solve the armament problems?

image

@GLtangzero
Copy link
Author

GLtangzero commented Jul 6, 2024

@evellynnicole
Hello, sorry for repeat late.
Please go to the main page.
dfb224512d2731d66533abd7ccdcdf6e98d3a481
click the arm bottom and drag the arm bar to arm the drone.
If the drone has an error QcontrolGround will report an error, please check the problem

@101ash
Copy link

101ash commented Aug 22, 2024

@monemati Dear sir I hope it won't cause you any trouble.(I am a beginner):
1.I have the problem of running in"Additional Configs" in step of"Copy default.sdf from the worlds folder in the main repo to ~/PX4-Autopilot/Tools/simulation/gz/worlds/",
my default.sdf location in the PX4-Autopilot/Tools/simulation/gz/worlds/,I not sure that I need to copy again?
Screenshot from 2024-08-22 16-41-37
2.And I am not sure my doing is correct or not,In step of "Copy the content of models from main repo to ~/.gz/models" I just copy the file of models from PX4-Autopilot/Tools/simulation/gz/models to.gz file.
Can you tell me how to do it correctly?
3.Then I use nano ~/.bashrc and find source /opt/ros/humble/setupbash`already on the bottom.so I need past it again?

@monemati
Copy link
Owner

@101ash Hello.
1- Yes, copy default.sdf again, I did some modification and you need to replace default.sdf from my repo to ~/PX4-Autopilot/Tools/simulation/gz/worlds/ in your machine.
2- Navigate to ~/.gz/models in your machine and just paste folders from my repo (PX4-ROS2-Gazebo-YOLOv8/models) into that folder, so you will have ~/.gz/models/casual_female , ~/.gz/models/hatchback, and so on, in your machine
3- If there is already a source /opt/ros/humble/setup.bash in your bashrc, you don't need to paste it again.

@martinkeith
Copy link

@monemati Thank you for your help sir. My px4-Autopilot is the newest type, I will try to check the problem. If i get the resolve I will return again. Thanks for your return again!

Hi sir,I have the same problem,Do you resolve this problem in any way?

@martinkeith
Copy link

@wyattPol First please delete all model which you using in the gazebo, open the world/default.sdf and delete all

Screenshot from 2024-05-13 13-51-53

this type code and then run the progress again, if you can open it, then add the model one by one, I think is the problem of the model with gazebo and px4, please check it.

I did what you said, first delete all files in .gz/models,then delete all as you mentioned. But failed,it show 'No valid local position estimate No valide global position estimate' . The GPS status info is GPS Count: 0 GPS Lock: None HDOP: --.-- VDOP:--.-- Course OverGround:--.--.
So Did I do the right? Looking forward to your reply

@martinkeith
Copy link

@monemati Hi bro. As mentioned before, I failed. Then I used the original default.sdf instead of the default.sdf you provided. Run it, all fault is gone. so if world/default.sdf you provided have something wrong? Looking forward to your reply.

@monemati
Copy link
Owner

@martinkeith Hello. I checked the latest default.sdf from PX4 and apparently they changed some stuff (like plugins). I am not sure which differences are causing the problems, but when I got the time I will look into it.
(The PX4 version I used for this repo was v1.14.0-beta2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants