示例#1
0
    def createTasks(self, robot):
        self.taskHalfSitting = MetaTaskKinePosture(self.robot.dynamic,
                                                   'halfsitting')
        self.taskInitialPose = MetaTaskKinePosture(self.robot.dynamic,
                                                   'initial-pose')
        self.taskGripper = MetaTaskKinePosture(self.robot.dynamic, 'gripper')

        (self.tasks['trunk'],
         self.gains['trunk']) = self.createTrunkTask(robot, 'trunk')

        self.taskRF = self.tasks['left-ankle']
        self.taskLF = self.tasks['right-ankle']
        self.taskCom = self.tasks['com']
        self.taskRH = self.tasks['right-wrist']
        self.taskLH = self.tasks['left-wrist']
        self.taskTrunk = self.tasks['trunk']
        self.taskPosture = self.tasks['posture']
        self.taskBalance = self.tasks['balance']
        self.taskWaist = self.tasks['waist']
示例#2
0
def createTasks(robot):

    # MetaTasks dictonary
    robot.mTasks = dict()
    robot.tasksIne = dict()

    # Foot contacts
    robot.contactLF = MetaTaskKine6d('contactLF', robot.dynamic, 'LF', robot.OperationalPointsMap['left-ankle'])
    robot.contactLF.feature.frame('desired')
    robot.contactLF.gain.setConstant(10)
    robot.contactRF = MetaTaskKine6d('contactRF', robot.dynamic, 'RF', robot.OperationalPointsMap['right-ankle'])
    robot.contactRF.feature.frame('desired')
    robot.contactRF.gain.setConstant(10)

    # MetaTasksKine6d for other operational points
    robot.mTasks['waist'] = MetaTaskKine6d('waist', robot.dynamic, 'waist', robot.OperationalPointsMap['waist'])
    robot.mTasks['chest'] = MetaTaskKine6d('chest', robot.dynamic, 'chest', robot.OperationalPointsMap['chest'])
    robot.mTasks['rh'] = MetaTaskKine6d('rh', robot.dynamic, 'rh', robot.OperationalPointsMap['right-wrist'])
    robot.mTasks['lh'] = MetaTaskKine6d('lh', robot.dynamic, 'lh', robot.OperationalPointsMap['left-wrist'])

    for taskName in robot.mTasks:
        robot.mTasks[taskName].feature.frame('desired')
        robot.mTasks[taskName].gain.setConstant(10)

    handMgrip = eye(4)
    handMgrip[0:3, 3] = (0, 0, -0.14)
    robot.mTasks['rh'].opmodif = matrixToTuple(handMgrip)
    robot.mTasks['lh'].opmodif = matrixToTuple(handMgrip)

    # CoM Task
    robot.mTasks['com'] = MetaTaskKineCom(robot.dynamic)
    robot.dynamic.com.recompute(0)
    robot.mTasks['com'].featureDes.errorIN.value = robot.dynamic.com.value
    robot.mTasks['com'].task.controlGain.value = 10
    robot.mTasks['com'].feature.selec.value = '011'

    # Posture Task
    robot.mTasks['posture'] = MetaTaskKinePosture(robot.dynamic)
    robot.mTasks['posture'].ref = robot.halfSitting
    robot.mTasks['posture'].gain.setConstant(5)

    # TASK INEQUALITY

    # Task Height
    featureHeight = FeatureGeneric('featureHeight')
    plug(robot.dynamic.com, featureHeight.errorIN)
    plug(robot.dynamic.Jcom, featureHeight.jacobianIN)
    robot.tasksIne['taskHeight'] = TaskInequality('taskHeight')
    robot.tasksIne['taskHeight'].add(featureHeight.name)
    robot.tasksIne['taskHeight'].selec.value = '100'
    robot.tasksIne['taskHeight'].referenceInf.value = (0., 0., 0.)  # Xmin, Ymin
    robot.tasksIne['taskHeight'].referenceSup.value = (0., 0., 0.80771)  # Xmax, Ymax
    robot.tasksIne['taskHeight'].dt.value = robot.timeStep
示例#3
0
# --- TASK SUPPORT SMALL --------------------------------------------
featureSupportSmall = FeatureGeneric('featureSupportSmall')
plug(dyn.com, featureSupportSmall.errorIN)
plug(dyn.Jcom, featureSupportSmall.jacobianIN)

taskSupportSmall = TaskInequality('taskSupportSmall')
taskSupportSmall.add(featureSupportSmall.name)
taskSupportSmall.selec.value = '011'
#taskSupportSmall.referenceInf.value = (-0.02,-0.02,0)    # Xmin, Ymin
#askSupportSmall.referenceSup.value = (0.02,0.02,0)  # Xmax, Ymax
taskSupportSmall.referenceInf.value = (-0.02, -0.05, 0)  # Xmin, Ymin
taskSupportSmall.referenceSup.value = (0.02, 0.05, 0)  # Xmax, Ymax
taskSupportSmall.dt.value = dt

# --- POSTURE ---
taskPosture = MetaTaskKinePosture(dyn)

# --- GAZE ---
taskGaze = MetaTaskVisualPoint('gaze', dyn, 'head', 'gaze')
# Head to camera matrix transform
# Camera RU headMcam=array([[0.0,0.0,1.0,0.0825],[1.,0.0,0.0,-0.029],[0.0,1.,0.0,0.102],[0.0,0.0,0.0,1.0]])
# Camera LL
headMcam = array([[0.0, 0.0, 1.0, 0.081], [1., 0.0, 0.0, 0.072],
                  [0.0, 1., 0.0, 0.031], [0.0, 0.0, 0.0, 1.0]])
headMcam = dot(headMcam, rotate('x', 10 * pi / 180))
taskGaze.opmodif = matrixToTuple(headMcam)

# --- FOV ---
taskFoV = MetaTaskVisualPoint('FoV', dyn, 'head', 'gaze')
taskFoV.opmodif = matrixToTuple(headMcam)
示例#4
0
taskSupport.dt.value=dt

# --- TASK SUPPORT SMALL --------------------------------------------
featureSupportSmall = FeatureGeneric('featureSupportSmall')
plug(robot.dynamic.com,featureSupportSmall.errorIN)
plug(robot.dynamic.Jcom,featureSupportSmall.jacobianIN)

taskSupportSmall=TaskInequality('taskSupportSmall')
taskSupportSmall.add(featureSupportSmall.name)
taskSupportSmall.selec.value = '011'
taskSupportSmall.referenceInf.value = (-0.02,-0.05,0)    # Xmin, Ymin
taskSupportSmall.referenceSup.value = (0.02,0.05,0)  # Xmax, Ymax
taskSupportSmall.dt.value=dt

# --- POSTURE ---
taskPosture = MetaTaskKinePosture(robot.dynamic)

# --- GAZE ---
taskGaze = MetaTaskVisualPoint('gaze',robot.dynamic,'head','gaze')
# Head to camera matrix transform
# Camera RU headMcam=array([[0.0,0.0,1.0,0.0825],[1.,0.0,0.0,-0.029],[0.0,1.,0.0,0.102],[0.0,0.0,0.0,1.0]])
# Camera LL 
headMcam=array([[0.0,0.0,1.0,0.081],[1.,0.0,0.0,0.072],[0.0,1.,0.0,0.031],[0.0,0.0,0.0,1.0]])
headMcam = dot(headMcam,rotate('x',10*pi/180))
taskGaze.opmodif = matrixToTuple(headMcam)

# --- FOV ---
taskFoV = MetaTaskVisualPoint('FoV',robot.dynamic,'head','gaze')
taskFoV.opmodif = matrixToTuple(headMcam)

taskFoV.task=TaskInequality('taskFoVineq')