Example #1
0
    def __init__(self,
                 name="MotionPath",
                 curve=None,
                 begintime=0.0,
                 endtime=1.0,
                 loop=False,
                 follow=False,
                 bank=False,
                 bankamplitude=0.1,
                 auto_insert=True):
        """Constructor.
        """
        Component.__init__(self, name=name, auto_insert=auto_insert)

        self.curve = curve

        self.begintime = begintime
        self.endtime = endtime
        self.loop = loop
        self.follow = follow
        self.bank = bank
        self.bankamplitude = bankamplitude

        self.transform_slot = ProceduralMat4Slot(self.computeTransform)
        self.time_slot = DoubleSlot()
        self.time_slot.addDependent(self.transform_slot)
        self.addSlot("transform", self.transform_slot)
        self.addSlot("time", self.time_slot)
Example #2
0
    def __init__(self,
                 name = "MotionPath",
                 curve = None,
                 begintime = 0.0,
                 endtime = 1.0,
                 loop = False,
                 follow = False,
                 bank = False,
                 bankamplitude = 0.1,
                 auto_insert = True):
        """Constructor.
        """
        Component.__init__(self, name=name, auto_insert=auto_insert)
        
        self.curve = curve

        self.begintime = begintime
        self.endtime = endtime
        self.loop = loop
        self.follow = follow
        self.bank = bank
        self.bankamplitude = bankamplitude

        self.transform_slot = ProceduralMat4Slot(self.computeTransform)
        self.time_slot = DoubleSlot()
        self.time_slot.addDependent(self.transform_slot)
        self.addSlot("transform", self.transform_slot)
        self.addSlot("time", self.time_slot)
Example #3
0
    def __init__(self, 
                 name="Sensor",
                 receiver=None,
                 emitter=None, 
                 relative_pos=vec3()):

        Component.__init__(self, name)
        self.receiver = receiver
        self.emitter = emitter
        self.type = None
        self.relative_pos = relative_pos
        self.pos_slot = ProceduralVec3Slot(self._computeSensorPos)
        self.addSlot("pos", self.pos_slot)
Example #4
0
    def __init__(self, 
                 world,
                 name = "Motor",
                 block = None, 
                 link = None,
                 angle = 0.0,
                 cfg = None,
                 **params):

        Component.__init__(self, name)
        # define motor slots
        self.initialize_slots = True
        self.status_slot = StrSlot(IDLE)
        self.angle_slot = DoubleSlot(angle)
        self.pos_slot = Vec3Slot()
        self._lastAngle = angle
        self.addSlot("status", self.status_slot)
        self.addSlot("angle", self.angle_slot)
        self.addSlot("pos", self.pos_slot)
        self._angle_forwader = NotificationForwarder(self._onAngleChanged)
        self.angle_slot.addDependent(self._angle_forwader)
        self.initialize_slots = False

        self.world = world
        self.cfg = cfg
        self.block = block
        self.link = link
        self._remainingTime = self.cfg['timeout']

        self._createComponents()
        self._configureComponents()
        self._connectComponents()

        # add joint to world
        self.world.add(self._joint)

        # listen to events
        eventManager().connect(STEP_FRAME, self._onStepFrame)
Example #5
0
    def __init__(self,
                 world,
                 name="Robot",
                 cfg = None,
                 data = None):

        Component.__init__(self, name)

        self.world = world
        self.modules = []
        self.cfg = cfg
        self.brain = None
        self.interactive = True
        self._preState = None
        self._action = None
        self._actionDone = True
        self._steps = 0
        self._initialPos = 0
        self._totalWalked = 0
        self._timer = getScene().timer()
        self._beforeExecution = self._timer.time

        eventManager().connect(STEP_FRAME, self._onStepFrame)
Example #6
0
    def __init__(self, 
                 world,
                 name = "Module", 
                 pos = vec3(),
                 rot = mat3(),
                 robot = None,
                 cfg = None,
                 data = None):

        Component.__init__(self, name=name)

        self.world = world
        self.pos = pos
        self.rot = rot
        self.robot = robot
        self.cfg = cfg
        self.data = data
        self.sensor = {}

        self._createBlocks()
        self._createLink()
        self._connectObjects()
        self._positionObjects()
        self._configureSensors()