Copycat
This class had been created to answer of express needs during the n°65 CoDev project, in 2019. Copycat allows the Poppy Robot to reproduce arm movements of the wearer of 3 accelerometers on his arm.
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:
- to initialize communication with Raspberry Pi which communicate with accelerometers,
- to get accelerometers measures by communicating with this Raspberry Pi,
- to filter angles with a first order filter,
- to pass angles on motors.
An instance of Copycat class gets these attributes:
forearm_acc
: forearm accelerometer, instance of Sensor classwrist_acc
: wrist accelerometer, instance of Sensor classarm_acc
: arm accelerometer, instance of Sensor classmysocket
: socket TCP
The Sensor class is an object with only one attribute, a float, taking the angle value of the corresponding accelerometer (arm, wrist or forearm).
Requirements
The language used is Python2.7, decreed by the download image for Poppy on the Raspberry Pi. It is necessary to use this 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
/usr/local/lib/python2.7/dist-packages/poppy-humanoid/
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 on the Raspberry Pi
sudo chmod –R 777 the/path/repertory
Installation
[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
cd ~/ python >>> from poppy_humanoid.copycat import Copycat >>> from poppy_humanoid.sensor import Sensor
If Python doesn’t raise any error message, you have correctly installed files.
How to use
Download this python file [link] and type this line:
python ./script_copycat.py TIME
and replace TIME
by the wanted duration.
Bugs known and tips
- The method
stop_communication
doesn’t work. It is necessary to check details on the other RPi with the use of the socket module. - 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.
- 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.
External links
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