Skip to content

Gazebo Simulation Setup

Fernando Cladera edited this page Feb 16, 2022 · 50 revisions

Word of caution: note that the code stack is developed and tested primarily in our customized Unity-based simulator, which provides photo-realistic sensor data for our perception algorithms (stereo VIO, semantic SLAM, etc.). We also provide support for the Gazebo simulator, where the perception-related modules are simplified (using ground-truth pose, and point clouds for obstacle avoidance), so that the general public can test our stack without much effort:

Building and installing the autonomy stack:

Build from source

Using docker

Important parameter files you should modify according to your purpose:

catkin_ws/src/kr_autonomous_flight/autonomy_core/control/control_launch/config/trackers_mp.yaml

catkin_ws/src/kr_autonomous_flight/autonomy_core/map_plan/map_plan_launch/config/mapper.yaml

Using our example environment:

A video tutorial: TODO

Change the take-off position (optional):

Open this file catkin_ws/src/kr_autonomous_flight/autonomy_sim/gazebo_sim/gazebo_utils/launch/full_sim.launch, and change the x, y, and z positions:

<arg name="x" default="-10"/>
<arg name="y" default="-10"/>
<arg name="z" default="1.0"/>     

Finally, execute the following command:

source catkin_ws/devel/setup.bash
roslaunch gazebo_utils full_sim.launch

Click motors on after the robot get commands (i.e., when the commands in rqt GUI window become non-zero). Wait for several seconds, click “take off” in rqt GUI, and you should see the UAV take off.

(Troubleshooting) If the robot does not take off. You don't have to relaunch. Instead, you can try clicking the rqt GUI again in the following order:

motors off -> motors on -> take off

If the robot still does not take off, kill the ROS master and relaunch.

Using your own environment:

Specify your environment:

catkin_ws/src/mrsl_quadrotor/mrsl_quadrotor_launch/launch/spawn.launch

Change the value of "world_name" in the following line

<arg name="world_name" value="$(find mrsl_quadrotor_description)/worlds/$(arg world).world"/>

to point to the Gazebo world file of your own, i.e.,

<arg name="world_name" value="PATH_TO_YOUR_WORLD_FILE/YOUR_FILE_NAME.world"/>

Further customization:

You can also make further changes, e.g. use different robots, refer to the following files for details: catkin_ws/src/kr_autonomous_flight/autonomy_sim/gazebo_sim/gazebo_utils/launch/simulation.launch catkin_ws/src/mrsl_quadrotor/mrsl_quadrotor_launch/launch/spawn.launch catkin_ws/src/mrsl_quadrotor/mrsl_quadrotor_launch/launch/gazebo.launch

Be careful: only the default robot falcon4_os1_XXX have well-tuned gains, once you change the robot, you need to re-tune controller gains, by changing the following file catkin_ws/src/kr_autonomous_flight/autonomy_sim/gazebo_sim/gazebo_utils/config/falcon4_os1_so3_gains.yaml

The explanation of the parameters in the controller gains YAML file can be found here: https://github.com/KumarRobotics/kr_autonomous_flight/wiki/Position-controller-gains-and-parameters-(so3_control)

Clone this wiki locally