RotorS is a MAV gazebo simulator. It provides some multirotor models such as the AscTec Hummingbird, the AscTec Pelican, or the AscTec Firefly, but the simulator is not limited for the use with these multicopters.
This is the fork of the original repo, we (Team Aerial Robotics IITK) have been customising this according to our usage.
- Install and initialize ROS noetic desktop full, additional ROS packages, catkin-tools, and wstool:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install ros-noetic-desktop-full ros-noetic-joy ros-noetic-octomap-ros ros-noetic-mavlink python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-noetic-control-toolbox ros-noetic-mavros
sudo rosdep init
rosdep update
source /opt/ros/noetic/setup.bash
- If you don't have ROS workspace yet you can do so by
mkdir -p ./rotors_ariitk_ws/src
cd ./rotors_ariitk_ws/
catkin init # initialize your catkin workspace
cd src/
wstool init
wget https://raw.githubusercontent.com/AerialRobotics-IITK/rotors_simulator/base_2022/rotors_hil.rosinstall
wstool merge rotors_hil.rosinstall
wstool update
- Now install rotorS with dependencies
# assuming you're still at your workspace src/
git clone [email protected]:AerialRobotics-IITK/rotors_simulator.git
git clone [email protected]:ethz-asl/mav_comm.git
- Build your workspace with
python_catkin_tools
(therefore you needpython_catkin_tools
)
catkin build
source ../devel/setup.bash # source this everytime you need it
Launch the simulator with a hex-rotor helicopter model, in our case, the AscTec Firefly in a basic world.
roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic
Note The first run of gazebo might take considerably long, as it will download some models from an online database. Should you receive a timeout error, try running gazebo by itself (e.g. roslaunch gazebo_ros empty_world.launch ) so it has sufficient time to actually download all of the models.
The simulator starts by default in paused mode. To start it you can either
-
use the Gazebo GUI and press the play button
-
or you can send the following service call.
rosservice call gazebo/unpause_physics
There are some basic launch files where you can load the different multicopters with additional sensors. They can all be found in ~/catkin_ws/src/rotors_simulator/rotors_gazebo/launch
.
The world_name
argument looks for a .world file with a corresponding name in ~/catkin_ws/src/rotors_simulator/rotors_gazebo/worlds
. By default, all launch files, with the exception of those that have the world name explicitly included in the file name, use the empty world described in basic.world
.
We will for now just send some constant motor velocities to the multicopter.
rostopic pub /firefly/command/motor_speed mav_msgs/Actuators '{angular_velocities: [100, 100, 100, 100, 100, 100]}'
Note The size of the
motor_speed
array should be equal to the number of motors you have in your model of choice (e.g. 6 in the Firefly model).
You should see (if you unpaused the simulator and you have a multicopter in it), that the rotors start spinning. The thrust generated by these motor velocities is not enough though to let the multicopter take off.
You can play with the numbers and will realize that the Firefly will take off with motor speeds of about 545 on each rotor. The multicopter is unstable though, since there is no controller running, if you just set the motor speeds.
You can let the helicopter hover with ground truth odometry (perfect state estimation), by launching:
roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic