Rosrun openag_brain flash: timeout and errors


#1

Flashing the Arduino is becoming a pain (flash burns:stuck_out_tongue_closed_eyes:)

rosrun openag_brain flash

The compile is going fine, it is the avrdude talking with Arduino (Duo: MEGA 2560) that seems to be the problem. I am lucky if a run takes only 150 seconds, but more often over 400 seconds.

I am working at loading some sensor data to the Arduino, and 1 out of 8 times it fails avrdude: verifying …
Everything goes smoothly till avrdude starts:

  • avrdude says the device is initialized
  • usually does the Reading without issues
  • Writing starts spitting timeout message(but finishes). These timeouts always show up.
  • final Reading takes a bit longer with more timeouts
  • It then starts verifying and will throw a mismatch and exits with error.

I have tried swapping out the USB cable to see if the connection was a problem, but to no avail.

  • Is this the nature of the beast?
  • Is this indicative of an Arduino problem (hardware or firmware)? Loading via the Arduino IDE does not have any issues.

Openag_brain is not working
Sensor Programming and Deployment: How To
#2

Got past this one, the long and short of it (not in that order).

Solution:
Pull the USB cord from the Raspberry Pi and plug it into another USB port, then re-run flash.

The long version:
Symptoms:
This is NOT a lack of serial connection (I get initialization and the first Read). A serial connection exists, but the longer that avrdude runs, the more timeouts develop.
Attempted solutions:
I thought this might be due to running the graphic interface, or possible voltage issues from having a keyboard and mouse plugged into the USB; I also considered problems with a long USB cable or a corrupt bootloader.
I bought a new Arduino Duo and short (2ft) USB cables. Swapping out the board and cable gave the same results as before.
I tried going into the Raspberry via SSH (without the graphic interface running) and still no change.
I then tried adding another power connection to the Arduino, with no change.
It was on a wild whim that I moved the cable to another port, and it ran clean on the next flash.
I then decided to see how much I could abuse the Raspberry and still get a good flash. Every time I started getting timeout problems, I moved the cable (with no reboot) and it went back to working (at least once).
I now have it back to the original configuration:

  • Using the graphical interface (no SSH) and command prompts
  • 6 ft USB cable (so the sensors can be further away)
  • Mouse, keyboard and thumb drive plugged into USB; in addition to the Arduino

Flash works fine, I just pull the cable and put it in a different port and the next flash works.

Note: If SSH is acting up, try cleaning your device list on the router and rebooting the router. I also like using Putty from a second Raspberry.


#3

I am finally getting my flash to work thanks to your tip. I have noticed that I don’t have to change USB ports. I just unplug the Arduino side for 30 seconds, plug it back in and it works. Thank you @webbhm. :smile:

The error that signals to me that I need to unplug/plug is this:

#avrdude: stk500v2_ReceiveMessage(): timeout
#avrdude: stk500v2_ReceiveMessage(): timeout
##avrdude: stk500v2_ReceiveMessage(): timeout
#avrdude: stk500v2_ReceiveMessage(): timeout

I also have to stop and start the docker brain for sensor data to flow.


#4

I find that flashing while openag_brain is running will also cause those errors, for future reference.


#5

@spaghet - Are you saying when ROS is running or does openag_brain have its own process? I have not come across a command for stopping ROS, what command are you using?


#6

When you run rosrun openag_brain main -f personal_food_computer_v2... it starts roscore as well as a few other processes(ROS nodes), so sending a SIGTERM will kill roscore/everything… I think it’s the arduino_handler node in particular that takes the serial bus.


#7

Can I ask if you guys are using the openag_brain_docker_rpi or are you installing the full dev stack on your RPI? I’m having a really tough time getting the brain to connect to the PI much less flash it and swapping usb ports hasn’t helped yet, but I’m going to try the flash command above to see if that get’s us to green.


#8

I am still using the old version of the openag_brain_docker_rpi (with fixtures in the database), so I cannot say if you are encountering a new bug, or something more generic.
It would help if you could give the specific error message, or condition, you are encountering.


#9

I have just finished (mostly) a FCv1 and have a raspberry pi 3 running the https://github.com/OpenAgInitiative/openag_brain_docker_rpi LATEST images. When I check the logs on the openag_brain I get the following errors:

ERROR: cannot launch node of type [usb_cam/usb_cam_node]: usb_cam
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/pi/catkin_ws/src
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks

and then:

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

I can log into:

http://openag.local:5984/_utils/document.html?firmware_module/_design/openag

and I update the firmware version to kick off an arduino flash process and that doesn’t work either.

What am I missing? Do you have any suggestions?

Thanks!

J


#10

I forgot to run

source ~/catkin_ws/devel/setup.bash

and now the flash command is working.

Fingers xx’d.

J


#11

The flash worked after I unplugged and replugged in the USB into a different port. I just rebooted and aside from the camera not working still, I think I’ve got the Pi and Arduino working together.

HOORAY!!!

What are fixtures? Do I need to set up the sensors I have? I have all of the sensors that came with FC1.

Cheers,

J