Arduino zero rosserial tutorial
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
Asked by gab27 on 2018-11-08 06:26:34 UTC
Answers
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
Asked by Aviad on 2018-11-13 00:28:32 UTC
Comments
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.
Asked by jdetwile on 2018-12-05 07:49:04 UTC
Comments
it's the problem in ArduinoHardware.h, check melodic version, it's fixed now after enable #define USE_USBCON
Asked by Lin Zhao on 2020-11-15 23:27:07 UTC
Comments
This worked for me! After looking everywhere for why I couldn't get it to work. I'm running an Adafruit Feather M0 Express, I think this fix should work for all SAMD boards.
Asked by haiben on 2022-02-25 14:26:02 UTC
This did not work for an Arduino Zero board!
Asked by gixsy on 2022-04-19 16:14:45 UTC
Comments
I am having a very similar issue, but with Arduino Due (see issue link). Maybe the same cause? No solution found yet...
Asked by gaetanauvray on 2018-11-09 10:47:43 UTC
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.
Asked by gab27 on 2018-11-09 15:24:11 UTC
@gab27 Could you share the solution that worked for you, please. Im stuck exactly at the same issue on Ubuntu 20.04 and ROS noetic
Asked by gixsy on 2022-04-19 16:16:22 UTC