Running and testing code without the robot portion of the GoPiGo

Is it possible to compile and run python without having the board connected? I have students that have Pies and
we want to keep the robots at the school. Has anyone done that?

Regards

Hey @darrin.patek! Can you explain a little more about what you’re hoping to do?

You can write programs in python, and even try to run the programs, without the robot attached. Does that make sense?

Also a little confusing about “compile” python; it’s a non-compiled programming language. Are you talking about something else possibly?

Thanks!

Yes that makes sense.

I do a lot of work with C and C++ so I misspoke, Python is an interpreted
not compiled.

Thanks
Darrin

No problem at all, we’re all learning here! I hope I answered your question, please let me know if I didn’t!

This is an old thread now, but for those just coming along - the answer is yes, most definitely.

The way I did it was:

git clone https://github.com/DexterInd/GoPiGo

then copy …/GoPiGo/Software/Python/gopigo.py and hardware_test.py
to your development directory, for example: …/Robots/mybot/gopigosim.py

Strip everything but the def xyz( abc): function calls and add some relevant print and returns.

change the from gopigo import * in the hardware_test.py (or your program) to “from gopigosim import all”

and run your programs: (python hardware_test.py to test your gopigosim.py )

A fun program to try your sim with is us_servo_scan.py
which will “drive” your sim bot till your simulated us_dist(pin)
returns an reading less than 20, and then will “scan” your simulated servo
from 0 degrees to 180 degrees, taking us_dist() readings,
and then will print a map in your term window.

You can see,use my gopigosim.py at https://github.com/slowrunner/goRWpigo/blob/master/gopigosim.py

Map:

   --------------------------------------------------------------------------------------------------------
   |                                                                                                       |
   |                                                                                                       |
   |                                                                                                       |
   |                                                                                                       |
   |                                                                                                       |
   |                                                                                                       |
   |                                                       o                                               |
   |                                                                                                       |
   |                                                           o                                           |
   |                                           o                                                           |
   |                                 o                               o o                                   |
   |                                           o   o           o                                           |
   |                                               o   o o o                     o                         |
   |                             o                               o           o                             |
   |                                   o     o                           o         o                       |
   |                             o                                                                         |
   |                                                   o   o             o   o o                           |
   |                       o                   o o           o                                             |
   |                   o               o     o           o   o                                             |
   |                                 o o     o       o o                                                   |
   |                     o         o       o     o o       o o o                       o                   |
   |                 o                       o                     o   o   o o           o   o             |
   |                                         o     o   o                                   o               |
   |                         o   o                             o o   o                                     |
   |                   o               o       o       x o   o                                             |
   --------------------------------------------------------------------------------------------------------

Happy simulating!

1 Like