The main Arduino sketch file.
- ROS publishers and subscribers are set up here
- callbacks for ROS messages are defined here
- the
setup()function creates an instance of theContextclass, which is where the loop that you would expect inloop()happens
This is where everything comes together and all the magic happens.
Class definitions for the Commander class and its subclasses:
RCCommanderfor remote control modeJetsonCommanderfor autonomous and semiautomatic mode
Interrupts!
Header for the PID controller and three of the smaller classes dealing with hardware.
Proportional, integral, and derivative controller. Used for steering and drive motors.
The DCServo class for the steering servo and associated potentiometer.
RCDecoder class that translates signal from the remote control receiver into velocity and steering angle.
SpeedSensor class for calculating speed based on Hall Effect sensors.
sudo apt-get install arduino arduino-core # install Arduino IDE
sudo apt-get install ros-indigo-rosserial-arduino # install rosserial_arduino ROS package
Clone this repository into your Arduino sketchbook folder:
cd <ARDUINO_SHETCHBOOK>
git clone https://github.com/5yler/gigabug.git
Download the digitalWriteFast library file (direct .zip file link) and put it in the <ARDUINO_SHETCHBOOK>/libraries folder
Make sure you have the metatron repository cloned into a catkin workspace. For example:
mkdir -p ~/giga_ws/src/
cd ~/giga_ws/src/
catkin_init_workspace
git clone https://github.com/5yler/metatron.git
cd ~/giga_ws
catkin_make
source devel/setup.bash
Optionally add source ~/giga_ws/devel/setup.bash to your ~/.bashrc for convenience.
rosrun rosserial_arduino make_libraries.py <ARDUINO_SKETCHBOOK>/libraries
Your code should now compile!
