Controlling ergo-jr from python script

Hello,
We’re up and running with Erjo-Jr from the web interface. The Monitor and Control web page works (ErgoJr dances just fine.)
When we try to write a few lines of Python to control the arm, it does not work, and after doing that the web interface stop working as well until we do the “Reboot the robot” button.
It seems like we can’t be controlling the robot at the same time as the web service? So how do we stop the web service so we can control the arm from our own code?
Thanks,
Ken

Hi Ken,

You are a victim of the current limitations of the robot: instance management.

The way we control the robot instantiates a PoppyErgoJr object, which requests the communication monopoly with the motors. To sum it up, if you try to instantiates multiple robots instances, something wrong happens, and you get notified a already in use-ish message.

We plan on making it different in a more or less distant future but for now, there is a way to handle this by using the Jupyter notebooks link in the web interface.

Doing so will shut the default robot instance down and allow you to write any python code you want. Note that the python environment is provided in Jupyter, notebooks have the knowledge of pypot and poppy python modules.

However, if you want to completely disable the interface and the tools bundled with it, you can achieve this by logging to the robot as poppy using ssh, and disabling the puppet-master service.
This is rather drastic, but if you only intend on using custom code and have no interest in the shipped software, this workaround may be enough.

ping @Theo and @Pierre for correcting me if I said something wrong :slight_smile:

1 Like