Problems to start / instantiate ErgoJr (without pi camera) in python

I asked a similar question earlier, and have continued to have problems.
Perhaps this is a better way of explaining my problems.

I have the Poppy Ergo Jr and am trying to make it do things through Python. I have it built and I am able to make it do the actions listed on the Monitor and Control page of poppy.local. However, when I try to go through the Discover your Poppy Ergo Jr.ipynb file within poppy.local, I can run the “%pylab inline, from future import print_function” line, but when I try to run the second line which instantiates the robot: “from pypot.creatures import PoppyErgoJr, poppy = PoppyErgoJr()”, I get an error that states: “OSError: Could not initalize robot!”

Also, the instructions are unclear for adding new Python code. I would like to write code in Python and make new actions for it to do. Where exactly would I add that?

I am working with the Ergo Jr at my University and any help would be appreciated.
Thanks,
N

hey @nbh,

A good way to identify a problem is to look the logs page (go to the homepage and select “what happened”)

because is so easy :wink: : just put your code in a notebook and run the notebook. You can also create ‘a primitive’ and run this via poppy monitor, but this is more complexe but …

Moreover, your main problem is that you can not instantiate your robot!

I think, you have unplug a picam ! If you have turn off this (in configure the robot) it’s good! But, it works only for the api (snap and monitor) and not for python!
two solution:

  • plug your cam
  • add camera=“dummy” when you instantiate your robot like : poppy=PoppyErgoJr(camera="dummy")

If it still does not work, please give us the code error on the logs page.
If it work, please, give us a feedback :wink:

thank you.

Thanks for the help.
I plugged in the camera and enabled it in the Configure Robot screen, but I am still getting an error within one of the example notebooks. Here is the error:

I have a good new for you :wink: it works !

on the first screenshot (that you have removed), it’s doesn’t work (and it’s strange because in this case, the monitor don’t work too)

but on the second screenshot, the errors that you can see come from Threading gestion. Sometimes, a thread crash, but is not a problem, he are automatically restart.

try the commande:
poppy.motors
I think, all is good!

I got my own code to run a couple times, but now it is no longer working and I am getting an error. Any ideas?

I got it to work by restarting the robot. It seems that I am constantly having to restart the robot to avoid errors. Is this normal?

Your last mistake comes from the way you ran your code:

First you instantiate your robot on a first notebook, when your robot is instaced you go to another notebook and you got an error … because:

It is possible to instantiate only one real robot for each real Robot (you can instantiate a virtual robot
with this command: my_robot=PoppyErgoJr(simulator="poppy-simu", use_snap=True, use_http=True))

Before re-run a cell that contains the code: my_robot = PoppyErgoJr() make sure that you have run my_robot.close()
Restart the robot. Stop any instantiation like my_robot.close() for my_robot