平衡
在关节控制(例如Choregraphe时间轴)过程中,动作可通过Whole Body balancer(全身平衡器)来保持平稳。 由此,初始动作会被调整,以达到最为遵守平衡和/或足部状态的动作。
必须激活Whole Body balancer,才能使用以下函数(API wbEnable)。
Foot State(足部状态)
该API设定足部状态:
- Fixed(固定)。6个笛卡尔自由度受限制。 双足被完全固定。
- Plane(平面)。它将双足限制在平面里。以下笛卡尔坐标是受限制的(Z, WX, WY)。双足可以在X、Y和WZ轴里移动。
- Free(自由)。双足可以在所有笛卡尔轴里移动。
# Example showing how to fix the feet. stateName = "Fixed" supportLeg = "Legs" proxy.wbFootState(stateName, supportLeg)
注释: |
使用Choregraphe指令盒"Keep Balance"! |
---|
Balance Constraint(平衡约束)
可以激活/解除平衡。支撑多边形取决于支撑腿:Legs (双足)、LLeg或RLeg。
# Example showing how to Constraint Balance Motion. isEnable = True supportLeg = "Legs" proxy.wbEnableBalanceConstraint(isEnable, supportLeg)
最后,必须约束Foot。可以使用以下组合:
# wbEnableBalanceConstraint(True, "Legs") with: # - wbFootState("Fixed", "Legs") # - wbFootState("Fixed", "LLeg") and wbFootState("Plane", "RLeg") # - wbFootState("Fixed", "RLeg") and wbFootState("Plane", "LLeg") # wbEnableBalanceConstraint(True, "LLeg") with: # - wbFootState("Fixed", "Legs") # - wbFootState("Fixed", "LLeg") and wbFootState("Fixed", "RLeg") # - wbFootState("Fixed", "LLeg") and wbFootState("Plane", "RLeg") # - wbFootState("Fixed", "LLeg") and wbFootState("Free" , "RLeg") # wbEnableBalanceConstraint(True, "RLeg") with: # - wbFootState("Fixed", "Legs") # - wbFootState("Fixed", "RLeg") and wbFootState("Fixed", "LLeg") # - wbFootState("Fixed", "RLeg") and wbFootState("Plane", "LLeg") # - wbFootState("Fixed", "RLeg") and wbFootState("Free" , "LLeg")
注意: |
当被要求时,如果COM不在预定的支撑多边形中,这一约束就不会被激活。 |
---|
范例
# Example of a whole body FootState # Warning: Needs a PoseInit before executing # Whole body balancer must be disactivated at the end of the script # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_wbFootState.py # Activate Whole Body Balancer. isEnabled = True proxy.wbEnable(isEnabled) # Legs are constrained in a plane stateName = "Plane" supportLeg = "Legs" proxy.wbFootState(stateName, supportLeg) # HipYawPitch angleInterpolation # Without Whole Body balancer, foot will not be kept plane. names = "LHipYawPitch" angleLists = [-45.0, 10.0, 0.0] timeLists = [3.0, 6.0, 9.0] isAbsolute = True angleLists = [angle*math.pi/180.0 for angle in angleLists] proxy.angleInterpolation(names, angleLists, timeLists, isAbsolute) # Disactivate Whole Body Balancer. isEnabled = False proxy.wbEnable(isEnabled)
# Example of a whole body Enable Balance Constraint # Warning: Needs a PoseInit before executing # Whole body balancer must be disactivated at the end of the script # Example available: path/to/aldebaran-sdk/modules/src/examples/ # python/motion_wbEnableBalanceConstraint.py # Activate Whole Body Balancer. isEnabled = True proxy.wbEnable(isEnabled) # Legs are constrained in a plane stateName = "Fixed" supportLeg = "Legs" proxy.wbFootState(stateName, supportLeg) # Constraint Balance Motion. isEnable = True supportLeg = "Legs" proxy.wbEnableBalanceConstraint(isEnable, supportLeg) # KneePitch angleInterpolation # Without Whole Body balancer, foot will fall down. names = ["LKneePitch", "RKneePitch"] angleLists = [ [0.0, 40.0*math.pi/180.0], [0.0, 40.0*math.pi/180.0]] timeLists = [ [5.0, 10.0], [5.0, 10.0]] isAbsolute = True proxy.angleInterpolation(names, angleLists, timeLists, isAbsolute) # Disactivate Whole Body Balancer. isEnabled = False proxy.wbEnable(isEnabled)