Recommendations for setting up Python development environment?

I have RVR all set up, with the Sparkfun Advanced Autonomy kit.

Everything is working so far, I can drive with arrow keys, stream video, control the pan-tilt mechanism, etc.

However, I would like to go further, and editing the examples using nano directly on the Pi doesn’t really cut it!

Are there any recommendations on setting up a better development environment?

What I’ve tried so far is setting up a github repo for my own projects. I can edit Python code using Visual Studio Code, and then push changes to the repo, and pull the changes on the RVR. That seems to work, in that I can edit in a real IDE and the changes end up on the RVR.

Is there a better way of doing this?

What seems trickier is actually running the code. The Sphero examples all run within the a pipenv, but my own projects don’t. Do I need to also set up a pipenv for my own code? Or should I just keep adding my own examples to the projects directory in the sphero SDK examples?

Another complication is that the Sparkfun (not Sphero) examples don’t run in a pipenv. How do I reconcile this? How can I write code that incorporates both the Sparkfun AND Sphero libraries?

1 Like

Hi,

I also use VSCode but directly over SSH (see also https://code.visualstudio.com/docs/remote/ssh). The advantage is that I can change code directly on the raspberry etc. without the need to push/pull all the time. You can also debug over SSH which is useful if you want to inspect variables etc.

VScode over ssh also takes care of your pipenv during debugging. Here you can find my setup and some sample projects: https://github.com/peerdavid/sphero-rvr

I hope this helps :slight_smile:

Cheers, David

2 Likes

Thanks David,

That looks like it exactly addresses what I need!

In fact, I suspect that I can use it to work with a variety of different Raspberry Pi based robots, each with a different configuration.

Thanks again!

1 Like

Nevermind, I’m using the RPi Zero that came with the Sparkfun Advanced Autonomy kit, and that architecture is not supported by VSCode Remote!!!

There are a lot of requests for support, but perhaps I just need to switch over to a Raspberry Pi 3 for now.

1 Like

Really interesting… I currently use a Raspberry Pi 4 Model B (4GB) without any problems on my SpheroRVR.

Cheers, David

2 Likes

Are you able to power the Pi 4 from the USB (or the +5V on the UART) or do you need a separate battery pack?

1 Like

I don’t use an additional battery pack. Together with the Pi4 I use 3 x Ultrasonic sensors and the Pi Camera and had no problems until now using only the USB of the RVR. Note also that I execute a TensorFlowLite model for object detection on the Pi4 (together with the RVR Python SDK etc.) which is computationally expensive…

My motivation to order the Pi4 and not the Pi3 was (1) performance and (2) the Pi 4 is also mentioned on the battery FAQ although the Pi4 is not mentioned on the raspberry setup page.

Cheers, David

1 Like

Thank you, that is super helpful!

I"ll go ahead and order a Pi 4.

1 Like