Skip to content

JimmeeX/mman4020-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS | Ardupilot + SITL | Arduino Interface

For the demo (simulation + control system to interface with prototype).

Project Structure

  • /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.

Installation

Tested on Ubuntu 18.04 LTS

  1. Install SITL & Mavproxy

  2. Install ROS

  3. Install MAVROS (Link SITL with ROS) (be mindful of ros version)

  4. Install Arduino IDE, to program the Arduino

  5. Install rosserial (Link Arduino with ROS) (be mindful of ros version)

  6. Install rosbridge-server (Link ROS to Web GUI)

sudo apt-get install ros-melodic-rosbridge-server
  1. Follow this to setup your ROS environment. Essentially create a ~/catkin_ws folder, then clone this repo & copy its contents into ~/catkin_ws/src.

  2. Build ROS Packages

cd ~/catkin_ws && catkin_make
source source ~/catkin_ws/devel/setup.bash

Usage

  1. 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
  1. 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.

  1. 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"