[PYTHON] I made a box to rest before Pepper gets tired

Since the motor may get hot during continuous playback of the application or making animation during development, development may stop in the middle, so I made a box that will take a break without permission before getting tired. If you put it in the Init or Main of the app, even if you get heat during playback, it will not stop in the middle, just take a break on your own and try to make it feel like it will start moving again when the heat cools down.

API used

ALMotionProxy

Method used

getIdlePostureEnabled(const std::string& pChainName) setIdlePostureEnabled(const std::string& pChainName, const bool& pEnable)

variable

How it works

If you want to stop this function by putting it in the management / monitoring box, fire an event to stop it. スクリーンショット 2016-01-15 14.47.24.png

Example.py


    def onLoad(self):
        self.timer = None
        self.memory = ALProxy("ALMemory")
        self.motion = ALProxy("ALMotion")
        self.parts = ["Head", "LArm", "RArm", "Legs"]

    def onTimer(self):
        partList = []
        tempList = []
        partCount = { "Head":False, "LArm":False, "RArm":False, "Legs":False }
        sNameList = ["HeadPitch", "HeadYaw", "LElbowRoll", "LElbowYaw", "LHand", "LShoulderPitch", "LShoulderRoll", "LWristYaw", "RElbowRoll", "RElbowYaw", "RHand", "RShoulderPitch", "RShoulderRoll", "RWristYaw", "KneePitch", "HipRoll", "HipPitch"]

        for sName in sNameList:
            sKeyName = "Device/SubDeviceList/%s/Temperature/Sensor/Value" % sName
            try:
                partList.append(sName)
                tempList.append(int( self.memory.getData(sKeyName) ))
            except:
                self.logger.error("No temperature found for this hardware: " + str(sName))

        for pName in partList:
            if ( "Head" in pName ):
                act = "Head"
            elif ( "LElbow" in pName or "LHand" in pName or "LShoulder" in pName or "LWrist" in pName ):
                act = "LArm"
            elif ( "RElbow" in pName or "RHand" in pName or "RShoulder" in pName or "RWrist" in pName ):
                act = "RArm"
            elif ( "Ankle" in pName or "Hip" in pName or "Knee"):
                act = "Legs"

            i = tempList[partList.index(pName)]

            if i >= int(self.getParameter("Motion stop temperature(or more)")):
                if partCount[act] == False:
                   partCount[act] = True

        for part in self.parts:
            if partCount[part] and self.motion.getIdlePostureEnabled(part) == False:
                self.logger.warn("%s Motion Stopped" % part)
                self.motion.setIdlePostureEnabled(part, True)
            elif partCount[part] == False and self.motion.getIdlePostureEnabled(part):
                self.logger.info("%s Motion Start" % part)
                self.motion.setIdlePostureEnabled(part, False)

Finally

The sauce is dirty, but please forgive me.

sample

Robot Start's Robot Library https://robo-lib.com/repositories/summary/49

Recommended Posts

I made a box to rest before Pepper gets tired
I made a script to display emoji
I made a tool to compile Hy natively
I made a tool to get new articles
〇✕ I made a game
I made a library to separate Japanese sentences nicely
I made a threshold change box of Pepper's Dialog
I made a script to put a snippet in README.md
I made a Python module to translate comment outs
I made a code to convert illustration2vec to keras model
I made a command to markdown the table clipboard
I made a python library to do rolling rank
I made a package to filter time series with python
I made a command to generate a table comment in Django
I made a tool to create a word cloud from wikipedia
I made a function to check the model of DCGAN
I made a python text
I made a discord bot
[Titan Craft] I made a tool to summon a giant to Minecraft
I made you to execute a command from a web browser
I made a script to say hello at my Koshien
I made a library to easily read config files with Python
A story about adding a REST API to a daemon made with Python
I made a web server with Raspberry Pi to watch anime
I made a library that adds docstring to a Python stub file.
I made a command to display a colorful calendar in the terminal
I made a C ++ learning site
I made a Line-bot using Python!
I made a CUI-based translation script (2)
Make a Tweet box for Pepper
I made a fortune with Python.
I made a CUI-based translation script
I made a daemon with Python
I made a Docker container to use JUMAN ++, KNP, python (for pyKNP).
I made a plugin to generate Markdown table from csv in Vim
[Python] I made a decorator that doesn't seem to have any use.
I made a password generator to teach Python3 to children (bonus) * Completely remade
I made a tool to automatically browse multiple sites with Selenium (Python)
I made a web application in Python that converts Markdown to HTML
[Django] I made a field to enter the date with 4 digit numbers
I made a kitchen timer to be displayed on the status bar!
I made a CLI tool to convert images in each directory to PDF
I tried to discriminate a 6-digit number with a number discrimination application made with python
I made a program to notify you by LINE when switches arrive
I made a network to convert black and white images to color images (pix2pix)
I made a script in python to convert .md files to Scrapbox format
I made a program to input what I ate and display calories and sugar
I made a library konoha that switches the tokenizer to a nice feeling
I made a tool to convert Jupyter py to ipynb with VS Code
I made a program to check the size of a file in Python
I made a webAPI! Build environment from Django Rest Framework 1 on EC2
I made a function to see the movement of a two-dimensional array (Python)
I tried to create a linebot (implementation)
I made a new AWS S3 bucket
I made a dash docset for Holoviews
I want to print in a comprehension
I tried to create a linebot (preparation)
I made Othello to teach Python3 to children (4)
I made a payroll program in Python!
I touched "Orator" so I made a note
I made a character counter with Python