ctu-mrs/mrs_simulation

px4 closes after a while, making the simulation unusable

DavidePatria opened this issue · 7 comments

I launch gazebo with:
roslaunch mrs_simulation simulation.launch world_file:='my_world.world' gui:=true
where my world is my world of choice, that I have used many other times.
Then I spawn a vehicle using:
rosservice call /mrs_drone_spawner/spawn "1 --x500 --pos -3 -1 0.3 0"
the position is chosen so the drone spawns in a free area.

After a while (maybe less than a minute) i get:

Exiting NOW.
Failed sending mavlink message: Broken pipe
Closing connection.
Connection closed by client.
Connection closed by client.
Connection closed by client.
Connection closed by client.

After hitting ctrl+C in the terminal I also get
[ERROR] [1646664517.223865, 108.222000]: [DroneSpawner]: Mavros did not respond while starting firmware for uav1!
I had never encountered such behaviour with px4 before.

it is important to specify the following.

I had to replace some script calls like so:

ROMFS/px4fmu_common/init.d/rc.vehicle_setup
29:     sh /etc/init.d/rc.interface    ==> . {R}/etc/init.d/rc.interface

like it is customary in other packages and in px4 itself, otherwise I would get errors about the scripts not being found and now that works fine.
Also, I solely cloned the minimum required ros apckages to get the simulation working and not the entires framwork.
The packages are: mrs_simulation, mes_gazebo_common_resources, mrs_msgs.

Any help is really appreciated.

edit:
seems like mavros is not launched at all.
after launching simulation.launch I get:
[ERROR] [1646667465.647104, 19.014000]: [DroneSpawner]: Error occured while launching mavros for uav0!

Hi, It seems like your version of px4 and sitl_gazebo, part of the px4, is not compatible with our drone models. If you are not doing anything fancy with px4 firmware, I would suggest using our px4 version.

checking in the gitman file in the main repo (simulation) I found px4 v1.11.2 , but simply changing that is not enough. is there a specific mavros version to be used too?

Hey, make sure you have to right combination of commits of px4, and mavros and mavlink_sitl_gazebo.

Currently, we are on the v1.11.2 version of px4, however, on a custom branch. So check out the commit 7c37433 if you want it to work. Moreover, the mavlink_sitl_gazebo is a submodule of px4, we again use a custom branch devel, commit afcf630. With Mavros, we are on the custom branch added_dialect_file, commit 68cf7ce.

Hi @klaxalk , thank you for the tips. Unfortunately I cannot compile your version of px3 with
DONT_RUN=1 make px4_sitl_default gazebo

which I suppose stayed the same.

I have checked out to the commit you specified, but I still get the following error:

CMake Error at platforms/posix/CMakeLists.txt:123 (install): install DIRECTORY given no DESTINATION!

We compile PX4 as a ROS package using catkin, not "by hand" as you wrote, so catkin build px4. To be honest, I don't know how to properly compile it by hand. But given the message, I suspect that some more parameters and arguments have to be specified.

it compiles using catkin, but I still have problems with mavros, which doesn't compile and complains about get_autopilot not found. I think I'll give it a try in a docker using the scripts in mrs_uav_system.
thank you

Ye, just try our new Singularity pipeline. That is all prepare if you don't need to modify the system.