I’m starting to work with python and a Poppy robot in the VREP, PoppyTorso or PoppyHumanoid, anyone . I can load a Poppy robot in the simulator and work with it and the pypot library without problem.
Now, I want to modified the Poppy predefined scene to add a vision sensor for simulated a real camera. There’s no problem to add a vision on the scene, but my problem is:
How can I use a new vision sensor (or another sensor that I could add in the future) with the pypot library added into the VREP scene?
I’ve loaded the scene and added a “tracked_object” as is shown in this link:
and modified the configuration file “poppy_humanoid.json” as it’s shown in this link:
On the other hand, in the previous post it is suggested that create a new class for the sensor in the pypot sensor folder could be needed. But in the pypot directory “…\pypot\sensors\camera” there are already some classes created for a camera.
At this point, I am still not able to control a vision sensor (or any other sensor) added into the scene by the pypot library.
Could anyone help me with this and tell me what I need to have a simulated robot with new sensors? I supposed that It shouldn’t be so hard, but…here I am hehe
What you want to do is not easy, but possible. You need to create the sensor and to attach it to the robot. The sensor you can find in pypot.sensor are real sensor and are not able to work with vrep.
First you can try to manage your sensor out of the robot class and if you are succesfull you can add your sensor at instanciation in poppy-humanoid.py for exemple. You will need to subclass the sensor class and eventually to add a controller to retrieve the data faster.
Here an example with a force sensor (you can add a vision sensor in a same way) :
As you can see, you need to call the call_remote_api function to extract the data from vrep and you need to call the right simxFunction. The vrep documentation api is quite good and you can find a detailled description of all functions.: http://www.coppeliarobotics.com/helpFiles/en/remoteApiFunctionsPython.htm
If you are succesfull with a low level access, post another message and I will show you a example of how to add your sensor to your robot.
That’s what I supposed, this would be easier in a real robot than in the simulator. Thanks for confirm hehe
Now, after changing a little your code (I couldn’t load the scene usign the external API and I use the VrepIO class) I’ve been able to get the information of the vision sensor through the external API. I get the image very well. Here, I post my code if someone could need it in the future
I think I’ve post my reply with low level access. Is this correct? if there is something that I misunderstand please, tell me, because I am waiting for your help