This script can save your life...

So, sometimes an arduino running mrlcomm will get away from you.  The best way to reset it is to toggle the serial port.  This resets the arduino that's connected and thus clearing the device list in mrlcomm.

Here's a small snippet of python code that will toggle the DTR pin and reset the arduino.

pi@raspberrypi:~ $ cat

# Import serial support
import serial
from time import sleep
# port = "COM99"
port = "/dev/ttyACM0"
baud = 57600
# Open the serial port.
ser = serial.Serial(port, baud, timeout=1)
# open the serial port
if ser.isOpen():
  print( + ' is open...')

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
moz4r's picture

Thank for the tip !! Some

Thank for the tip !!

Some time ago, @calamity talk to me about possibility to do some things about heartbeat and some command that can be pushed in case off arduino will not respond anymore.

Do you think a DTR reset is a good option to push in the case off mrlcomm/jvm breaked ?

kwatters's picture

toggle the serial port and the arduino resets

yeah. if you open & close the serial port, the arduino will reset.  This will disable all motors and servos connected to the arduino.  

So.. if you do a kill -9  on the java process that is myrobotlab..  and the arduino is still trying to drive the servos..

if you open and close the serial port it will reset mrlcomm, this will cause all of the devices to be deleted from the device list and your robot will be quiet and happy.

I posted this as an example python script that can do the job of opening the serial port.  I use it before I start my  InMoov.  I also use it after I kill  and shutdown the InMoov.