I am using teensy with rosserial + ROS Noetic/Ubuntu 20.04 on RASPI4. The teensy code is implemented with ros_lib on platformio (https://platformio.org/lib/show/5526/...). The program compiles fine and uploads successfully on port /dev/ttyACM0
. However, when I do rosrun rossserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=500000
then I get the sync failed error.
[ERROR] [1612795964.166906]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino.
Things I have already tried:
a) Setting correct baudrate in Serial.begin(500000)
b) Disabling all Serial.begin
and Serial.print
statements
c) Setting baudrate of ros node nh.gethardware()->setbaud(500000)
before nh.init()
d) Increasing the default buffer size to 1024 in ros.h of ros_lib
typedef NodeHandle_<arduinohardware, 10,="" 10,="" 1024,="" 1024=""> NodeHandle;
e) Tried the Arduino board instead of Teensy and the problem still remain.
However, nothing has worked so far.
The default baud rate for rosserial is 56700. For changing it you will need to do the following
Modify the include statement in the arduino code from
to
Add the following header files alongside the .ino/.pde file
ros.h
ArduinoHardware.h
In the ArduinoHeader.h file we defined above the iostream & the baud rate to be used is set using the constructor as shown below
as you are using teensy with USB the iostream will be
Serial
. If you are using the pins and not the USB it will vary fromSerial1
toSerial8
as mentioned here. The baud rate of the teensy can be varied by varying thebaud_
here set to 500000.This code is referenced from Advanced Configuration for NodeHandle and ArduinoHardware