Problems running the web simulator

I am having problems with the web simulator.
I am interested in writing programs in Python (only, not Snap) in order to study the computations of 3D rotations.

  1. I can run http://simu.poppy-project.org/poppy-ergo-jr/2
    and the robot moves when I move the sliders.

  2. I installed the full Anaconda with no problem.

  3. I ran “pip install poppy-ergo-jr” with no problem

  4. The documentation is inconsistent if I need to run poppy-services
    if I am writing my own Python program.
    But I did so and it runs OK.
    If I am supposed to run it, can I just omit the --snap parameter
    since I don’t want Snap? Or should the parameters be different.

In a separate command window I ran Python with the following program based on the example in the documentation.
The printing of present position worked and the value of m3 printed changes after running the program, but nothing happened in the visualization.

from pypot.creatures import PoppyErgoJr
import time
poppy = PoppyErgoJr(simulator='poppy-simu')
for m in poppy.motors:
    print(m.present_position)
for _ in range(3):
    poppy.m3.goal_position = 30
    time.sleep(0.5)
    poppy.m3.goal_position = -30
    time.sleep(0.5)
for m in poppy.motors:
    print(m.present_position)

Hello,
There was a bug/undocumented change in the API that required to start manually the HTTP API to be able to visualize the dummy robot from simu.poppy-project.org.

We fixed it. You can install the last version of pypot from the git, or simplier you can start the HTTP API manually like this:

from pypot.creatures import PoppyErgoJr
poppy = PoppyErgoJr(simulator='poppy-simu', use_http=True)

After that, you will be able to go on http://simu.poppy-project.org/poppy-ergo-jr/, an click on “sychroniser” checkbox.
If you restart the robot, you will have to uncheck/check this checkbox.

poppy-services is a cli tool that make easier to start the different APIs of the robot, so it is not intended to be able to program the robot in Python by this way.

Hi Theo,
Thanks for you help.
I added the parameter to the Python program,
but still nothing happens on the visualization.

Just to clarify the sequence:

  1. Run python test.py
  2. Open the “visualisateur”
  3. Check "synchroniser"
    If that is the way to do it, I will need a long initial delay
    in the Python program until the visualisateur opens.

Also, please clarify the sentence about uncheck/check.
By “restart the robot”, do you mean running the Python program?

Moti

Hi,
It is the way to do it. You can have the web page open before executing your code, but you need to check synchroniser after the code was started.
I tested with your code, and it works (I just increase the number of loop iteration to be able to see the movement before the synchronization).
By restarting, in your case it just mean calling you file again.

Still no luck, even after I increased the loop iterations to 20 :-(.

Just for fun, I tried it on my laptop at home (using Miniconda instead of Anaconda) and it works!
The Windows firewall asked for permission and I allowed it.
I don’t know why I didn’t get the firewall warning on the computer at the office…

Aaah, I thought about that and then I forgot. In many offices, ports other than 80, 443, 22 are blocked without warning the firewall.
The HTTP API use the port 8080.

So the problem is resolved ?

I would still like to know how to allow access to 8080.
I guess I’ll have to ask the systems expert here.