Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

Playing Animations and Setting Posture

  1. First, import the necessary functions from the SIC framework:

from sic_framework.devices import Nao
from sic_framework.devices.common_naoqi.naoqi_motion import NaoPostureRequest, NaoqiAnimationRequest
  1. Connect to the Nao (computer must be connected to the same network)

nao = Nao(ip="NAO_IP_HERE")

  1. Set posture or play animation

  • To set the posture:

    • Second argument is the speed (NOTE: setting the speed too high may result in an error)

nao.motion.request(NaoPostureRequest("Stand", 0.5))
  • To play an animation:

nao.motion.request(NaoqiAnimationRequest("animations/Stand/Gestures/Hey_1"))

A list of all Nao animations can be found here.

A complete script for this tutorial can be found here: demo_nao_motion.py

Recording and Playing Custom Animations

  1. First, import the necessary functions from the SIC framework:

from sic_framework.devices import Nao
from sic_framework.devices.common_naoqi.naoqi_motion_recorder import (
    NaoqiMotionRecording,
    NaoqiMotionRecorderConf,
    PlayRecording,
    StartRecording,
    StopRecording,
)
from sic_framework.devices.common_naoqi.naoqi_stiffness import Stiffness
  1. Connect to the Nao (computer must be connected to the same network)

nao = Nao(ip="NAO_IP_HERE")

  1. Specify which Nao parts you want to record (NOTE: a ‘chain’ is a group of body parts, or a link of joints):

    1. The full list can be found here

chain = ["LArm", "RArm"]
  1. Set the stiffness of these parts to 0 so that you can move them

nao.stiffness.request(Stiffness(stiffness=0.0, joints=chain))
  1. Start the recording

    1. Set a ‘record_time' variable. This is how long it will record the Nao’s motion before saving it.

    2. It is recommended to include a message to indicate when to start moving the Nao

record_time = 10
print("Start moving the robot! (not too fast)")

nao.motion_record.request(StartRecording(chain))

time.sleep(record_time)
  1. Save the motion, give it a name

recording = nao.motion_record.request(StopRecording())
recording.save(MOTION_NAME)
  1. Play the recording back

    1. Set the stiffness of the limbs to 0.7 so that the motors can move them

nao.stiffness.request(Stiffness(.7, chain))

recording = NaoqiMotionRecording.load(MOTION_NAME)
nao.motion_record.request(PlayRecording(recording))

A complete script for this tutorial can be found here: demo_nao_motion_recorder.py

  • No labels