For the demo (simulation + control system to interface with prototype).
- /src/arduino - Code to Program the Arduino
- /src/ros/gui - Code for the Web GUI
- /src/ros/sampler - Main Programming Logic/Algorithms
- /scripts - Any scripts to automate stuff (I haven't written any lel)
Feel free to add ROS packages if need to.
Tested on Ubuntu 18.04 LTS
-
Install MAVROS (Link SITL with ROS) (be mindful of ros version)
-
Install rosserial (Link Arduino with ROS) (be mindful of ros version)
sudo apt-get install ros-melodic-rosbridge-server
-
Follow this to setup your ROS environment. Essentially create a ~/catkin_ws folder, then clone this repo & copy its contents into ~/catkin_ws/src.
-
Build ROS Packages
cd ~/catkin_ws && catkin_make
source source ~/catkin_ws/devel/setup.bash
- Start SITL
Param | Name |
---|---|
-v | Vehicle |
-L | Location (defined in ardupilot/Tools/autotest/locations.txt) |
Copy locations.txt in this repo (locations/locations.txt) to location in above table.
sim_vehicle.py -v ArduCopter -L Delta
- Run ROS Launch File
This will
- Get ROS to interface to SITL Simulation prgoram
- Get ROS to interface with Arduino program
- Get ROS to interface with Web GUI
- Run ROS Main Code
Format
roslaunch sampler main.launch port:=<arduino port>
Example if Arduino is connected to computer's /dev/ttyACM0 port
roslaunch sampler main.launch port:=/dev/ttyACM0
NOTE: I might write a script to automate this later on.
- To see the GUI, launch a Web Server to open up /src/ros/gui/index.html. You can use the following
python -m SimleHTTPServer <port> <filename>
alternatively, if you use VSCode, you can "Go Live"