houseofbigseals / ros_farmer_arduino_node

0 stars 0 forks source link

every time fng errors with arduino connection #1

Open houseofbigseals opened 3 years ago

houseofbigseals commented 3 years ago

everytime: 2020-09-12 01:02:02 | Lost sync with device, restarting...

rarely: +--------------+---------------------+-------------------------------------------------------------------------------------------------- | node | time | msg | +--------------+---------------------+-------------------------------------------------------------------------------------------------- | /serial_node | 2020-09-12 00:30:36 | Last read step: data
| /serial_node | 2020-09-12 00:30:36 | Run loop error: Serial Port read failure: Returned short (expected 22 bytes, received 15 instead). | +--------------+---------------------+--------------------------------------------------------------------------------------------------

houseofbigseals commented 3 years ago

possible solutions:

1) https://github.com/tonybaltovski/ros_arduino/issues/10

There are a few things that cause this issue. They are mainly related to data speed of your connection and how cluttered the USB connection gets.

You should verify you aren't running any other program on your serial port that is why I had issues with GORT as it was taking up all the bandwidth on the serial connection. Also if you are trying to power something more than just a board or are using a wireless connection this error can also appear. For example I still get this error when my bluetooth vehicle goes to far away from the transmitter as data packets get lost in transmission.

How many things are you trying to publish and subscribe and what is the data types? are you publishing arrays or just ints or bytes. And I take it you know the command NodeHandle_<ArduinoHardware, 5, 5, 1024, 1024> NodeHandle; is setting up 5 subscribers and 5 publishers each with 1024 bytes. Meaning if you have more subscribers or publishers than 5 of either you could be running into buffer flow.

If this doesn't fix your problem an explanation of what you are trying to achieve, data types, commands, hardware etc will help the community in diagnosing the problem.

2) https://github.com/OpenAgricultureFoundation/openag_brain/issues/167

TODO check code again and again

houseofbigseals commented 3 years ago

when we got "Lost sync with device, restarting... " error we just have to kill all nodes and start again - we dont need to reboot RPI or arduino.

houseofbigseals commented 3 years ago

got read code from https://github.com/ros-drivers/rosserial/blob/melodic-devel/rosserial_python/src/rosserial_python/SerialClient.py
and then read all errors and messages in serial_node logs around moment of err: so, we have no other errors or messages)
It looks like: rosout][INFO] 2020-09-21 00:35:31,388: si7021_1_hum_pub [rosout][INFO] 2020-09-21 00:35:31,404: si7021_1_temp_pub [rosout][INFO] 2020-09-21 00:35:31,480: bmp180_1_pressure_pub [rosout][INFO] 2020-09-21 00:35:31,494: bmp180_1_temp_pub [rosout][INFO] 2020-09-21 00:35:32,397: si7021_1_hum_pub [rosout][INFO] 2020-09-21 00:35:32,407: si7021_1_temp_pub [rosout][INFO] 2020-09-21 00:35:32,489: bmp180_1_pressure_pub [rosout][INFO] 2020-09-21 00:35:32,496: bmp180_1_temp_pub [rosout][ERROR] 2020-09-21 00:35:48,175: Lost sync with device, restarting... [rosout][INFO] 2020-09-21 00:35:48,179: Requesting topics... [rosout][ERROR] 2020-09-21 00:36:03,184: Lost sync with device, restarting... [rosout][INFO] 2020-09-21 00:36:03,187: Requesting topics... [rosout][ERROR] 2020-09-21 00:36:18,192: Lost sync with device, restarting... [rosout][INFO] 2020-09-21 00:36:18,195: Requesting topics... [rosout][ERROR] 2020-09-21 00:36:33,199: Lost sync with device, restarting... [rosout][INFO] 2020-09-21 00:36:33,202: Requesting topics...

AND! after that arduino can still read all messages to it correctly, so relay works fine. So it is not ishortage of arduino sram or overheat or other arduino crush.

The one situation that leads to that message is problem with send data from arduino to rpi. If serial node on rpi cannot get any data for 15 sec it sends topic reqv message again. So: