You can find these installation instructions here.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
In home directory:
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
sudo apt install python-matplotlib python-serial python-wxgtk3.0 python-wxtools python-lxml python-scipy python-opencv ccache gawk python-pip python-pexpect
sudo pip install future pymavlink MAVProxy
Open ~/.bashrc
for editing:
gedit ~/.bashrc
Add these lines to end of ~/.bashrc
(the file open in the text editor):
export PATH=$PATH:$HOME/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH
Save and close the text editor.
Reload ~/.bashrc
:
. ~/.bashrc
Run SITL (Software In The Loop) once to set params:
cd ~/ardupilot/ArduCopter
sim_vehicle.py -w
Setup your computer to accept software from http://packages.osrfoundation.org:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
Setup keys:
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
Reload software list:
sudo apt update
Install Gazebo:
sudo apt install gazebo9 libgazebo9-dev
cd ~
git clone https://github.com/khancyr/ardupilot_gazebo.git
cd ardupilot_gazebo
git checkout dev
build and install plugin
mkdir build
cd build
cmake ..
make -j4
sudo make install
echo 'source /usr/share/gazebo/setup.sh' >> ~/.bashrc
Set paths for models:
echo 'export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models' >> ~/.bashrc
. ~/.bashrc
In one Terminal (Terminal 1), run Gazebo:
gazebo --verbose ~/ardupilot_gazebo/worlds/iris_arducopter_runway.world
In another Terminal (Terminal 2), run SITL:
cd ~/ardupilot/ArduCopter/bs
sim_vehicle.py -v ArduCopter -f gazebo-iris --console
mkdir ~/drdo22_ws
cd ~/drdo22_ws
mkdir src
catkin build
Inside the src folder clone this repository
git clone <repo_link>
- If the models in the first world file aren't loading, make the following changes to the world file.
Previous
<arg name="car_model" default="$(find prius_description)/urdf/prius.urdf"/>
<param name="robot_description" textfile="$(arg car_model)"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find interiit22)/world/drdo_world1.world"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="verbose" value="true"/>
<!-- more default parameters can be changed here -->
</include>
<!-- vim: set ft=xml noet : -->
After
<arg name="car_model" default="$(find prius_description)/urdf/prius.urdf"/>
<arg name="ardupilot_gazebo_path" default="~/ardupilot_gazebo"/>
<arg name="verbose" default="true"/>
<env name="GAZEBO_MODEL_PATH" value="${GAZEBO_MODEL_PATH}:$(find interiit22)/models:$(arg ardupilot_gazebo_path)/models"/>
<env name="GAZEBO_RESOURCE_PATH" value="${GAZEBO_RESOURCE_PATH}:$(find interiit22)/models:$(arg ardupilot_gazebo_path)/models"/>
<param name="robot_description" textfile="$(arg car_model)"/>
- Depth camera topics not present : Delete gimbal_small2d model from the .gazebo folder in home.
- Install PCL
sudo apt-get update sudo apt-get upgrade sudo apt install libpcl-dev sudo apt-get install ros-melodic-pcl-ros ros-melodic-pcl-conversions ros-melodic-pcl-msgs sudo apt-get install ros-melodic-eigen-conversions
- Change the path of the generated map csv file at line number 20 in the file named
mapping_fsm
inside~/drdo22_ws/inter_iit_uav_guided_ugv/segmentation/src/mapping_fsm.cpp
. Set it to~/drdo22_ws/inter_iit_uav_guided_ugv/maps/<world_name>.csv
.
-
Launch QGC and go to the safety settings, scroll to the bottom and uncheck the "all" option in arming safety checks. Just tick the GPS lock option and close.
-
Start the launch file world.launch for world1 and in another terminal launch.
roslaunch interiit22 ${world}.launch
sim_vehicle.py -v ArduCopter -f gazebo-iris
-
Delete Prius from the world after gazebo is launched.
-
Wait for GPS lock, and then launch QGC to manually arm the drone for take-off.
-
In another terminal run the following command to run
road_seg_node
andmapping_fsm_node
. Runningdefault.launch
downloads certain modules necessary for running the nodes.
rosrun segmentation road_seg_node
roslaunch segmentation default.launch
rosrun mapping mapping_fsm_node
- road_seg_node
- mapping_fsm_node
-
Subscribed topics:-
- /depth camera/rgb/image raw: Gets the raw RGB image from the camera
- /depth camera/depth/points: Gets the pointcloud from the depth camera
-
Published topics:-
- /image/road seg : Image of the segmented road
- /drone way : The next waypoint in the drone frame
- Subscribed topics:-
- /drone way : Gets the next waypoint in the drone frame.
- /mavros/local position/odom : Odometry of the drone
- /mavros/home position/home : Odometry of the home position
- Published topics:-
- /mavros/setpoint position/local : For publishing waypoints in the ground frame. then launch
-
The current files have paths set in accordance with the assumption that you have your ardupilot and ardupilot_gazebo in the home directory. If otherwise, head over to world.launch and change the ardupilot_gazebo_path. For running the simulation after mapping in
~/drdo22_ws/src/inter_iit_uav_guided_ugv/interiit22/world/drdo_<world-name>.world
, changemodel://<world_name>
tomodel://<world_name>_mesh
at line 19. -
To start the UGV simulation:
roslaunch interiit22 drdo_<world_name>.launch
-
For ArduCopter connection, in another terminal:
sim_vehicle.py -v ArduCopter -f gazebo-iris
Wait until this print on the terminal
[ INFO] [1647367092.856149039, 63.285000000]: FCU: EKF2 IMU0 is using GPS [ INFO] [1647367092.857438349, 63.286000000]: FCU: EKF2 IMU1 is using GPS
-
For drone takeoff:
Launch QGC and go to the safety settings, scroll to the bottom and uncheck the "all" option in arming safety checks. Just tick the GPS lock option and close. Wait for GPS lock, and then launch QGC to manually arm the drone for take-off. QGC automatically hovers the drone at 10m, ensure to manually increse the drone height to 16-18m.
-
For Prius detection and localization, in another terminal run:
roslaunch prius_detector default.launch
-
To publish the mean path extracted by the drone, in another terminal run:
cd ~/drdo22_ws/src/inter_iit_uav_guided_ugv/prius_controller/scripts python path_publisher.py
It will prompt to enter the world number. Enter 1 or 2.
-
Run the pure persuit controller, in another terminal run:
cd ~/drdo22_ws/src/inter_iit_uav_guided_ugv/prius_controller/scripts python pure_pursuit_ros.py
-
To run the PID controller and the simulation, in another terminal run:
cd ~/drdo22_ws/src/inter_iit_uav_guided_ugv/prius_controller/scripts python PID_velocity_controller_ROS.py
This can also be used to run the simulation environment and connect iris to ArduPilot. Also it arms the drone and takes off. (For recordings we have used QGC).
roslaunch offboard default.launch
Wait until this print on the terminal
[ INFO] [1647367092.856149039, 63.285000000]: FCU: EKF2 IMU0 is using GPS
[ INFO] [1647367092.857438349, 63.286000000]: FCU: EKF2 IMU1 is using GPS
roslaunch offboard offboard_node.launch