Python 3

I purchased a ThunderBorg motor controller last year sometime, but put it aside as I subsequently realised the motors I had could draw more than 5amps in certain circumstances. I got an arduino and motor controller and linked these to a rpi to do the job. I have just ordered a Diablo to use a new rpi3 b+ to replace this setup. I see (after a bit of digging) that you do provide a python3 script for the Diablo.

Now I've also got a use for the ThunderBorg motor controller with another rpi3b+ but all the scripts are still only for python 2.7 (unless I'm missing a link somewhere). Whilst the latest rpi raspian does include a python 2.7 it only include editors for python3 and treats 2.7 as now obsolete. I note that in the Diablo forum you note

" We are planning to make our examples work with both Python 2 and 3 in the near future. When we do we will also update the install scripts to setup both Python 2 and Python 3 correctly. This should remove the need to make changes to the scripts for those who prefer to use Python 3. "

Apart from the all the other Diablo scripts are still python2.7, and all the ThunderBorg scripts are all still 2.7. Are you still expecting to create python 3 updates for all the scripts? In light of the latest raspian I would suggest that only python3 scripts are required from now on.


piborg's picture

We are working on updating all the scripts at the moment. There are quite a lot to change :)

As we have users with different versions of Pis and software we will likely keep supporting Python 2.7, but we will be recommending people use Python 3 once we are ready.

It will still be a little while before the updated scripts are available for everything as there is a fair amount to change and a large amount of testing still to do. When we are done all of the boards and robots we are selling will have Python 3 compatible code.

I have a raspberry Pi 3b+ with the latest Raspbian installed. The forums say that both Python 2 and 3 are installed. However, the IDE is only for Python 3. When the menu is enabled, and Python 2 IDLDE clicked, the version that is launched is Python 3. The terminal for Python 2 works though but the IDE does not. Is there a workaround, where I will be able to run your Python 2.7 scripts using my Python 3 IDE?

piborg's picture

We have most of our scripts sorted, but there some which we have not been able to convert as yet.

It sounds like the Python 2 version of IDLE may be installed, but not shown in the menu. If so this might help:

Will these Python 3 scripts that you are converting include those for the XLoBorg, UltraBorg and PicoBorg Reverse? I've just updated Diddy to Buster (what a palaver!) and I think it's time to update all my Python scripts to Python 3, given that Python 2 will no longer be supported soon.

piborg's picture

The aim is to update all of our current products and examples to work with both 2 and 3, which includes all of those boards :)

Unfortunately Buster has caused us a bit of a headache as well, namely the method we were using to get OpenCV installed for Python 3 does not work at the moment. This is a problem as all of our robot examples which make use of the camera are using OpenCV :(

For now we do have the following:

Thanks Piborg.
I installed OpenCV 3.3.1 (for both Py 2 and 3) by simply copying all the relevant files from my Stretch setup to the new Buster setup, which to my surprise worked. I've not really tested the Python 3 version as I don't currently have any Py 3 scripts! It does import though and will give me its version number.

I have now got my main script for Diddy running in python 3 using your PicoBorgRev3 and UltraBorg3 scripts (as above). I used Python's own to translate my python 2.7 scripts (including into Python 3. Apart from one or two minor issues with the translation which I had to fix manually Diddy can still find his way round the dining room without colliding with anything.
A bigger issue concerns the PS3 controller and/or Bluetooth. I am using the latest Raspbian Buster on a Pi 3 and there is a considerable difference between the performance of the controller under Python 2.7 and 3.5. With the latter there is a lag between moving a joystick or pressing a button which can be up to a second, both starting the required action and finishing it. Using the 2.7 version the control is quick and accurate and as far as I can see nothing in the script has been lost in translation.
I just wondered if you had come across this yourselves?

piborg's picture

I have not noticed that, but we have seen numerous problems using pygame. Because of this we decided to move away from pygame for joystick inputs with newer scripts.

What we have done instead is to make our own library for getting game controller inputs:

The library already works with Python 3, so you should be able to try it as well :)

I would use the example as a starting point since it is based on the ThunderBorg library, which is very similar to the PicoBorg Reverse.

Just had a look on GitHub - very impressive!
Can't wait to try these on Diddy. It looks as though I'll be busy for quite a few of these long winter evenings. Thanks.

I've just finished rewriting my main Diddy script replacing the Pygame controller routines with Gamepad. What a difference, good crisp, fast responses to button presses and axes movements and no more annoying 'bounce' problems with button presses.
Well done, and thank you!

Subscribe to Comments for "Python 3"