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

how to make rosserial work with 32 bit micro controller. please help

asked 2013-03-17 14:33:03 -0500

packrat gravatar image

updated 2013-04-01 15:23:15 -0500

I have a max32 and I am trying to relay wheel encoder data from the max32 board to ros. The max32 is a arduino compatible device. It is almost identical to the arduino 2500 or the due, except the max32 is a pic32 and 32 bit. I tried rosserial_arduino, but looses connection and tries to reconnect. I'm not sure how to write a new hardware class for the chip kit. Or should I try to modify the arduino class? I am running ros groovy and Ubuntu 12.04 lts. thanks for any help you can give.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-04-05 10:01:09 -0500

danep gravatar image

Are you able to run a debugger to see why the connection is lost? If it's a 32-bit processor, my guess is that your chip-side program is segfaulting when rosserial tries to buffer serialized data, the reason being that memory access on non-8-bit platforms often has to be 'aligned' - e.g., the memory address has to be divisible by 32. The rosserial library doesn't take this into account.

It's kind of a non-trivial problem to fix, unfortunately. You can 'hack' it to work by adding arbitrary offsets to memory writes in the serialization function, so that the writes are aligned. What I did was to rip out the serialization function and replace it with Google's protocol buffers. Someone with formal knowledge of embedded programming (I'm a convert from mechanical engineering :) ) might be able to solve it better than me.

edit flag offensive delete link more


I did try your rosserial protobuff from git hub but sadly it did the same thing. I have looked at some of the files in MPIDE(chipkit's version of arduino ide) and all the serial data uses "uint8_t", if I read the code right, they are using ring buffers to read and store the data.

packrat gravatar image packrat  ( 2013-04-06 01:42:51 -0500 )edit

answered 2013-04-01 17:20:05 -0500

kalectro gravatar image

I do not have any experience with rosserial but I wrote a ROS implementation for this awesome library today. It will one day hopefully be part of the bosch_drivers but it will take a while before it will be released. If you are interested, I can ask my supervisor tomorrow if I can publish it. If your controller is arduino compatible, it should be very easy to use.


edit flag offensive delete link more

answered 2013-04-01 18:48:09 -0500

Although it does not use rosserial, I would strongly recommend you take a look at the ROS Arduino Bridge ( The nice thing about this package is that it communicates over the serial port without relying on rosserial_arduino. It is very easy to port from Arduino to any Arduino-compatible microcontroller.

I also found rosserial can be very slow... sending one message was taking about 1.8ms according to an oscilloscope. Because of that I could only publish about 30 Hz. Using the bridge approach, I was able to quickly improve that to about 500 Hz.

edit flag offensive delete link more


this library looks like it is doing something very similar to what I just did the last few days. We should definitely consider fusing both packages

kalectro gravatar image kalectro  ( 2013-04-02 04:47:32 -0500 )edit

How do I use the bridge to simply relay the encoder information?

packrat gravatar image packrat  ( 2013-04-02 12:39:52 -0500 )edit

If that is all you need, simply use the Serial.print commands in your Arduino code. There are many examples of Python code for reading serial commands. Here's a site with some good info

dougbot01 gravatar image dougbot01  ( 2013-04-02 19:12:30 -0500 )edit

Question Tools


Asked: 2013-03-17 14:33:03 -0500

Seen: 1,061 times

Last updated: Apr 05 '13