Compile and flash code for Arduino Mega 2560, Adafruit Motorshield V2, and stepper motors to operate EZ-RASSOR rover.
TODO: Check out the instructions for building the EZ-RASSOR rover. Instructions are WIP.
- Ubuntu 18.04
- EZ_RASSOR
- Arduino-Mk
- Arduino IDE
- ROSSerial for Arduino (ROS Melodic)
- ros_lib Arduino Library
- `Adafruit MotorShield V2`_ Arduino Library
- AccelStepper Library
Do NOT install Arduino IDE or the Arduino-Mk package using Ubuntu's APT package manager (i.e. "sudo apt install ..."). Doing this mistakenly installs outdated libraries and dependencies that are required for the Arduino firmware.
To install the Arduino IDE, please follow the Ubuntu's Arduino IDE installation tutorial.
To install Arduino-Mk, follow the installation from source instructions from the Arduino-Mk Github repository.
IMPORTANT: Make note of the installation directory of both Arduino IDE and Arduino-Mk.
Connect Arduino Mega 2560 to your computer via serial USB connection.
Option 1: GUI using Arduino IDE
Clone or download this repository to directory of your choice.
git clone https://github.com/ffermo/EZ-RASSOR_ArduinoLaunch the Arduino IDE. Select 'File' then 'Open...'. Locate EZR_Mega2560.ino from the cloned or downloaded respository and click 'Open'. The IDE will ask you to move and create a folder for the .ino file. Select 'Ok'.
To include the necessary libraries, you can either use Arduino IDE's library manager or manually add them from the libraries folder.
Click the checkmark button to compile.
Click the right arrow button to upload to Mega.
The Arduino Mega is now flashed!
Option 2: Terminal using Arduino-Mk
This method is useful and preferred when Arduino is connected to a computer (Jetson Nano or Raspberry Pi) with no display and remote development in necessary (SSH).
cd /home/$USER
git clone https://github.com/ffermo/EZ-RASSOR_Arduino
cd EZ-RASSOR_ArduinoIMPORTANT: Before attempting to compile and upload, be sure to review the Makefile in the root directory. Depending on where you installed the Arduino IDE and Arduino-Mk, the Makefile will need to be edited to fit your environment.
Compile and upload code to Mega.
make
make uploadIf "serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'", read write permissions needs to be set for Arduino.
sudo chmod a+rw /dev/ttyACM0During upload procedure, it should print
"avrdude done. Thank you."The Arduino Mega is now flashed!
Keyboard Control
The steps below launch the EZ-RASSOR keyboard communication software package to operate the rover. 2 terminals minimum are required for this step. Launch file to streamline this process is currently WIP.
Terminal 1:
roslaunch ezrassor_launcher configurable_communication.launch control_methods:="keyboard"Terminal 2:
rosrun rosserial_python serial_node.py /dev/ttyACM0 _baud:=115200(Optional) Terminal 3 to view topics being sent to Arduino:
rostopic echo /wheel_instructionsYou're all set! Stepper motors should be turning based on keyboard instructions. Be sure to check out the EZ_RASSOR repository to learn more about the capabilities of this project.