-
Notifications
You must be signed in to change notification settings - Fork 6
/
README.html
177 lines (174 loc) · 7.26 KB
/
README.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inter IIT.md</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html"><h1 id="inter-iit-tech-meet-10.0">Inter IIT Tech Meet 10.0</h1>
<h1 id="installation">Installation</h1>
<h2 id="ros">ROS</h2>
<p>You can find these installation instructions <a href="wiki.ros.org/melodic/Installation/Ubuntu">here</a>.</p>
<h4 id="setup-your-sources.list">Setup your sources.list</h4>
<pre><code>sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
</code></pre>
<h4 id="set-up-your-keys">Set up your keys</h4>
<pre><code>sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
</code></pre>
<h4 id="update-packages-and-install-ros">Update packages and install ROS</h4>
<pre><code>sudo apt update
sudo apt install ros-melodic-desktop-full
</code></pre>
<h4 id="setup-the-environment">Setup the environment</h4>
<pre><code>echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
</code></pre>
<h4 id="dependencies">Dependencies</h4>
<pre><code>sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
</code></pre>
<h4 id="rosdep">Rosdep</h4>
<pre><code>sudo apt install python-rosdep
sudo rosdep init
rosdep update
</code></pre>
<blockquote>
<p>Note : We recommend you to create a new catkin_ws since you have to install mavros from source which needs you to do <code>catkin build</code>.</p>
</blockquote>
<h2 id="ardupilot">Ardupilot</h2>
<h3 id="installing-ardupilot-and-mavproxy">Installing Ardupilot and MAVProxy</h3>
<h4 id="clone-ardupilot">Clone ArduPilot</h4>
<p>In home directory:</p>
<pre><code>cd ~
sudo apt install git
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git checkout Copter-3.6
git submodule update --init --recursive
</code></pre>
<h4 id="install-dependencies">Install dependencies:</h4>
<pre><code>sudo apt install python-matplotlib python-serial python-wxgtk3.0 python-wxtools python-lxml python-scipy python-opencv ccache gawk python-pip python-pexpect
</code></pre>
<h4 id="use-pip-python-package-installer-to-install-mavproxy">Use pip (Python package installer) to install mavproxy:</h4>
<pre><code>sudo pip install future pymavlink MAVProxy
</code></pre>
<p>Open <code>~/.bashrc</code> for editing:</p>
<pre><code>gedit ~/.bashrc
</code></pre>
<p>Add these lines to end of <code>~/.bashrc</code> (the file open in the text editor):</p>
<pre><code>export PATH=$PATH:$HOME/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH
</code></pre>
<p>Save and close the text editor.</p>
<p>Reload <code>~/.bashrc</code>:</p>
<pre><code>. ~/.bashrc
</code></pre>
<p>Run SITL (Software In The Loop) once to set params:</p>
<pre><code>cd ~/ardupilot/ArduCopter
sim_vehicle.py -w
</code></pre>
<h2 id="gazebo-and-plugins">Gazebo and Plugins</h2>
<h4 id="gazebo">Gazebo</h4>
<p>Setup your computer to accept software from <a href="http://packages.osrfoundation.org">http://packages.osrfoundation.org</a>:</p>
<pre><code>sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
</code></pre>
<p>Setup keys:</p>
<pre><code>wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
</code></pre>
<p>Reload software list:</p>
<pre><code>sudo apt update
</code></pre>
<p>Install Gazebo:</p>
<pre><code>sudo apt install gazebo9 libgazebo9-dev
</code></pre>
<h3 id="install-gazebo-plugin-for-apm-ardupilot-master-">Install Gazebo plugin for APM (ArduPilot Master) :</h3>
<pre><code>cd ~
git clone https://github.com/khancyr/ardupilot_gazebo.git
cd ardupilot_gazebo
git checkout dev
</code></pre>
<p>build and install plugin</p>
<pre><code>mkdir build
cd build
cmake ..
make -j4
sudo make install
</code></pre>
<pre><code>echo 'source /usr/share/gazebo/setup.sh' >> ~/.bashrc
</code></pre>
<p>Set paths for models:</p>
<pre><code>echo 'export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models' >> ~/.bashrc
. ~/.bashrc
</code></pre>
<h4 id="run-simulator">Run Simulator</h4>
<p>In one Terminal (Terminal 1), run Gazebo:</p>
<pre><code>gazebo --verbose ~/ardupilot_gazebo/worlds/iris_arducopter_runway.world
</code></pre>
<p>In another Terminal (Terminal 2), run SITL:</p>
<pre><code>cd ~/ardupilot/ArduCopter/
sim_vehicle.py -v ArduCopter -f gazebo-iris --console
</code></pre>
<h3 id="install-mavros">Install Mavros</h3>
<p>please install mavros from source because we have changed the frame from <code>LOCAL_NED</code> to <code>BODY_NED</code>.</p>
<blockquote>
<p>If you decide to use the already existing catkin_ws then be sure to remove the <code>build</code> and <code>devel</code> folders and do <code>catkin build</code>.</p>
</blockquote>
<p>Link to install from source : <a href="https://docs.px4.io/master/en/ros/mavros_installation.html">Link</a></p>
<h3 id="modifying-mavros">Modifying Mavros</h3>
<p>After you install from source, please change the file <code>set_velocity.cpp</code> located at <code>catkin_ws/src/mavros/src/plugins/setpoint_velocity.cpp</code>.</p>
<p>New file : <a href="https://github.com/MP-DR-T13/setpoint_velocity_changed/blob/main/setpoint_velocity.cpp">Link</a></p>
<h3 id="running-simulation">Running Simulation</h3>
<ul>
<li>Download the <code>interiit22</code> package from this repo and include it in your <code>catkin_ws</code></li>
<li>Do <code>catkin build</code> (assuming you have done <code>catkin build</code> while installing mavros)</li>
<li>Go the the <code>glimbal_small_2d</code> folder of <code>ardupilot_gazebo/models</code> folder and change Line 164 in the <code>models.sdf</code> file.</li>
</ul>
<pre><code><pointCloudCutoffMax>20.0</pointCloudCutoffMax>
</code></pre>
<p>We increased the range of Depth camera from 10m to 20m.</p>
<ul>
<li>cd to the folder containing simulation sh file</li>
</ul>
<pre><code> cd catkin_ws/src/interiit22
</code></pre>
<ul>
<li>make it executable</li>
</ul>
<pre><code>chmod u+x startsim.sh
</code></pre>
<ul>
<li>Open the terminal and launch the world file</li>
</ul>
<pre><code>./startsim.sh
</code></pre>
<ul>
<li>Now please wait until the MavProxy console shows that the GPS is correct and now open a new terminal and run the following command . This will takeoff the drone upto 15m height.</li>
</ul>
<pre><code>rosrun interiit22 arm_and_takeoff.py --connect 127.0.0.1:14550
</code></pre>
<ul>
<li>Now open a new terminal and run the <code>move_drone.py</code></li>
</ul>
<pre><code>rosrun interiit22 move_drone.py
</code></pre>
<ul>
<li>Now you can open rviz and visualize the topic <code>/image_topic_2</code>. This is the main topic which draws the contours on the image</li>
<li>Now start recording through rosbag</li>
</ul>
<pre><code>rosbag record -O bag_file_name /mavros/setpoint_velocity/cmd_vel_unstamped
</code></pre>
<ul>
<li>After the drone completely moves the world, press Ctrl+C to stop the reording</li>
<li>Now play the recorded bag file</li>
</ul>
<pre><code>rosbag play bag_file_name.bag
</code></pre>
<ul>
<li>Now open a new terminal and run</li>
</ul>
<pre><code>rosrun interiit22 move_prius.py
</code></pre>
</div>
</body>
</html>