Lost sync with device.. restarting

asked 2019-07-18 03:23:41 -0500

dimaluigi gravatar image

Hi everybody i'm facing some problems using rosserial: i'm using an MKR WAN 1300 that is receiving CAN packets from an external CAN network and act like a bridge sending each packet received to my pc using a ros topic called "fromarduino". Then from a python script it will receive the data in the opposite direction subrscibing a topic called "fromros". All that just describe the situation in a synthetic way. The definition of a single message is the following "RosInfo":

uint32 id
uint8 lenght
uint8[] value
uint64 timestamp

After uploading the sketch on the MKR i bound it to ros lunching the following command from the terminal:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM3 _baud:=115200

and then i get:

[INFO] [1563436852.586977]: ROS Serial Python Node
[INFO] [1563436852.592940]: Connecting to /dev/ttyACM3 at 115200 baud
[INFO] [1563436854.698252]: Requesting topics...
[INFO] [1563436854.808310]: Note: publish buffer size is 512 bytes
[INFO] [1563436854.809391]: Setup publisher on fromarduino [agrosbuspkg/RosInfo]
[INFO] [1563436854.814382]: Note: subscribe buffer size is 512 bytes
[INFO] [1563436854.815542]: Setup subscriber on fromros [agrosbuspkg/RosInfo]

up to here seems working fine but after a while I always get a strange behavior. Sometimes i get a Lost sync, sometimes a wrong chk sum for id and msg, sometimes I/O error and sometimes:

[WARN] [1563437542.449205]: Last read step: syncflag
[WARN] [1563437542.451934]: Run loop error: Serial Port read failure: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

it really changes everytime. Oh and the serial monitor on the arduino IDE starts to print strange stuff right when i bound the board with the previous command. I run out of ideas and tests to understand this. Is there someone faced the same problem? Thank you all in advance.

edit retag flag offensive close merge delete