SE3插值
SE3插值用来进行所有在笛卡尔空间定义的插值。它提供一个类似于样条的插值,使初始速度和通过点被考虑到,并确保在速度限制内的流畅轨迹。
注意: |
如果要求的动作无法完成,机器人就会失去平衡而摔倒。所有笛卡尔动作都应该在模拟器上进行测试后再运用到机器人上。 |
---|
手臂轨迹范例
这个例子显示了一个简单的路径,由两个控制点、目标和当前位置组成。它使用相对的坐标,因此,当前位置都为零。
# Cartesian control: Arm trajectory example # Example showing a path of two positions # Needs a PoseInit before executing # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianArm1.py effector = "LArm" space = motion.SPACE_NAO axisMask = 7 # just control position isAbsolute = False # Since we are in relative, the current position is zero currentPos = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # define the changes relative to the current position dx = 0.06 # translation axis X (meters) dy = 0.06 # translation axis Y (meters) dz = 0.00 # translation axis Z (meters) dwx = 0.00 # rotation axis X (radians) dwy = 0.00 # rotation axis Y (radians) dwz = 0.00 # rotation axis Z (radians) targetPos = [dx, dy, dz, dwx, dwy, dwz] # go to the target and back again path = [targetPos, currentPos] times = [2.0, 4.0] # seconds proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute)
# Cartesian control: Arm trajectory example # Example showing a hand ellipsoid # Needs a PoseInit before executing # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianArm2.py effector = "LArm" space = motion.SPACE_NAO path = [ [0.0, -0.02, +0.00, 0.0, 0.0, 0.0], # Point 1 [0.0, +0.00, +0.01, 0.0, 0.0, 0.0], # Point 2 [0.0, +0.08, +0.00, 0.0, 0.0, 0.0], # Point 3 [0.0, +0.00, -0.04, 0.0, 0.0, 0.0], # Point 4 [0.0, -0.02, +0.00, 0.0, 0.0, 0.0], # Point 5 [0.0, +0.00, +0.00, 0.0, 0.0, 0.0]] # Point 6 axisMask = 7 # just control position times = [0.5, 1.0, 2.0, 3.0, 4.0, 4.5] # seconds isAbsolute = False proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute)
躯干和足部轨迹
这个例子显示如何同时完成躯干和腿部的轨迹。不受控制的右腿会表现为像是接收到了一个相对于零的命令。
- 降低躯干,移动至高于右腿的一点。
- 通过一个直立的中间位置,移动并向外转动左脚。
# Cartesian control: Torso and Foot trajectories # Example of a cartesian foot trajectory # Needs a PoseInit before executing # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianFoot.py space = motion.SPACE_NAO axisMask = 63 # control all the effector's axes isAbsolute = False # Lower the Torso and move to the side effector = "Torso" path = [0.0, -0.07, -0.03, 0.0, 0.0, 0.0] time = 2.0 # seconds proxy.positionInterpolation(effector, space, path, axisMask, time, isAbsolute) # LLeg motion effector = "LLeg" path = [0.0, 0.06, 0.00, 0.0, 0.0, 0.8] times = 2.0 # seconds proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute)
躯干轨迹
这个例子显示了一个包括若干目标位置的躯干轨迹,创建出一个类似转呼啦圈的动作。
# Cartesian control: Torso trajectory # Example showing a path of five positions # Needs a PoseInit before execution # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianTorso.py effector = "Torso" space = motion.SPACE_NAO # Position Only axisMask = 63 # Full control isAbsolute = False # define the changes relative to the current position dx = 0.050 # translation axis X (meter) dy = 0.055 # translation axis Y (meter) path = [ [+dx, 0.0, 0.0, 0.0, 0.0, 0.0], # Point 1 [0.0, -dy, 0.0, 0.0, 0.0, 0.0], # Point 2 [-dx, 0.0, 0.0, 0.0, 0.0, 0.0], # Point 3 [0.0, +dy, 0.0, 0.0, 0.0, 0.0], # Point 4 [+dx, 0.0, 0.0, 0.0, 0.0, 0.0], # Point 5 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] # Point 6 times = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] # seconds proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute)
多个执行器轨迹
这个例子的目的是同时指挥三个执行器,即躯干、左臂和右臂。
- 躯干动作:非阻塞式方法;
- 右臂动作:在躯干动作前半段为阻塞式方法;
- 左臂动作:在躯干动作后半段为阻塞式方法。
# Cartesian control: Multiple Effector Trajectories # Simultaneously control three effectors : # the Torso, the Left Arm and the Right Arm # Needs a PoseInit before executing # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianTorsoArm1.py space = motion.SPACE_NAO coef = 0.5 # motion speed times = [coef, 2.0*coef, 3.0*coef, 4.0*coef] isAbsolute = False # Relative movement between current and desired positions dy = +0.06 # translation axis Y (meters) dz = -0.03 # translation axis Z (meters) dwx = +0.30 # rotation axis X (radians) # Motion of Torso with post process effector = "Torso" path = [ [0.0, -dy, dz, -dwx, 0.0, 0.0], # Point 1 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], # Point 2 [0.0, +dy, dz, +dwx, 0.0, 0.0], # Point 3 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] # Point 4 axisMask = 63 # control all the effector axes proxy.post.positionInterpolation(effector, space, path, axisMask, times, isAbsolute) # Motion of Arms with block process axisMask = 7 # control just the position times = [1.0*coef, 2.0*coef] # seconds # Motion of Right Arm during the first half of the Torso motion effector = "RArm" path = [ [0.0, -dy, 0.0, 0.0, 0.0, 0.0], # Point 1 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] # Point 2 proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute) # Motion of Left Arm during the last half of the Torso motion effector = "LArm" path = [ [0.0, dy, 0.0, 0.0, 0.0, 0.0], # Point 1 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] # Point 2 proxy.positionInterpolation(effector, space, path, axisMask, times, isAbsolute)
下面这个例子是要移动躯干,同时让两臂保持在世界空间里:
# Cartesian control: Multiple Effector Trajectories # Move the torso and keep arms fixed in world space # Needs a PoseInit before executing # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_cartesianTorsoArm2.py space = motion.SPACE_NAO coef = 1.0 # Speed motion times = [coef, 2.0*coef, 3.0*coef, 4.0*coef] # seconds isAbsolute = False dx = 0.04 # translation axis X (meters) dy = 0.04 # translation axis Y (meters) # Motion of the Torso effector = "Torso" path = [ [ 0.0, +dy, 0.0, 0.0, 0.0, 0.0], # Point 1 [ -dx, 0.0, 0.0, 0.0, 0.0, 0.0], # Point 2 [ 0.0, -dy, 0.0, 0.0, 0.0, 0.0], # Point 3 [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] # Point 4 axisMask = 63 # control all the effector axis # Using 'post' makes this command execute in a another thread proxy.post.positionInterpolation(effector, space, path, axisMask, times, isAbsolute) # Motion of Arms axisMask = 7 # control the position time = 4.0*coef # seconds # Arms have a null relative motion during all the torso motion path = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Point 1 # Motion of Right Arm effector = "RArm" proxy.post.positionInterpolation(effector, space, path, axisMask, time, isAbsolute) # Motion of Left Arm effector = "LArm" proxy.positionInterpolation(effector, space, path, axisMask, time, isAbsolute)