ArduPilot / ardupilot

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

Possible to simulate "standard plane" in gazebo with sim_vehicle? #18608

Open RotorBoy2020 opened 2 years ago

RotorBoy2020 commented 2 years ago

Is it possible to simulate a standard plane in gazebo with ardupilot? I am trying to simulate the some of the planes in this video

I have been following this tutorial Using this ardupilot gazebo plugin

I am able to run arduplane sitl via sim_vehicle.py, connect the sitl vehicle to QGC, and connect it with MAVROS, but the gazebo plane models I have do not move (I grabbed them from the PX4 gazebo models folder).

My questions is the following: Where can I find the gazebo models for simple cub like planes and how can I integrate them into gazebo? What needs to change about these files so that sim_vehicle.py can communicate with the gazebo model?

If I run the same commands with a iris quadcopter, I am able to get the gazebo model to connect to sim_vehicle and everything works as expected. This is not the case with the plane, which leads me to believe it is something wrong with my gazebo setup/interface. I place my plane models (attached) into the corresponding ardupilot gazebo models folder.

If I run a modified launch file (attached) with my gazebo models --verbose, I get the following errors:

ubuntu@ubuntu:~$ gazebo --verbose plane_ardupilot_demo.world
Gazebo multi-robot simulator, version 9.19.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 9.19.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.188
[Msg] Loading world file [/home/modalai/ardupilot_gazebo/worlds/plane_ardupilot_demo.world]
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_airspeed_plugin.so: libgazebo_airspeed_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_gps_plugin.so: libgazebo_gps_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_imu_plugin.so: libgazebo_imu_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_groundtruth_plugin.so: libgazebo_groundtruth_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_magnetometer_plugin.so: libgazebo_magnetometer_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_barometer_plugin.so: libgazebo_barometer_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libgazebo_mavlink_interface.so: libgazebo_mavlink_interface.so: cannot open shared object file: No such file or directory
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.188
[Err] [Plugin.hh:178] Failed to load plugin libForceVisual.so: libForceVisual.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:178] Failed to load plugin libForceVisual.so: libForceVisual.so: cannot open shared object file: No such file or directory

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

Setup Ubuntu 18.04 on an ASUS laptop

Thank you for your help! plane_ardupilot_demo(world).txt plane_models.zip

srmainwaring commented 2 years ago

Hi @RotorBoy2020, there's been some work to migrate the ArduPilot plugin for Gazebo to support Ignition Gazebo and provide a selection of updated models.

The model you obtained from the PX4 folder will not work without considerable modification. The plugins that are not loading are all particular to PX4-SITL and will not work with ArduPilot. The ArduPilot plugin uses a different protocol to communicate with it's version of SITL and applies the control commands it received from the flight controller differently (rather than use another plugin for motors or thrusters it commands the joint positions or velocities using PID controllers, rotor lift is obtained by using a physics plugin to set the lift-drag behaviour of the moving rotor link).

If you have any issues getting the simulation running you could ask for help on ArduPilot Discourse, or if there is an issue with the plugin itself, here: https://github.com/ArduPilot/ardupilot_gazebo/issues

cheslee-z commented 1 year ago

the ardupilot-gazebo plugin you used is semi-finished product. some models are ported from px4 and are not compatible with ardupilot.