Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
poppy-copycat:copycat [2019/09/06 15:07] l18guilb [How to use] |
poppy-copycat:copycat [2020/04/23 21:18] (current) mai poppy-wrist |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag>Robot}} | ||
+ | {{tag>Poppy}} | ||
====== Copycat ====== | ====== Copycat ====== | ||
- | This class had been created to answer of express needs during the CoDev n°65 project, in 2019. Copycat allows the Poppy Robot [] to reproduce arm movements of the wearer of 3 accelerometers on his arm. | + | This class had been created to answer of express needs during the n°65 CoDev project, in 2019. Copycat allows the [[https://www.poppy-project.org/en/|Poppy Robot]] to reproduce arm movements of the wearer of 3 accelerometers on his arm. |
===== Overview ===== | ===== Overview ===== | ||
- | In order to manage Poppy, it is necessary to create a PoppyHumanoid instance []. That is here that Copycat class takes action: it stands in for PoppyHumanoid class by inheritance [not again, in construction] and complete this by adding some methods allowing: | + | In order to manage Poppy, it is necessary to create a PoppyHumanoid instance. That is here that Copycat class takes action: it stands in for PoppyHumanoid class by inheritance [not again, in construction] and complete this by adding some methods allowing: |
- | * to initialize communication with rpi which communicate with accelerometers, | + | * to initialize communication with Raspberry Pi which communicate with accelerometers, |
- | * to get accelerometers measures by communicating with this RPi, | + | * to get accelerometers measures by communicating with this Raspberry Pi, |
* to filter angles with a first order filter, | * to filter angles with a first order filter, | ||
* to pass angles on motors. | * to pass angles on motors. | ||
Line 14: | Line 16: | ||
An instance of Copycat class gets these attributes: | An instance of Copycat class gets these attributes: | ||
- | * forearm_acc: forearm accelerometer, instance of Sensor class | + | * ''forearm_acc'': forearm accelerometer, instance of Sensor class |
- | * wrist_acc: wrist accelerometer, instance of Sensor class | + | * ''wrist_acc'': wrist accelerometer, instance of Sensor class |
- | * arm_acc: arm accelerometer, instance of Sensor class | + | * ''arm_acc'': arm accelerometer, instance of Sensor class |
- | * mysocket: socket TCP | + | * ''mysocket'': socket TCP |
The Sensor class is an object with only one attribute, a float, taking the angle value of the | The Sensor class is an object with only one attribute, a float, taking the angle value of the | ||
Line 25: | Line 27: | ||
===== Requirements ===== | ===== Requirements ===== | ||
- | The language use is Python2.7, decreed by the download image for Poppy on the Raspberry Pi. It is necessary to use this [[https://www.humarobotics.com/downloads/poppy/poppy-humanoid-RPi3-keraal_2017-09-26.img.zip|image]] because it contains all required packages and works for a Poppy equipped with wrists. After that, it is necessary to put the files copycat.py and sensor.py in the same repertory than poppy_humanoid.py. | + | The language used is Python2.7, decreed by the download image for Poppy on the Raspberry Pi. It is necessary to use this [[https://www.humarobotics.com/downloads/poppy/poppy-humanoid-RPi3-keraal_2017-09-26.img.zip|image]] because it contains all required packages and works for a Poppy equipped with wrists. After that, it is necessary to put the files ''copycat.py'' and ''sensor.py'' in **the same repertory** than ''poppy_humanoid.py''. The location of the repertory for the project was |
- | The software WinSCP allows copying files easily on the Raspberry Pi thanks to SSH. Be careful, you need to change rights on the repertory where is located poppy_humanoid.py. You just have to launch this command | + | |
+ | <code>/usr/local/lib/python2.7/dist-packages/poppy-humanoid/</code> | ||
+ | |||
+ | The software [[https://winscp.net/eng/index.php|WinSCP]] allows copying files easily on the Raspberry Pi thanks to SSH. Be careful, you need to change rights on the repertory where is located ''poppy_humanoid.py''. You just have to launch this command on the Raspberry Pi | ||
<code>sudo chmod –R 777 the/path/repertory</code> | <code>sudo chmod –R 777 the/path/repertory</code> | ||
Line 35: | Line 40: | ||
[repertoire sur le wiki où il y a les codes] | [repertoire sur le wiki où il y a les codes] | ||
- | In order to check if the work environment was well prepared, write in the Raspberry Pi terminal | + | In order to check if the work environment was well prepared, write in the Raspberry Pi terminal |
+ | |||
+ | <code> | ||
cd ~/ | cd ~/ | ||
python | python | ||
- | from poppy_humanoid.copycat import Copycat | + | >>> from poppy_humanoid.copycat import Copycat |
- | from poppy_humanoid.sensor import Sensor | + | >>> from poppy_humanoid.sensor import Sensor |
+ | </code> | ||
If Python doesn’t raise any error message, you have correctly installed files. | If Python doesn’t raise any error message, you have correctly installed files. | ||
Line 57: | Line 66: | ||
- Don’t forget to check methods of PoppyHumanoid class in order to use them efficiently. | - Don’t forget to check methods of PoppyHumanoid class in order to use them efficiently. | ||
- I suggest downloading Roboplus 1.0 to test motors when there is a problem. | - I suggest downloading Roboplus 1.0 to test motors when there is a problem. | ||
- | - Sometimes, some problems are raised without any reason by Python. When it happens, just quit Python, and launch it again. If the problem persists, shut off Poppy by unplugging the motor power supply (**be carefull, hold Poppy or it will fall**) and USB2AX. Reconnect all and retry. | + | - Sometimes, some problems are raised without any reason by Python. When it happens, just quit Python, and launch it again. If the problem persists, shut off Poppy by unplugging the motor power supply (**be careful, hold Poppy or it will fall**) and USB2AX. Reconnect all and retry. |
- When you launch the program, be aware of the environment of Poppy: it needs space around it, so get it out of any object which can hinder its movements. | - When you launch the program, be aware of the environment of Poppy: it needs space around it, so get it out of any object which can hinder its movements. | ||
Line 64: | Line 73: | ||
Give external links and describe them (e.g. Documentation, Source code, etc.) | Give external links and describe them (e.g. Documentation, Source code, etc.) | ||
+ | |||
+ | Poppy wrist configuration file and vrep scene : https://github.com/hkerma/poppy-wrist |