-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
400 lines (316 loc) · 17.1 KB
/
index.html
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="None">
<link rel="shortcut icon" href="./img/favicon.ico">
<title>Home - MAVROS Tutorial</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="./css/theme.css" type="text/css" />
<link rel="stylesheet" href="./css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="./css/highlight.css">
<script>
// Current page data
var mkdocs_page_name = "Home";
var mkdocs_page_input_path = "index.md";
var mkdocs_page_url = "/";
</script>
<script src="./js/jquery-2.1.1.min.js"></script>
<script src="./js/modernizr-2.8.3.min.js"></script>
<script type="text/javascript" src="./js/highlight.pack.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="." class="icon icon-home"> MAVROS Tutorial</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="./search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current">
<a class="current" href=".">Home</a>
<ul class="subnav">
<li class="toctree-l2"><a href="#welcome-to-mavros_tutorial">Welcome to MAVROS_Tutorial</a></li>
<li class="toctree-l2"><a href="#introduction">Introduction</a></li>
<li class="toctree-l2"><a href="#install-requirements">Install Requirements</a></li>
<ul>
<li><a class="toctree-l3" href="#install-some-requirements">Install some requirements</a></li>
<li><a class="toctree-l3" href="#install-ardupilot-sitl">Install Ardupilot-SITL</a></li>
<li><a class="toctree-l3" href="#install-mavproxy-auxiliary">Install MAVProxy (Auxiliary)</a></li>
<li><a class="toctree-l3" href="#install-ros">Install ROS</a></li>
<li><a class="toctree-l3" href="#install-mavros">Install MAVROS</a></li>
</ul>
<li class="toctree-l2"><a href="#ignite-rover-robot">Ignite Rover robot</a></li>
<ul>
<li><a class="toctree-l3" href="#bringing-up-ardupilot-sitl-for-rover">Bringing up Ardupilot-SITL for Rover</a></li>
<li><a class="toctree-l3" href="#connect-rover-to-mavros">Connect Rover to MAVROS</a></li>
<li><a class="toctree-l3" href="#view-ros-topics">View ROS topics</a></li>
</ul>
</ul>
</li>
<li class="toctree-l1">
<a class="" href="about/">About</a>
</li>
<li class="toctree-l1">
<span class="caption-text">Chapter1 ArduRover with CLI</span>
<ul class="subnav">
<li class="">
<a class="" href="Chapter1_ArduRover_with_CLI/Step1_How_to_change_mode/">Step1 How to change mode</a>
</li>
<li class="">
<a class="" href="Chapter1_ArduRover_with_CLI/Step2_How_to_Arm_and_Disarm/">Step2 How to Arm and Disarm</a>
</li>
<li class="">
<a class="" href="Chapter1_ArduRover_with_CLI/Step3_How_to_make_move/">Step3 How to make move</a>
</li>
<li class="">
<a class="" href="Chapter1_ArduRover_with_CLI/Step4_How_to_set_and_get_parameters/">Step4 How to set and get parameters</a>
</li>
</ul>
</li>
<li class="toctree-l1">
<span class="caption-text">Chapter2 ArduRover with Python</span>
<ul class="subnav">
<li class="">
<a class="" href="Chapter2_ArduRover_with_Python/Step1_Drive_rover/">Step1 Drive rover</a>
</li>
<li class="">
<a class="" href="Chapter2_ArduRover_with_Python/Step2_Detials/">Step2 Detials</a>
</li>
<li class="">
<a class="" href="Chapter2_ArduRover_with_Python/Step3_How_to_use/">Step3 How to use</a>
</li>
</ul>
</li>
<li class="toctree-l1">
<span class="caption-text">Chapter3 ArduRover with C++</span>
<ul class="subnav">
<li class="">
<a class="" href="Chapter3_ArduRover_with_C++/Step1_Drive_rover/">Step1 Drive rover</a>
</li>
<li class="">
<a class="" href="Chapter3_ArduRover_with_C++/Step2_Details/">Step2 Details</a>
</li>
<li class="">
<a class="" href="Chapter3_ArduRover_with_C++/Step3_How_to_use/">Step3 How to use</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href=".">MAVROS Tutorial</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href=".">Docs</a> »</li>
<li>Home</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="welcome-to-mavros_tutorial">Welcome to MAVROS_Tutorial</h1>
<p><em>Author:</em> Masoud Iranmehr</p>
<p><em>Github Page:</em> <a href="https://github.com/masoudir/mavros_tutorial">https://github.com/masoudir/mavros_tutorial</a></p>
<p><em>C++ Examples on Github:</em> <a href="https://github.com/masoudir/mavros_cpp_examples">https://github.com/masoudir/mavros_cpp_examples</a></p>
<p><em>Python Examples on Github:</em> <a href="https://github.com/masoudir/mavros_python_examples">https://github.com/masoudir/mavros_python_examples</a></p>
<p><em>Web Page:</em> <a href="https://masoudir.github.io/mavros_tutorial/">https://masoudir.github.io/mavros_tutorial/</a></p>
<h1 id="introduction">Introduction</h1>
<p>This project illustrates some examples about simulating robots via Ardupilot-SITL using python and C++ languages and
MAVROS (MAV-link protocol for Robotic Operating System).</p>
<h1 id="install-requirements">Install Requirements</h1>
<h2 id="install-some-requirements">Install some requirements</h2>
<p>Just follow this command:</p>
<ul>
<li><code>sudo apt-get install python-dev python-pip python3-dev python3-pip python3-rospkg</code> - Installs python3 and pip3.</li>
</ul>
<h2 id="install-ardupilot-sitl">Install Ardupilot-SITL</h2>
<p>reference : <a href="https://ardupilot.org/dev/docs/building-setup-linux.html">https://ardupilot.org/dev/docs/building-setup-linux.html</a></p>
<h2 id="install-mavproxy-auxiliary">Install MAVProxy <em>(Auxiliary)</em></h2>
<p>I prefer to use external proxy if I needed for MAVlink protocol. MAVProxy can forward any MAVLink messages from input to other TCP/UDP/Serial ports. It would be helpful if you are using one vehicle for two or more GCS or controller nodes. To install just use this command:</p>
<ul>
<li><code>pip install MAVProxy</code> - Install MAVProxy with pip in python2</li>
</ul>
<h2 id="install-ros">Install ROS</h2>
<p>ROS is semi-Operating System for robots. ROS is generally available for many programming languages such as C++, Python,
Javascript and etc. It's free and easy to use. Until now there are three supported versions of ROS (kinetic, melodic and
neotic) and I prefer to use melodic in this document. To install ROS-melodic, there are two ways of installing from
ready-built binary files or installing from source. I prefer to install the full-version of ros-melodic. If you are not
using ubuntu, it's likely to face some problems in installing ROS from binary files mentioned in ROS tutorials from
source, because its procedure is common for any kinds of linux platforms.</p>
<p>For install ROS-melodic from source you can refer to this <a href="http://wiki.ros.org/melodic/Installation/Source">link</a>.</p>
<p>For install ROS-melodic from binary files you can refer to this <a href="http://wiki.ros.org/melodic/Installation/Ubuntu">link</a>.</p>
<h2 id="install-mavros">Install MAVROS</h2>
<p>If you want to have installed ROS from binary files, this is recommended to install MAVROS from binary files too. </p>
<h3 id="install-mavros-from-binary-files">Install MAVROS from binary files</h3>
<p>For this, you can refer to this <a href="https://ardupilot.org/dev/docs/ros-install.html">link</a>.</p>
<p>For case of ease, the commands to be executed for installing MAVROS from binary files are as below:</p>
<pre><code>sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
chmod a+x install_geographiclib_datasets.sh
./install_geographiclib_datasets.sh
</code></pre>
<h3 id="install-mavros-from-source">Install MAVROS from source</h3>
<p>If you are not using ubuntu, this is strongly recommended to install MAVROS from source due to the similarity between
various Linux distributions. You can refer to this <a href="https://github.com/mavlink/mavros/tree/master/mavros#installation">link</a>
for full documentation. But here is the abstract commands:</p>
<ul>
<li>
<p><code>source <ROS_INSTALL_PATH>/devel/setup.bash</code> - Defines the installed folder of ROS (You can insert this command at the bottom of ~/.bashrc file to automatically run this command while opening a new shell. For this, you can use this command: <code>sudo nano ~/.bashrc</code>) </p>
</li>
<li>
<p><code>roscore</code> - Brings up ros core for accessing its functions and built packages</p>
</li>
<li>
<p><code>sudo apt-get install python-catkin-tools python-rosinstall-generator -y</code> - Installs python packages related to ros</p>
</li>
<li>
<p><code>cd ~/my_catkin_ws/src</code> - Jump to catkin src folder</p>
</li>
<li>
<p><code>git clone https://github.com/ros-geographic-info/unique_identifier.git</code> - clone unique_identifier package</p>
</li>
<li>
<p><code>git clone https://github.com/ros-geographic-info/geographic_info.git</code> - clone geographic_info package</p>
</li>
<li>
<p><code>cd ~/my_catkin_ws</code> - Jump to catkin folder</p>
</li>
<li>
<p><code>catkin init</code> - Initialize catkin workspace</p>
</li>
<li>
<p><code>wstool init src</code> - Initialize ros package installer</p>
</li>
<li>
<p><code>rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall</code> - Install MAVLink (we use the melodic reference for all ROS distros as it's not distro-specific and up to date)</p>
</li>
<li>
<p><code>rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall</code> - Install MAVROS: get source (upstream - released)</p>
</li>
<li>
<p><code>wstool merge -t src /tmp/mavros.rosinstall</code> - Create workspace & deps</p>
</li>
<li>
<p><code>wstool update -t src -j4</code> - Builds the ros workspace</p>
</li>
<li>
<p><code>rosdep install --from-paths src --ignore-src -y</code> - Install packages for ros</p>
</li>
<li>
<p><code>./src/mavros/mavros/scripts/install_geographiclib_datasets.sh</code> - Install GeographicLib datasets</p>
</li>
<li>
<p><code>catkin build</code> - Build source</p>
</li>
<li>
<p><code>source devel/setup.bash</code> - Uses setup.bash or setup.zsh from workspace so that rosrun can find nodes from this workspace</p>
</li>
</ul>
<p>For installing MAVROS from binary packages please refer to <a href="https://ardupilot.org/dev/docs/ros-install.html#installing-mavros">https://ardupilot.org/dev/docs/ros-install.html#installing-mavros</a>.</p>
<h1 id="ignite-rover-robot">Ignite Rover robot</h1>
<h2 id="bringing-up-ardupilot-sitl-for-rover">Bringing up Ardupilot-SITL for Rover</h2>
<ul>
<li>
<p><code>cd <Your_Ardupilot_Instalation_Folder>/ardupilot/Tools/autotest/</code> - Jump to ardupilot folder</p>
</li>
<li>
<p><code>python sim_vehicle.py -v Rover</code> - Start Rover vehicle </p>
</li>
</ul>
<p>Becareful to do not use python3 to run or build MAVProxy due to some mismatches found in this package with MAVProxy
modules such as "map" and "console".</p>
<p>Note that if you want to show other SITL modules such as map or console, you can use these commands:</p>
<pre><code>python sim_vehicle.py -v Rover --map --console
</code></pre>
<p>Or alternatively you can mention them inside SITL terminal:</p>
<pre><code>module load map
module load console
</code></pre>
<p>Note: Please be patient when ardupilot is compiling robots at first time. This takes 2-3 minutes to complete.</p>
<p>You can see that ardupilot-sitl created some outputs such as "127.0.0.1:14550" "127.0.0.1:14551". These are auxiliary UDP ports for communicating this vehicle to another MAVProxy console. We use these ports in examples. </p>
<h2 id="connect-rover-to-mavros">Connect Rover to MAVROS</h2>
<p>At first you have to source ROS and MAVROS. If you have installed them from binary files, follow these commands:</p>
<ul>
<li><code>source /opt/ros/melodic/setup.bash</code> - Defines the installed folder of ROS and MAVROS</li>
</ul>
<p>Or if you have installed them from source, follow these commands:</p>
<ul>
<li>
<p><code>source <ROS_INSTALL_PATH>/devel/setup.bash</code> - Defines the installed folder of ROS (You can insert this command at the bottom of ~/.bashrc file to automatically run this command while opening a new shell. For this, you can use this command: <code>sudo nano ~/.bashrc</code>)</p>
</li>
<li>
<p><code>source <MAVROS_INSTALL_PATH>/devel/setup.bash</code> - Defines the installed folder of MAVROS (You can insert this command at the bottom of ~/.bashrc file to automatically run this command while opening a new shell. For this, you can use this command: <code>sudo nano ~/.bashrc</code>)</p>
</li>
</ul>
<p>Then it is the time for bringing up the core of ros:</p>
<ul>
<li><code>roscore</code> - Brings up ros core for accessing its functions and built packages</li>
</ul>
<p>Afterwards, you have to tell the MAVROS how to find the vehicle you are using it:</p>
<ul>
<li><code>roslaunch mavros apm.launch fcu_url:=udp://:14550@</code> - Connects vehicle from UDP:14550 port to MAVROS</li>
</ul>
<p>Or if you want to connect to your robot via TCP port remotely, you can use this command</p>
<ul>
<li><code>roslaunch mavros apm.launch fcu_url:=tcp://<REMOTE_HOST>:<TCP_PORT>@</code> - Connects vehicle from REMOTE_HOST:TCP_PORT port to MAVROS</li>
</ul>
<h2 id="view-ros-topics">View ROS topics</h2>
<ul>
<li>
<p><code>source <ROS_INSTALL_PATH>/devel/setup.bash</code> - Defines the installed folder of ROS (You can insert this command at the
bottom of ~/.bashrc file to automatically run this command while opening a new shell. For this, you can use this command: <code>sudo nano ~/.bashrc</code>)</p>
</li>
<li>
<p><code>rqt</code> - Executes ROS plugin monitoring window</p>
</li>
</ul>
<p>Then in rqt window shown, you have to select from "Plugins" > "Topics" > "Topic Monitor" to stat topic monitoring. This
will show you the bottom figure:</p>
<p><img alt="Screenshot" src="./img/ch1_ros_topic_monitoring.jpg" /></p>
<p>You can tick any of the topic shown and monitor its contents. But in my own experience, I think that it's better to use commands in terminal or write them down in your scripts (bash, C++, python and ...)</p>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="about/" class="btn btn-neutral float-right" title="About">Next <span class="icon icon-circle-arrow-right"></span></a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">
<span style="margin-left: 15px"><a href="about/" style="color: #fcfcfc">Next »</a></span>
</span>
</div>
<script src="./js/theme.js"></script>
</body>
</html>
<!--
MkDocs version : 0.16.3
Build Date UTC : 2020-11-16 18:56:40
-->