(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Creating a Simple Hardware Driver

Description: This tutorial shows how to create a simple hardware driver that connects via serial to a Parallax RFID Card Reader.

Tutorial Level: INTERMEDIATE

This tutorial is under construction



This tutorial will show how to create a simple hardware driver for the Parallax RFID card reader that broadcasts RFID transponder tag IDs on a topic when they are detected. This information can then be used in a variety of ways by other nodes to identify people, objects or locations.


If you haven't done so already, create a directory for your repository and add it to your ROS_PACKAGE_PATH. To make the change permanent you can add the export statement to your .bashrc after it sources the setup.bash file.

$ cd ~/ros
$ mkdir mylab-ros-pkg
$ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros/mylab-ros-pkg

Next create a separate stack to contain RFID related packaged.

$ cd ~/ros/mylab-ros-pkg
$ roscreate-stack mylab_rfid

Next edit ~/ros/mylab-ros-pkg/mylab_rfid/stack.xml file to have the appropriate information.

  <description brief="mylab_rfid">RFID Driver and Tools</description>
  <author>Maintained by My Robotics Lab</author>
  <review status="unreviewed" notes=""/>
  <depend stack="ros" />

Since we want to use libserial to talk to the serial port we need to add that as a dependency. First we can check if it defined anywhere else.

$ rosdep where_defined libserial

Since dependencies are handled at the stack level we need to edit ~/ros/mylab-ros-pkg/mylab_rfid/rosdep.yaml so that it looks like this.

  ubuntu: libserial-dev
  debian: libserial-dev

Next we create the package for the driver. Since we will be writing it in C++, we specify roscpp as a dependency.

$ roscreate-pkg parallax_rfid roscpp

Switch to the package directory and we can begin setting up the package.

$ cd ~/ros/mylab-ros-pkg/mylab_rfid/parallax_rfid

The manifest.xml file in ~/ros/mylab-ros-pkg/mylab_rfid/parallax_rfid should look something like this.

  <description brief="Parallax RFID Card Reader">
    Driver for Parallax 125kHz RFID Card Reader
  <author>Me Myself</author>
  <review status="unreviewed" notes=""/>
  <depend package="roscpp"/>
  <rosdep name="libserial"/>

Next, wait for the rest of the tutorial to be written

Wiki: ROS/Tutorials/Creating a Simple Hardware Driver (last edited 2011-03-06 23:01:55 by I Heart Robotics)