Nao动作控制总结(一)

         最近一段时间开始进行Nao机器人动作控制的学习。从Nao机器人官网查找了一些资料并进行了一下动作控制相关资料的整理,并初步实现Nao机器人动作的简单控制。

       资料整理如下:


1.Spaces

When creating a command for NAO, much attention needs to be placed on the space used to define the command, as a mistake in space could lead to disastrous results.

  • FRAME_TORSO: this is attached to NAO’s torso reference, so moves with NAO as he walks and changes orientation as he leans. This space is useful when you have very local tasks, that make sense in the orientation of the torso frame.

  • FRAME_WORLD: this is a fixed origin that is never altered. It is left behind when NAO walks, and will be different in z rotation after NAO has turned. This space is useful for calculations which require an external, absolute frame of reference.

  • FRAME_ROBOT: this is average of the two feet positions projected around a vertical z axis. This space is useful, because the x axis is always forwards, so provides a natural ego-centric reference.

这里是常用的坐标空间,控制机器人一般是用到FRAME_ROBOT这个空间,如果与其他的平台链接,可能需要空间坐标的转换。

2.Effectors

An effector is apredefined 3D point in NAO and it’s generally the end of a chain. We choosethese points because with a biped robot, we want for example:


  • control the hand in order to catch anobject or

  • control the foot to kick in a ball.

    Cartesian methodsaccept commands for the five chains plus “Torso”. The position of these controlpoints is shown below. These effectors names are identical to the chain nameexcept for “Torso”.


Effector name

Position

End transform

“Head”

At the neck joint

Position3D(0.0, 0.0, 0.0)

“LArm”

Inside the hand

Position3D(HandOffsetX, 0.0, -HandOffsetZ)

“LLeg”

Below the ankle

Position3D(0.0, 0.0, -FootHeight)

“RLeg”

Below the ankle

Position3D(0.0, 0.0, -FootHeight)

“RArm”

Inside the hand

Position3D(HandOffsetX, 0.0, -HandOffsetZ)

“Torso”

A reference point in the torso

Position3D(0.0, 0.0, 0.0)

Nao动作控制总结(一)_第1张图片

这里介绍了Nao的一些终端效应器,通过控制这些终端效应器的位置和角度值,可以实现一些基本动作的实现,具体实现是由Nao本身通过算法实现。


3.DCMand ALMotion cohabitation

It is possible to use at the same time DCM and ALMotion but it requires some precautions.

It is not really well-made and we will improve it on the nextversion.

Using DCM afterMotion

Deactivate Smart Stiffness: ALMotion does not getthe command angles directly sent to DCM and cannot manage the Stiffness for the given posture.

With Smart Stiffness, NAO should have not enough stiffness torealize the desired motion.

Using Motionafter DCM

After using DCM, ALMotion’s command angles are not updated to the internal model.To avoid jerky transition between using DCM andALMotion, there are two options:


  • Reset the joint angles to the previous ALMotion posture before using the DCM, or

  • Remove and reset the Stiffness of the joints moved by DCM

这个是DCM与ALMotion的先后取舍问题,如果要求快速控制机器人的动作,可能需要考虑这方面的问题。看介绍这个问题,Nao在快速动作控制时的系统也没法及时平稳的控制,需要在后面的版本进行改进。



4.Stiffness control   

What it does

These API control the Stiffness of one or several joint(s).

The Stiffness of the joint is equivalent to atorque limitation into the motors.


  • If the joint stiffness is set to 0.0, the joint controller doesnothing and the joint is free.

  • Else with a value at 1.0 the joint is allowed to use full torquepower to reach a given position.

  • Between these two extremes, the joint is more or less compliant(tries to reach a position but if torque need to move is higher than thelimitation of Stiffness, the joint doesn’t reach the target position).

    The Stiffness can be managed:


  • globally, on the whole robot using: ALMotionProxy::wakeUp() and ALMotionProxy::rest()

  • specifically, for one or several joint(s) using: ALMotionProxy::stiffnessInterpolation()ALMotionProxy::getStiffnesses() or ALMotionProxy::setStiffnesses()

这部分介绍如何刚性控制Nao机器人的各个关节,设置不同的stiffness值,可以控制Nao机器人各关节自由度灵活控制的程度。


5.Joint control

These API are dedicated to control directly the position of NAOjoints.

Each joint can be controlled individually, or in parallel withother joints.

There are two ways of controlling a joint or a group of joints:


  • animation methods (time fixed, blocking function)


    • ALMotionProxy::angleInterpolation()

    • ALMotionProxy::angleInterpolationWithSpeed()


  • reactive methods (could be changed every ALMotion cycle, non blocking function)


    • ALMotionProxy::setAngles()

    • ALMotionProxy::changeAngles()


These API just create ahigher level of the DCM actuatorcontrol and provide interpolation to have more smooth behavior.


Getting started


“Body”, chainsand joint names


Joints can be controlled:


  • individually, using a joint name, or

  • in parallel, using a chain of joints or a group of joints like“Body”.


The table below lists thechains and all the joints included in each chain:


Body is ...

Head + LArm + LLeg + RLeg + RArm

The chain ...

Head

LArm

LLeg

RLeg

RArm

involves the

joints ...

HeadYaw

LShoulderPitch

LHipYawPitch1

RHipYawPitch1

RShoulderPitch

HeadPitch

LShoulderRoll

LHipRoll

RHipRoll

RShoulderRoll

 

LElbowYaw

LHipPitch

RHipPitch

RElbowYaw

 

LElbowRoll

LKneePitch

RKneePitch

RElbowRoll

 

LWristYaw2

LAnklePitch

RAnklePitch

RWristYaw2

 

LHand2

RAnkleRoll

LAnkleRoll

RHand2

这里介绍了如何,用关节自由度的角度值去控制Nao机器人的动作,分为两大种方法,一种是设置固定时间点的动画方式;另一种是实时反映的方式。里面有一些接口函数,用来选择是控制动作每次是针对初始姿态还是针对上一条命令结束完Nao的姿态。后面是Nao的25个自由度的介绍。



6.Whole Body control

Whole Body Balancer is apowerful tool which gives a very natural and safe motion.

The main goal is togenerate and stabilize consistent motions and adapt NAO’s behavior to thesituation.

This tool comes with two main functionalities:


  • stabilized motion methods: the goal is to stabilize motion generated by Joint control (and Choregraphe) or Cartesian control:


    • ALMotionProxy::wbFootState()

    • ALMotionProxy::wbEnableBalanceConstraint()

    • ALMotionProxy::wbGoToBalance()


  • safe Cartesian control methods:


    • ALMotionProxy::wbEnableEffectorControl()

    • ALMotionProxy::wbSetEffectorControl()

正如上面所说,这个函数设置为了保证动作的平衡。


7.General tools


These API are dedicated to give some useful tools to control NAO.

The API section of these tools are welldocumented, so only two methods are studied here.


Use Case


Case 1: View Motion’s current state


Using the ALMotionProxy::getSummary() method, you can quickly see thecurrent state of all the joints in the body, and any running tasks.


# Example showing how to get the current state of NAO
> print proxy.getSummary()
---------------------- Model ---------------------------
JointName       Stiffness     Command     Sensor
HeadYaw         1.000000      0.000000    0.007628
HeadPitch       1.000000      0.000000   -0.023052
LShoulderPitch  1.000000      2.094395    2.072392
LShoulderRoll   1.000000      0.261799    0.242330
LElbowYaw       1.000000     -1.570796   -1.558586
LElbowRoll      1.000000     -1.396263   -1.368286
LWristYaw       1.000000      0.000000    0.010696
LHand           1.000000      0.000000    0.019299
LHipYawPitch    1.000000      0.000000    0.004644
LHipRoll        1.000000      0.000000    0.000042
LHipPitch       1.000000     -0.529983   -0.572140
LKneePitch      1.000000      1.059966    1.147390
LAnklePitch     1.000000     -0.529983   -0.569156
LAnkleRoll      1.000000      0.000000    0.000042
RHipYawPitch    1.000000      0.000000   -0.007670
RHipRoll        1.000000      0.000000    0.000042
RHipPitch       1.000000     -0.529983   -0.561486
RKneePitch      1.000000      1.059966    1.144406
RAnklePitch     1.000000     -0.529983   -0.579810
RAnkleRoll      1.000000      0.000000    0.000042
RShoulderPitch  1.000000      2.094395    2.067874
RShoulderRoll   1.000000     -0.261799   -0.233210
RElbowYaw       1.000000      1.570796    1.560036
RElbowRoll      1.000000      1.396263    1.368370
RWristYaw       1.000000      0.000000   -0.004644
RHand           1.000000      0.000000    0.014936


When NAO is moving,motion is interpolating between the current command value and your targetvalue. As it takes a little time for the command to go to the motor cards, andsome time for the sensed value to become available, you may see that the sensorvalues are very slightly lagging behind the commands.


Case 2:Programmatic access to Joint Names


Programmatically, you canget the joint names for the body or a chain, using the ALMotionProxy::getBodyNames() method.


# Example showing how to get joint names
> print proxy.getBodyNames("Body")
['HeadYaw', 'HeadPitch',
'LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll',
'LHipYawPitch', 'LHipRoll', 'LHipPitch', 'LKneePitch', 'LAnklePitch', 'LAnkleRoll',
'RHipYawPitch', 'RHipRoll', 'RHipPitch', 'RKneePitch', 'RAnklePitch', 'RAnkleRoll',
'RShoulderPitch', 'RShoulderRoll', 'RElbowYaw', 'RElbowRoll']
> print proxy.getBodyNames("LArm")
['LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll']


这个相关函数的作用是,获取Nao机器人在运行的过程中,各关节和传感器的信息。


8.Joints

这里介绍了Nao机器人每个关节的自由度定义以及每个关节可运动范围的信息,对于Nao机器人的运动控制非常重要,具体详见Nao官网或者自己安装的光盘的Nao机器人Reference部分。


由于本人水平有限,如果有什么描述或者表达不准确的地方,希望大家批评指正!











你可能感兴趣的:(Nao机器人,nao,开发,机器人,动作控制,c++)