Hello everybody,
When I introduce odrv0.erase_configuration() in the Anaconda prompt disappears and reconnect but when I try to execute a script says that the object disappered.
Is it posible to do it with a scirpt or have to be with the Anaconda prompt?
Both erase_configuration() and save_configuration() implicitly reboot() the ODrive() board, so you’ll have to catch the resulting exception indicating that the board disappeared, and then have to re-establish connection with the board.
#!/usr/bin/env python3
import odrive
from fibre.libfibre import ObjectLostError
print("Connecting to ODrive")
odrv = odrive.find_any()
print("S/N: %d" % odrv.serial_number)
print("Rebooting ODrive...")
try:
odrv.reboot() # or save_configuration() or erase_configuration()
except ObjectLostError:
pass # yeah, the object disappeared, I know
print("Reconnecting to ODrive")
odrv = odrive.find_any()
print("S/N: %d" % odrv.serial_number)