Problème de création d'un PoppyHumanoid avec Pypot pour utiliser V-Rep

Hello,
I work on poppy for an academic project. For the programming aspect I decided to follow the tutorial:how you can control a simulated Poppy Humanoid using a robot simulator.

However, when I tried to execute the following script:

I received this issue:

Well,searching on the forum I found a post on a similar issue with the module ‘creatures’. So I tried the offered solution but I still have the same issue.

The offered solution was to use:

from poppy_humanoid import PoppyHumanoid

Instead of using:

from poppy.creatures import PoppyHumanoid

Has someone already faced this issue ?

Thanks for your help!

Did you installed the poppy-creature package ?

pip install poppy-creature

Yes, when I tried to re install this package python says that this package is already install.
But it changes the issue that raise python, now I receive this issue when i execute the same script than before:

Thanks for your help

Ok then, did you installed poppy-humanoid ?

It is pip install poppy-humanoid or if you have cloned the repository and want to do development:

cd poppy-humanoid/software/
python setup.py develop

I try to uninstall and install all pypot and poppy humanoid
Here is my installation:

But I still have the same issue.
I try to follow line by line the tutorial : how you can control a simulated Poppy Humanoid using a robot simulator.
So I think that I have already install all packages asked by this tuto.

Someone else had the same isssue:

Maybe try to rename your poppy.py file by something else ?

I had already saw this post before.
I tried to rename my file and replaced:

from poppy.creatures import PoppyHumanoid

by

from poppy_humanoid import PoppyHumanoid

As it’s explain in this post but in my case the issue is not related with the issue raised in this post.

So I really don’t understand why I still have this issue of ImportError, maybe I missed something…

Can you try: python -c "import pypot" ?

If you obtain this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pypot

You have probably a problem with your python environnement i.e. your pip use another python than your system.

If this line does not raise any error then I do not know… you may have to wait for @Pierre to come back (monday).

I tried and this is the result:

I guess that I have no error
Thanks for your help and I will wait monday

En fait j’ai le même problème…

Est ce que tu peux me montrer la version du code que tu as pour le fichier software/poppy/creatures/abstractcreature.py du module poppy-creature qui visiblement doit être dans ton /usr/local/bin/python2.7/dist-packages/

Voila le fichier que tu veux:

import os
import re

from pypot.robot import Robot, from_json
from pypot.server.snap import SnapRobotServer


def camelcase_to_underscore(name):
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()


class AbstractPoppyCreature(Robot):
    """ Abstract Class for Any Poppy Creature. """

    def __new__(cls,
                config=None,
                simulator=None, scene=None, host='127.0.0.1', port=19997, id=0,
                use_snap=False, snap_host='0.0.0.0', snap_port=6969,
                sync=True):
        """ Poppy Creature Factory.

        Creates a Robot (real or simulated) and specifies it to make it a specific Poppy Creature.

        :param str config: path to a specific json config (if None uses the default config of the poppy creature - e.g. poppy_humanoid.json)

        :param str simulator: name of the simulator used (only vrep for the moment)
        :param str scene: specify a particular simulation scene (if None uses the default scene of the poppy creature - e.g. poppy_humanoid.ttt)
        :param str host: host of the simulator
        :param int port: port of the simulator
        :param int id: id of robot in the v-rep scene (not used yet!)
        :param bool sync: choose if automatically starts the synchronization loops

        .. warning:: You can not specify a particular config when using a simulated robot!

        """
        if config and simulator:
            raise ValueError('Cannot set a specific config '
                             'when using a simulated version!')

        creature = camelcase_to_underscore(cls.__name__)
        base_path = os.path.dirname(__import__(creature).__file__)

        if config is None:
            config = os.path.join(os.path.join(base_path, 'configuration'),
                                  '{}.json'.format(creature))

        if simulator is not None:
            if simulator != 'vrep':
                raise ValueError('Unknown simulation mode: "{}"'.format(simulator))

            from pypot.vrep import from_vrep

            scene_path = os.path.join(base_path, 'vrep-scene')

            if scene is None:
                scene = '{}.ttt'.format(creature)

            if not os.path.exists(scene):
                if ((os.path.basename(scene) != scene) or
                        (not os.path.exists(os.path.join(scene_path, scene)))):
                    raise ValueError('Could not find the scene "{}"!'.format(scene))

                scene = os.path.join(scene_path, scene)

            # TODO: use the id so we can have multiple poppy creatures
            # inside a single vrep scene
            poppy_creature = from_vrep(config, host, port, scene)
            poppy_creature.simulated = True

        else:
            poppy_creature = from_json(config, sync)
            poppy_creature.simulated = False

        if use_snap:
            poppy_creature.snap = SnapRobotServer(poppy_creature, snap_host, snap_port)

        cls.setup(poppy_creature)

        return poppy_creature

    @classmethod
    def setup(cls, robot):
        """ Classmethod used to specify your poppy creature.

        This is where you should attach any specific primitives for instance.

        """
        pass

Bon bah c’est pas ça. Désolé, j’ai pas de réponse pour le moment.

It should have been fixed in the version 1.5.1 of poppy creatures:

1 Like

Soory but I still have the same issue even after have installed the new version of poppy creatures.

Here is my installation:

This is the executed script:

And finally this is the error message:

Thanks for your help

Can you run the following command in your terminal and post the result:

pip list | grep 'poppy\|pypot'

Then, for your script can you try instead:

#!/usr/bin/env python

from poppy_humanoid import PoppyHumanoid

Here is the result of the execution:

It seems that you are still working on a directory named poppy, with a module named poppy. This is really not a good idea as this will completely confused the python interpreter. Can you try move your blabla file somewhere else and try again?

Indeed it was just an issue of module.
I moved blabla and that is the result:

Is the V-Rep error is problematic to continue the programmation ?

However I have this:

This error shows that there was a timeout in the connection with v-rep.

Maybe the pop-up about “undo” feature taking too much time ?