3D Robotics

ROS+Arduino update

3689390988?profile=originalAs we've mentioned before, our long term plan for ArduPilot includes it being compatible with Willow Garage's Robot Operating System as a "ROS Node", which is to say that it can communicate with ground computers running ROS for things like swarming and multi-UAV control. The Willow Garage team is supporting this, too, and here's their latest update on Arduino+ROS progress:

 

We recently wanted to hook up an analog gyro (the Analog Devices ADXRS614) to ROS, and decided to use an Arduino to handle the conversion.

The Arduino runs a tiny loop that reads the analog values from its six analog lines,and writes these values to the USB serial connection.  Meanwhile on the robot, a small ROS Python node listens to the USB reports, and publishes them as a ROS topic.

That's all there is to it: the whole thing takes under 40 lines of code.

This is probably the simplest possible way to use an Arduino with ROS.  There are quite a few more sophisticated projects:

  • pmad  - controls an Arduino's I/Os using ROS service calls
  • avr_bridge - automates generation of ROS-Arduino message transport
  • arduino - our own package: an Arduino as an Ethernet-connected ROS node
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Developer
    After having reread my previous post, now a couple of days later. I hope I did not come of as a ... in the .... Just to be clear I think Arduino is a very, very cool concept and use it all the time. And it is perfect for quick prototyping like the sensor data conversion mentioned above. But my point is/was that we have to be aware of the limitations that comes with the simplicity of Arduino. And the ADC conversion performance in the above project is a good example of this. My preferred usage is to use Arduino to build a working framework (like above), and then insert AVR "code" for built in hardware features like timers, interrupts & pwm where the performance gain is worth it. Such projects still compile using the original Arduino IDE. But will not work on all Arduino boards without modification, since they have different hardware capabilities.
  • I'll echo what John said. Especially for a single axis gyro, you can sample it at 10 kHz or more to get very little drift. To do this, you use a free running ADC that is interrupt driven and runs in the background. I have arduino code to set this up if anyone is interested.
  • Developer

    I Iike simple, but sometimes it comes at a price.

    The 40 line Arduino analogRead() / Serial.print method is a very inefficient way of reading the ADC inputs. At 115200 baud the example above will be able to read each gyro about 350-400 times a second. Maybe this is good enough, but I suspect you will eventually run into problems with excessive gyro drift because of the relatively infrequent reading of gyro values.

    On the other hand, if you are willing to step around some of the Arduino limits by programming directly for the AVR chip. You can use a free running ADC interrupt to read each GYRO sensor many thousand of times each second. Accumulating those values, you get a much more accurate gyro reading for transmission to the ROS unit.

  • If you want an immediate solution, I'd like to highlight the already existing MAVLink to ROS node, which immediately enables ArduPilotMega to ROS connections with the current APM code trunk. We have used it so far just to connect MAVCONN to ROS, but added, since this seems a hot topic, a serial interface process that will directly connect APM with ROS. This is work in progress, but will be finishes within the next 1-2 days - we would like to encourage testers to get in touch with us:

     

    https://github.com/pixhawk/mavlink-ros-pkg

    pixhawk/mavlink-ros-pkg
    MAVLink / MAVCONN to ROS adapter package. Contribute to pixhawk/mavlink-ros-pkg development by creating an account on GitHub.
This reply was deleted.