hector_quadrotor for UAVs swarm simulation
❗❗❗ This repository is now moved here. Pls do git clone -b hector_quadrotor https://github.com/Marslanali/cpp-uav-simulations.git
in your workspace.
In a new terminal
mkdir -p ~/catkin_ws/src
cd catkin_ws/src
git clone https://github.com/Marslanali/quadrotor-simulation
catkin_make
Load the Gazebo simulator in separate terminals using the following commands:
roslaunch hector_quadrotor_demo uav_outdoor_flight_gazebo.launch
In a new terminal
rosservice call /enable_motors "enable: true"
Fig. 1. uav in empty gazebo world
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0, y: 0.0, z: 1.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'
Start the teleop node:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Reading from the keyboard and Publishing to Twist!
---------------------------
Moving around:
u i o
j k l
m , .
For Holonomic mode (strafing), hold down the shift key:
---------------------------
U I O
J K L
M < >
t : up (+z)
b : down (-z)
anything else : stop
q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%
CTRL-C to quit
rosrun image_view image_view image:=/front_cam/camera/image
Load the Gazebo simulator in separate terminals using the following commands:
roslaunch hector_quadrotor_demo uav_swarm_outdoor_flight_gazebo.launch
Fig. 1. multiple uavs in gazebo
cd ~/quadrotor-simulation
chmod +x motors_enables_uav_swarm.sh
./motors_enables_uav_swarm.sh
rostopic pub -r 10 /uav1/cmd_vel geometry_msgs/Twist '{linear: {x: 0, y: 0.0, z: 1.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'
cd ~/quadrotor-simulation/hector_quadrotor/teleop_twist_keyboard
rosrun teleop_twist_keyboard teleop_twist_keyboard.py