running rossserial on an Arduino MKR ZERO

asked 2022-07-30 13:59:14 -0600

BrianS gravatar image

What is the recommended way to get rosserial to work on an Arduino MKR ZERO board?

My experience is rosserial runs without issus on an Arduino UNO but rosserial fails on an Arduino MKR ZERO.

I'm on Ubuntu 20.04 connected via USB to an Arduino MKR ZERO. When I run rosrun rosserial_python serial_node.py /dev/ttyACM0 I get this error:

[ERROR] [1659201314.552018]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

The Arduino IDE can successfully download/run an example ROS command on my Arduino ZERO. But rosserial_python serial_node.py /dev/ttyACM0 on that board always gets the above error. I checked the baud rate using stty -F/dev/ttyACM0. I tried setting various baud rates (9600, 57600, 11520, etc.) in the command; eg, rosrun rosserial_python serial_node.py /dev/ttyACM0 _baud:=57600. It always gets the error.

I can get it to work following Capt_Crunch's suggestion in Rosserial_python on samd21. It looks to me like his code uses SerialUSB instead of the other serial classes. Should that be part of ROS?

FWIW: as best I can tell this applies to all the Arduino boards using the SAMD21 / Cortex MO; eg, Arduino Zero, MKR-ZERO, MKR-1000, MKR-1010, etc.

DETAILS

I'm following the instructions in How to Connect Arduino to ROS. In summary:

I ignore the VirtualBox instructions since I'm already directly running on Ubuntu.

  • Install ROS

    • sudo apt-get install ros-noetic-rosserial-arduino
    • sudo apt-get install ros-noetic-rosserial
  • Start ROS and run a sample ROS command

    • roscore
    • Go to File -> Examples -> ros_lib and run Blink
    • this works
  • Run a ROS node that accepts commands to toggle LED

    • rosrun rosserial_python serial_node.py /dev/ttyACM0
    • this works on an UNO
    • this fails on an MKR ZERO without the patch
    • this works on an MKR ZERO with the patch
  • Run a ROS command to send a toggle LED command (once the node above is working)

    • rostopic pub toggle_led std_msgs/Empty --once
edit retag flag offensive close merge delete