Buttonui-ros-pkg

From Sluggish Software Wiki

Jump to: navigation, search

Author/s: Bob Mottram

Platforms: Linux

Began: 2011

Languages: C++

License: BSD

Hosted at: Launchpad

Contents

Summary

This implements a button and audio based user interface for use with robots running ROS. Buttons are used to cycle through a list of locations, to learn new map locations and also to instruct the robot to move to particular locations. Since no display is required this user interface could be applied in challenging or high usage environments, and can also be implemented at low cost using an Arduino. It's also much simpler than running heavyweight user interfaces such as Rviz.

Moving stuff at low speed from one place to another within a building can be a business model in some cases, such as hospitals, warehouses, shops and supermarkets. This interface makes those kind of robotics applications easier to implement, and would require negligible operator training.

Ingredients

  • 1 x Arduino (Any model will do, so long as it has at least 5 digital inputs)
  • 1 x USB cable to connect to the Arduino
  • 5 x 10K resistors
  • 5 x Normally open button switches
  • A bunch of wire
  • Solder and a soldering iron
  • A box to put it all in

Circuit Diagram

Button switches are connected to the arduino in the following manner, using a 10K resistor. In my case I used an Arduino Mega 1280 and pins 22-26 as digital inputs.

Construction

Here is a picture showing the five button switches connected to an Arduino with some 10K resistors. If your wires aren't thick enough to be retained within the sockets then paperclips are about the right gauge, and these can be soldered onto your wire.


The Arduino and switches can then be contained inside a box. Here I made a box out of some hardboard and aluminium brackets.


The switchbox mounted onto a Turtlebot. Buttons are labeled:

  • Start
  • Stop
  • Set
  • Location
  • Learn

Flow Diagram

Installation

Programming the Arduino

There is an Arduino IDE which can be found in the software center of Ubuntu, or which can be downloaded from the main arduino web site. Load the pde file which is contained in the arduino directory and if necessary alter the digital input pin numbers within the buttonPin array.

Make sure that you select the appropriate model type and communications settings for your Arduino from the menu, then save and upload the program.

Use the serial monitor to check that when you press a button a number appears. When no buttons are pressed you shouldn't see anything happening in the serial monitor window.

Compilation of the ROS package

To compile the package.

  1. Make a directory called buttonui
  2. Copy these files into the buttonui directory
  3. Add the path to this directory to the ROS packages path, usually located in /opt/ros/<rosversion>/setup.sh (binary installation) or ~/ros/setup.sh (source installation)
  4. rosmake --pre-clean --rosdep-install buttonui

Also you'll need to install espeak.

 sudo apt-get install espeak

Testing Buttons

Edit buttonuitest.launch and buttonui.launch and check that the device path and communication settings are correct for the Arduino.

It's worth checking that the buttons are wired up as you expect them to be. You can find the index numbers within buttonuitest.launch. Use this launcher to ensure that when you press a button the ROS info message which is displayed is appropriate.

 roslaunch buttonuitest.launch

If changes need to be made then edit the launch file accordingly. Once all buttons are working then you can copy the index number parameters over to the buttonui.launch file.

You should then include buttonui.launch within your main navigation launch file. An example is shown as follows:

 <launch>
   <include file="/home/turtlebot/params.launch" />
   <include file="$(find turtlebot_bringup)/base.launch" />
   <include file="$(find turtlebot_bringup)/kinect.launch" />
   <arg name="map_file" default="/home/turtlebot/maps/current/ros_map.yaml"/>
   <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
   <include file="$(find turtlebot_navigation)/config/move_base_turtlebot.launch" />
   <include file="$(find turtlebot_navigation)/config/amcl_turtlebot.launch" />
   <include file="$(find buttonui)/buttonui.launch" />
 </launch>

Usage

This assumes that you've already generated a map and are able to navigate the robot by setting goal locations within Rviz.

Teaching

First of all edit buttonui.launch and define a set of locations within the placenames parameter. These will be the locations that you wish the robot to visit.

Press the start button, and you should hear the robot say "started". If you don't then check that espeak is installed correctly.

Initially you'll need to run Rviz and set the initial pose of the robot. Use the teleoperation system to manually drive the robot to the desired locations. Any hand held device capable of running ssh, such as a netbook or mobile phone, should be sufficient for keyboard based teleoperation.

When the robot is at a location that you wish it to learn then press the location button until you find the current place, then press the learn button twice (this is to help prevent accidental presses). You should hear the robot say that it has remembered the location. Repeat this for however many locations you've specified within the launch file.

Navigating

If you've just started the robot then first press the start button. The robot should say "started".

Place the robot at one of the locations and in the same orientation as it was during the teaching phase. Select the appropriate location by pressing the location button, then press the set button. This sets the robot's initial pose within the map.

Press the location button again to set the goal location, then press the start button. The robot should then try to navigate to the goal. If it can't find a path to the goal then it will say so, and stop.

Once the robot has arrived at a goal location then it will automatically increment the goal location to the next one in the list which you specified within the launch file placenames parameter. This means that just pressing the start button will keep the robot navigating through the locations list in a stepwise fashion, which may be useful for round trip delivery type situations.

Personal tools