-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md
130 lines (87 loc) · 2.66 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# hector_quadrotor_gazebo_simulation
hector_quadrotor for UAVs swarm simulation
:exclamation::exclamation::exclamation: This repository is now moved <a href="https://github.com/Marslanali/cpp-uav-simulations/tree/hector_quadrotor">here</a>. Pls do `git clone -b hector_quadrotor https://github.com/Marslanali/cpp-uav-simulations.git` in your workspace.
### complining the package
In a new terminal
```
mkdir -p ~/catkin_ws/src
cd catkin_ws/src
git clone https://github.com/Marslanali/quadrotor-simulation
catkin_make
```
### Simulating UAV in Gazebo
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"
```
### Simulation screenshots
<p align="left">
<img src="screenshots/uav.jpg" width ="500" height="400"/>
<br/>
Fig. 1. uav in empty gazebo world
</p>
#### Publishing cmd vel:
```
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}}'
```
#### Running keyboard teleop:
Start the teleop node:
```
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
```
# Usage
```
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
```
### Getting RGB image to display
```
rosrun image_view image_view image:=/front_cam/camera/image
```
### Simulating Swarm of UAV in Gazebo
Load the Gazebo simulator in separate terminals using the following commands:
```
roslaunch hector_quadrotor_demo uav_swarm_outdoor_flight_gazebo.launch
```
### Simulation screenshots
<p align="left">
<img src="screenshots/swarm1.jpg" width ="400" height="400"/>
<img src="screenshots/swarm2.jpg" width ="400" height="400"/>
<br/>
Fig. 1. multiple uavs in gazebo
</p>
### Enabling motors
```
cd ~/quadrotor-simulation
chmod +x motors_enables_uav_swarm.sh
./motors_enables_uav_swarm.sh
```
#### controling uav1 by publishing /uav1/cmd_vel:
```
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}}'
```
### Running keyboard teleop for swarm of uav
```
cd ~/quadrotor-simulation/hector_quadrotor/teleop_twist_keyboard
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
```