Stiffness

<< return to examples index

Turns the stiffness on and off.

Stiffness on

motion_stiffnessOn.py

# -*- encoding: UTF-8 -*- 

'''Stiffness On: active stiffness of all joints and actuators'''

import sys
from naoqi import ALProxy

def main(robotIP):

    try:
        motionProxy = ALProxy("ALMotion", robotIP, 9559)
    except Exception, e:
        print "Could not create proxy to ALMotion"
        print "Error was: ", e

    # We use the "Body" name to signify the collection of all joints
    pNames = "Body"
    pStiffnessLists = 1.0
    pTimeLists = 1.0
    motionProxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists)

    # print motion state
    print motionProxy.getSummary()


if __name__ == "__main__":
    robotIp = "127.0.0.1"

    if len(sys.argv) <= 1:
        print "Usage python motion_stiffnessOn.py robotIP (optional default: 127.0.0.1)"
    else:
        robotIp = sys.argv[1]

    main(robotIp)

Stiffness off

Warning

Please make sure that the robot is not standing before trying this example.

motion_stiffnessOff.py

# -*- encoding: UTF-8 -*- 

'''Stiffness Off: remove stiffness of all joints and actuators'''

import sys
from naoqi import ALProxy

def main(robotIP):

    try:
        motionProxy = ALProxy("ALMotion", robotIP, 9559)
    except Exception, e:
        print "Could not create proxy to ALMotion"
        print "Error was: ", e

    # We use the "Body" name to signify the collection of all joints
    pNames = "Body"
    pStiffnessLists = 0.0
    pTimeLists = 1.0
    motionProxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists)

    # print motion state
    print motionProxy.getSummary()


if __name__ == "__main__":
    robotIp = "127.0.0.1"

    if len(sys.argv) <= 1:
        print "Usage python motion_stiffnessOff.py robotIP (optional default: 127.0.0.1)"
    else:
        robotIp = sys.argv[1]

    main(robotIp)