Пример #1
0
 def __init__(self, shapes, friction_coeff, collision_solver=None,
              proximity=0.02, name=None):
     self._mu = friction_coeff
     PointContact.__init__(self, shapes, collision_solver, proximity)
     NamedObject.__init__(self, name)
     self._force = zeros(4)
     self._eps = array((1., 1., 1.))
Пример #2
0
 def __init__(self, joint, min, max, proximity=None, 
              name=None):
     from arboris.joints import LinearConfigurationSpaceJoint
     if not isinstance(joint, LinearConfigurationSpaceJoint):
         raise ValueError()
     self._joint = joint
     NamedObject.__init__(self, name)
     self._min = array(min).reshape((joint.ndof,))
     self._max = array(max).reshape((joint.ndof,))
     if proximity is None:
         #TODO: choose a proper default for tol according to the joint type
         self._proximity = zeros((joint.ndof,))
         self._proximity[:] = joint_limits_proximity
     else:
         self._proximity = array(proximity).reshape((joint.ndof,))
     self._pos0 = None
     self._jacobian = None
     self._force = zeros((joint.ndof,))
Пример #3
0
    def __init__(self, cdof=None, weight=1, level=0, is_active=True, name=None):
        """ Save the generic values of a task.

        :param cdof: the controlled dofs of the part.
        :type cdof: list

        :param weight: the weight (importance) of the task.
        :type weight: float in [0,1]

        :param level: the level (importance) of the task.
        :type level: integer

        :param is_active: set the activity of the task.
        :type is_active: True or False

        :param name: the name of the task.
        :type name: string
        """
        name = name if name else str(id(self))
        NamedObject.__init__(self, name)
        self._cdof = cdof or []
        self._weight = weight
        self._level = level
        self._is_active = is_active

        self._cost = None
        self._norm = None
        self._formalism = None

        self._E = zeros((0, 0))
        self._f = zeros(0)
        self._error = 0.
        self._J = zeros((0, 0)) # overwritten by inherited classes

        self._inv_lambda    = zeros((0, 0))
        self._lambda        = zeros((0, 0))
        self._inv_ellipsoid = zeros((0, 0))
        self._ellipsoid     = zeros((0, 0))
        self._L_T           = zeros((0, 0))

        self._inv_lambda_is_already_computed    = False
        self._lambda_is_already_computed        = False
        self._inv_ellipsoid_is_already_computed = False
        self._ellipsoid_is_already_computed     = False
Пример #4
0
    def __init__(self, cond, exe, name = None):
        """ An initialization of the Event instance

        inputs:
        cond: a list of conditions, should be Cond instance
        exe: a list of execution, should be Exe instance
        """
        NamedObject.__init__(self, name)
        self.is_active = True
        self._cond_is_fulfilled = False
        if not isinstance(cond, list):
            cond = [cond]
        for c in cond:
            if not isinstance(c, Cond):
                raise TypeError( \
                'The elements of the cond list must be Cond instance')
        self.cond = cond
        if not isinstance(exe, list):
            exe = [exe]
        for e in exe:
            if not isinstance(e, Exe):
                raise TypeError( \
                'The elements of the exe list must be Exe instance')
        self.exe = exe
Пример #5
0
    def __init__(self, cond, exe, name=None):
        """ An initialization of the Event instance

        inputs:
        cond: a list of conditions, should be Cond instance
        exe: a list of execution, should be Exe instance
        """
        NamedObject.__init__(self, name)
        self.is_active = True
        self._cond_is_fulfilled = False
        if not isinstance(cond, list):
            cond = [cond]
        for c in cond:
            if not isinstance(c, Cond):
                raise TypeError( \
                'The elements of the cond list must be Cond instance')
        self.cond = cond
        if not isinstance(exe, list):
            exe = [exe]
        for e in exe:
            if not isinstance(e, Exe):
                raise TypeError( \
                'The elements of the exe list must be Exe instance')
        self.exe = exe
Пример #6
0
 def __init__(self, frames, name=None):
     self._force = zeros(3)
     self._pos0 = None
     NamedObject.__init__(self, name)
     self._frames = frames