Never Let Your GoPiGo3 Run Away Again

If you have ever had your GoPiGo3 program exit unexpectedly while it was in motion, (usually from an unhandled exception), you know the panic of “RUN AWAY ROBOT”.

There is a really simple GoPiGo3 programming style that will keep your robot under control:

#!/usr/bin/env python3

import easygopigo3
import atexit

def main():
    egpg = easygopigo3.EasyGoPiGo3()   # or preferentially  (use_mutex=True)
    atexit.register(egpg.stop)         # stop robot when program quits for any reason
    ...


if __name__ == '__main__':
    main()

2 Likes

Totally cool beanies!

1 Like

Really. . .

This is a great tip, but I was on a cell phone with a dying battery so I couldn’t say more.

This should really be in a “GoPiGo FAQ” somewhere.

1 Like