ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Arduino publish Odom

asked 2019-11-08 08:25:13 -0500

mateusguilherme gravatar image

updated 2019-11-08 09:03:53 -0500


Arduino MEGA 2560 can publish odometry values (nav_msgs/Odometry.msg)?

I am using an H-bridge that is connected to arduino and the arduino connected to raspberryPi. I'm using ros_serial communication between arduino and raspbery.

What is advised?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-11-09 04:06:53 -0500

parzival gravatar image

updated 2020-03-19 08:20:04 -0500

Yes you can publish any message type from your arduino. You need to write a .ino script to do so. Make sure you include the following lines:

#include <ros.h>
#include <nav_msgs/Odometry.h>

at the top before the line

#include "Arduino.h"

Edit: The rosserial library even has an example sketch named Odom. You can check it out.

edit flag offensive delete link more


I was able to implement the arduino odometry, but the rate was very low, around 8 hz. So I made arduino publish geometry_message / Twist and calculate odometry on a python node in raspberry (got rates around 100hz). I think the nav_message / Odometry message is too much for arduino to process


mateusguilherme gravatar image mateusguilherme  ( 2019-11-09 16:33:59 -0500 )edit

Yes, it is better to keep arduino scripts light, mostly for input and output, and let main computer handle the computation to be done with that data.

parzival gravatar image parzival  ( 2019-11-09 21:53:44 -0500 )edit

Question Tools



Asked: 2019-11-08 08:25:13 -0500

Seen: 596 times

Last updated: Mar 19 '20