Stop Python script on NAO robot when touching the head

2

My problem is as follows. I have a Python script that runs so that the NAO robot performs various non-stop actions until the execution stops, however for security reasons (in case the robot goes crazy and wants to kill us all ) I need to add some instruction to stop it using the touch sensor of your head in case it is pressed.

I read a bit about the ALTouch module with which you can generate the TouchChanged module () but it acts on all the sensors and not just on the touch sensor in the head.

Some idea or related documentation will be welcome.

    
asked by Luis Hongo 31.08.2017 в 22:03
source

2 answers

2

As you indicate the ALTouch module generates the TouchChanged () event wherever the robot is touched, however TouchChanged () provides a list of the body part and a boolean with the state of the stimulus.

For example:

[[“Head/Touch/Middle”, True], [“ChestBoard/Button”, True]]
[[“Head/Touch/Middle”, False]]
[[“LArm”, True], [“RHand”, False]]

Ref: Softbank Robotics documentation for the ALTouch module, includes example of use on your website.

    
answered by 31.08.2017 / 22:30
source
0

Perfect I already discovered how to do it after several tests with the example script, it was as simple as changing a word

global memory
    memory = ALProxy("ALMemory")
    memory.subscribeToEvent("MiddleTactilTouched",
        "ReactToTouch",
        "onTouched")

The example of Aldebaran uses TouchChanged that encompasses all the members of the robot and sensors instead of MiddleTactilTouched that only works on the average sensor of the head.

Many thanks to those who took a little time to answer my question.

    
answered by 08.09.2017 в 21:32