Only released in EOL distros:
Package Summary
ROS Arduino Python
- Author: Patrick Goebel
- License: BSD
- Source: git git://github.com/hbrobotics/ros_arduino_bridge.git (branch: None)
Package Summary
ROS Arduino Python
- Author: Patrick Goebel
- License: BSD
- Source: git git://github.com/hbrobotics/ros_arduino_bridge.git (branch: None)
Package Summary
ROS Arduino Python
- Author: Patrick Goebel
- License: BSD
- Source: git https://github.com/hbrobotics/ros_arduino_bridge.git (branch: groovy-devel)
Package Summary
ROS Arduino Python.
- Maintainer: Patrick Goebel <patrick AT pirobot DOT org>
- Author: Patrick Goebel
- License: BSD
- Source: git https://github.com/hbrobotics/ros_arduino_bridge.git (branch: hydro-devel)
Package Summary
ROS Arduino Python.
- Maintainer: Patrick Goebel <patrick AT pirobot DOT org>
- Author: Patrick Goebel
- License: BSD
- Source: git https://github.com/hbrobotics/ros_arduino_bridge.git (branch: hydro-devel)
Contents
Overview
This package consists of a Python driver and ROS node for Arduino-compatible controllers. The Arduino must be connected to a PC or SBC using either a USB port or an RF serial link (e.g. XBee).
Features
- Direct support for the following sensors:
- Ping sonar
- Sharp infrared (GP2D12)
- Onboard Pololu motor controller current
- Phidgets Voltage sensor
- Phidgets Current sensor (DC, 20A)
- Can also read data from generic analog and digital sensors
- Can control digital outputs (e.g. turn a switch or LED on and off)
- Support for PWM servos
- Configurable base controller if using the required hardware.
Arduino Node
arduino-node.py
A ROS node for Arduino-compatible microcontrollers. Sensors can be polled at independent rates (see sample config file at the end of this page.) For example, main voltage could be polled at 1 Hz while a sonar sensor could be polled at 20 Hz.Subscribed Topics
/cmd_vel (geometry_msgs/Twist)- Movement commands for the base controller.
Published Topics
/odom (nav_msgs/Odometry)- Odometry messages from the base controller.
- An array of sensor names and values.
- Each sensor value is published on its own topic under the "sensor" namespace with the appropriate type. See sample config file below for examples.
Services
~servo_write (ros_arduino_msgs/ServoWrite)- Set the target position of a servo with index 'id' to 'value' (in radians). The 'id' to pin mapping is made in the Arduino firmware.
- Get the last set position (in radians) from the servo with index 'id'.
- Sets a digital pin to INPUT (0) or OUTPUT (1)
- Sets a digital pin either LOW (0) or HIGH (1)
Parameters
~port (str, default: /dev/ttyUSB0 -- some controllers use /dev/ttyACM0)- Serial port.
- Baud rate for the serial connection.
- Timeout for serial port in seconds.
- Rate to run the main control loop. Should be at least as fast as the faster sensor rate.
- Rate to publish the overall sensor array. Note that individual sensors are published on their own topics and at their own rate.
- Whether or not to use the base controller.
- Rate to publish odometry data.
- Link to use as the base link when publishing odometry
- Wheel diameter in meters.
- Wheel track in meters. (Distance between centers of drive wheels.)
- Encoder ticks per wheel revolution.
- External gear reduction.
- Reverse the sense of wheel rotation.
- Proportial PID parameter.
- Derivative PID parameter.
- Integral PID parameter.
- Output PID parameter.
- Max acceleration when changing wheel speeds
- Dictionary of sensors attached to the Arduino. (See the sample YAML config file below.)
Provided tf Transforms
odom → base_link- Transform needed for navigation.
Configuration
The Arduino node is configured using a YAML file specifying the required parameters. A sample parameter file called arduino_params.yaml is included in the config directory and is shown below. Make a copy of this file(e.g. my_arduino_params.yaml) before editing. Note that many of the parameters are commented out and must be set and un-commented before you can use the node with your Arduino.
Current valid sensor types names (case-sensitive):
- Ping
- GP2D12
- Analog (generic)
- Digital (generic)
PhidgetsCurrent (20 amps, DC)
port: /dev/ttyUSB0 baud: 57600 timeout: 0.1 rate: 50 sensorstate_rate: 10 use_base_controller: False base_controller_rate: 10 # === Robot drivetrain parameters #wheel_diameter: 0.146 #wheel_track: 0.2969 #encoder_resolution: 8384 # from Pololu for 131:1 motors #gear_reduction: 1.0 #motors_reversed: True # === PID parameters #Kp: 20 #Kd: 12 #Ki: 0 #Ko: 50 #accel_limit: 1.0 # === Sensor definitions. Examples only - edit for your robot. # Sensor type can be one of the follow (case sensitive!): # * Ping # * GP2D12 # * Analog # * Digital # * PololuMotorCurrent # * PhidgetsVoltage # * PhidgetsCurrent (20 Amp, DC) sensors: { #motor_current_left: {pin: 0, type: PololuMotorCurrent, rate: 5}, #motor_current_right: {pin: 1, type: PololuMotorCurrent, rate: 5}, #ir_front_center: {pin: 2, type: GP2D12, rate: 10}, #sonar_front_center: {pin: 5, type: Ping, rate: 10}, arduino_led: {pin: 13, type: Digital, rate: 5, direction: output} }
Example Launch File
<launch> <node name="arduino" pkg="ros_arduino_python" type="arduino_node.py" output="screen"> <rosparam file="$(find ros_arduino_python)/config/my_arduino_params.yaml" command="load" /> </node> </launch>
Usage Notes
- Be sure to put your robot on blocks before first trying the base controller
If you mess up your parameters in a given session, just do a:
rosparam delete /arduino
The driver requires Python 2.6.5 or higher and PySerial 2.3 or higher. It has been tested on Ubuntu Linux 10.04 (Maveric) and 11.10 (Oneric).