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

python
english
software
ergo-jr
Tags: #<Tag:0x00007f5ce7aa0730> #<Tag:0x00007f5ce7aa0500> #<Tag:0x00007f5ce7aa02f8> #<Tag:0x00007f5ce7aa0140>

#1

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


#2

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.


#3

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:


#4

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!


#5

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?


#6

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?


#7

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