Ask Your Question
0

Arduino zero rosserial tutorial

asked 2018-11-08 05:26:34 -0600

gab27 gravatar image

updated 2018-11-18 03:08:00 -0600

Hi

I have an arduino zero, connected to native port, Arduino IDE 1.8.7, Ubuntu 18.04 and ROS melodic.

I did the rossserial arduino tutorial Hello World, to publish something to a ros topic. link text

My commands:

roscore

separate terminal

rosrun rosserial_python serial_node.py  _port:=/dev/ttyACM0 _baud:=57600

The command window shows this:

[INFO] [1541675538.966820]: ROS Serial Python Node
[INFO] [1541675538.978137]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1541675541.090206]: Requesting topics...
[ERROR] [1541675556.094888]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

If think I have tried nearly everything. deinstall and install it, switched the computer off and on, tried with multiple baudrates (it is not hardcode in the .ino file, since I use the file form the tutorial, checked the usb port, tried commands, #define USE_USBCON, ros::spinOnce(), tried to set the baudrate in the .ino file: nodehandle.getHardware()->setBaud(57600);

Nothing works and more surprisingly if I do the same procedure with an Arduino Uno it works. They should have the same architecture?

Does someone know where the mistake could be?

Thanks

edit retag flag offensive close merge delete

Comments

I am having a very similar issue, but with Arduino Due (see issue link). Maybe the same cause? No solution found yet...

gaetanauvray gravatar imagegaetanauvray ( 2018-11-09 09:47:43 -0600 )edit

I try since two weeks and no solution in sight.. Could be that it is the similar issue, but I don't know. But after you push the reset button it works? not in my case.

gab27 gravatar imagegab27 ( 2018-11-09 14:24:11 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-11-12 23:28:32 -0600

Aviad gravatar image

Hi, check if there are some "Serial" (for example: Serial.begin) command in the arduino code. you can't communicate with both ros and serial. comment the Serial's commands and try again.

good luck

edit flag offensive delete link more
0

answered 2018-12-05 06:49:04 -0600

updated 2018-12-05 16:53:28 -0600

EDIT: I may have found it?

I find that the MKR Zero is expecting to communicate with ROS on its Serial1 object, which is exposed on Pins 13/14, rather than the Serial object exposed on the onboard USB connector. And, when I connect a USB/TTL cable to those pins, and launch with _port:=/dev/USB0, the demo code works as intended.

In troubleshooting, I looked at the library code in ros_lib/ArduinoHardware.h and added Serial.print() statements to my code to see which compiler directives are being executed. It appears that USBCON is #define'd and USE_USBCON is not. This logical combination compiles the statement "iostream=&Serial1". The resulting behavior is as I describe above.

= = = = This (below) was my previous answer = = = = Same problem here. If anyone has success, please share!

(I use the tutorial code as is; and it has no Serial.begin(). Thanks anyway for the suggestion!)

My hardware is the Arduino "MKR Zero", and the software environment is ROS Kinetic on Ubuntu 16.04LTS.

I, also, have demonstrated the tutorial code with the Arduino Uno as well as other Arduino variants. Of course, it is not strictly true that the Zero has "the same architecture" as the Uno. For example, you realize that the Arduino IDE must be -- and mine has been -- updated to handle the new "board type."

FWIW: I have other ROS 'sketches' which do run on the Uno, all of which fail on the Zero (with the same error type). I bought the Zero because the Uno's RAM was inadequate for any but the most trivial ROS functionality.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-11-08 05:26:34 -0600

Seen: 789 times

Last updated: Dec 05 '18