NAOqi Motion - Overview | API
These API just create a higher level of the DCM hardness definition and provide interpolation in order to have more smooth behavior.
Manual Stiffness control is forbidden for Pepper‘s lower part.
With the following methods:
You could only use:
Workaround:
use ALMotionProxy::wakeUp() and ALMotionProxy::rest() methods.
When the robot is switched on, he initially has zero Stiffness. When at zero Stiffness, you can send any commands to the motors, but he will not move.
To give power to the motors, you can call one of Motion’s Stiffness methods:
# -*- encoding: UTF-8 -*-
'''Stiffness On: active stiffness of all joints and actuators'''
''' This example is only compatible with NAO '''
import time
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# We use the "Body" name to signify the collection of all joints
names = "Body"
stiffnessLists = 1.0
timeLists = 1.0
motionProxy.stiffnessInterpolation(names, stiffnessLists, timeLists)
# print motion state
print motionProxy.getSummary()
time.sleep(2.0)
# Go to rest position
motionProxy.rest()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
When changing Stiffness away from zero, it is best to do it gently so as to reduce the chance of a judder when powering up the motors.
Many tasks can be achieved at less than maximum Stiffness (Stiffness = 0.6), but tasks such as “Get up” require all the power they can get (Stiffness = 1.0).
When you reduce the Stiffness to zero, you cut all the power to the motors, so you should be careful that the robot is in a self-stable pose, otherwise he could fall.
# -*- encoding: UTF-8 -*-
'''Stiffness Off: remove stiffness of all joints and actuators'''
''' This example is only compatible with NAO '''
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# We use the "Body" name to signify the collection of all joints
names = "Body"
stiffnessLists = 0.0
timeLists = 1.0
motionProxy.stiffnessInterpolation(names, stiffnessLists, timeLists)
# print motion state
print motionProxy.getSummary()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Should you wish to vary the Stiffness of a joint over time, you can request a ‘trajectory’ of Stiffness.
# Example showing a stiffness trajectory
# Here the stiffness of the HeadYaw Joint, rises to
# 0.8, then goes back to zero.
pNames = "HeadYaw"
pStiffnessLists = [0.0, 0.8, 0.0]
pTimeLists = [0.5, 1.0, 1.5]
proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists)
Like angle interpolation commands, multiple trajectories can be specified in the same command.
# Example showing multiple stiffness trajectories
# Here the stiffness of the HeadYaw Joint, rises to
# 0.5, then goes back to zero, while the HeadPitch
# joint rises to 1.0
pNames = ["HeadYaw", "HeadPitch"]
pStiffnessLists = [[0.0, 0.5, 0.0], [0.0, 1.0, 0.0]]
pTimeLists = [[0.5, 1.0, 1.5], [0.5, 1.0, 1.5]]
proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists)