srmainwaring / curio_firmware

Firmware for the curio packages
Other
1 stars 2 forks source link
arduino radio-control ros rosserial rosserial-arduino sawppy

Firmware for Curio

An Arduino Mega 2560 rosserial_arduino client for controlling a Sawppy rover. To be used in conjunction with the curio packages.

Overview

The firmware implements an instance of a rosserial_client that runs on the Arduino and is managed by a rosserial node running on the rover's onboard computer.

The firmware provides:

Both functions can be enabled or disabled by compile time switches, and the radio control decoder can be configured to process either pulse width modulated signals or a radio control serial communication protocol called SUMD.

Dependencies

Installation

Here we describe how to build and install the firmware to your Arduino. In the following SKETCHBOOK_PATH is the path to your Arduino sketchbook directory.

Clone the repository into your catkin workspace, then build:

cd ~/curio_ws/src
git clone https://github.com/srmainwaring/curio_firmware.git
cd ~/curio_ws
catkin build

Build and install the ROS libraries for the Arduino:

cd ~/curio_ws
rosrun rosserial_arduino make_libraries.py .
cp -rp ./ros_lib SKETCHBOOK_PATH/libraries

Add a file ros_dummy.h to the ROS Arduino library in SKETCHBOOK_PATH/libraries/ros_lib/ containing the following:

// ros_dummy.h
// A placeholder so that the Arduino IDE can find header files
// in subdirectories of ros_lib when re-declaring ros.h 
// in your project
//
// In your copy of ros.h include this file. 
//
// Resources:
//  http://wiki.ros.org/rosserial_arduino/Tutorials/NodeHandle%20and%20ArduinoHardware
//  https://www.codeproject.com/Articles/1279552/Rodney-A-Long-Time-Coming-Autonomous-Robot-Part-7

#ifndef _ROS_LIB_ROS_DUMMY_H_
#define _ROS_LIB_ROS_DUMMY_H_

namespace ros {
}

#endif // _ROS_LIB_ROS_DUMMY_H_

(My thanks to Phil Hopley's excellent blog for his explanation of why this is is needed).

Copy the firmware source to the sketchbook folder:

cp -rp `rospack find curio_firmware`/firmware/curio_firmware SKETCHBOOK_PATH/curio_firmware

From the Arduino IDE open the sketch and adjust configuration settings described in the section below as required. Finally compile the sketch and download it to your Arduino.

Configuration

The main sketch file curio_firmware.ion contains the following configuration flags:

ENABLE_ARDUINO_LX16A_DRIVER

Note that the corresponding flag in curio_base/src/base_controller.py must also be set.

ENABLE_RADIO_CONTROL_DECODER

ENABLE_RADIO_CONTROL_SUMD

Hardware

The following wiring instructions apply to the Arduino Mega 2560.

Lewansoul BusLinker

Radio control receiver

SUMD

PWM

Usage

See the documentation for curio.

ROS

The parameters, publications and subscriptions supported are affected by the configuration settings. For instance if radio control is disabled the curio_msgs::Channels messages will not be published.

Parameters

Publications

Subscriptions

License

This software is licensed under the BSD-3-Clause license found in the LICENSE file in the root directory of this source tree.