Example #1
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        joysticks = blenderapi.joysticks()
        if joysticks.count(None) == len(joysticks):
            logger.error("No Joystick detected")
        else:
            logger.info("Found Joystick: " + repr(joysticks) )

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency
        elif self._type == 'Differential':
            self._stopped = True
            # get track width for calculating wheel speeds from yaw rate
            parent = self.robot_parent
            self._trackWidth = parent._trackWidth
            self._radius = parent._wheelRadius

        """ Documentation says: ``bge.types.SCA_JoystickSensor.axisValues``
        Each specifying the value of an axis between -32767 and 32767 depending
        on how far the axis is pushed, 0 for nothing. The first 2 values are
        used by most joysticks and gamepads for directional control. 3rd and
        4th values are only on some joysticks and can be used for arbitary
        controls.
        """
        # speed_factor = - speed / max
        self._speed_factor = - self._speed / 32767.0

        logger.info('Component initialized')
Example #2
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        joysticks = blenderapi.joysticks()
        if joysticks.count(None) == len(joysticks):
            logger.error("No Joystick detected")
        else:
            logger.info("Found Joystick: " + repr(joysticks))

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency
        elif self._type == 'Differential':
            self._stopped = True
            # get track width for calculating wheel speeds from yaw rate
            parent = self.robot_parent
            self._trackWidth = parent._trackWidth
            self._radius = parent._wheelRadius
        """ Documentation says: ``bge.types.SCA_JoystickSensor.axisValues``
        Each specifying the value of an axis between -32767 and 32767 depending
        on how far the axis is pushed, 0 for nothing. The first 2 values are
        used by most joysticks and gamepads for directional control. 3rd and
        4th values are only on some joysticks and can be used for arbitary
        controls.
        """
        # speed_factor = - speed / max
        self._speed_factor = -self._speed / 32767.0

        logger.info('Component initialized')
Example #3
0
    def __init__(self, obj, parent=None):
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Correct the speed considering the Blender clock
        if self._type == "Position":
            self._speed = self._speed / self.frequency
        logger.info("Component initialized")
Example #4
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency
        logger.info('Component initialized')
Example #5
0
    def __init__(self, obj, parent=None):
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        self.local_data['mode'] = obj['mode']
        self._last_mode = None

        logger.info('Component initialized')
Example #6
0
    def __init__(self, obj, parent=None):
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        self.local_data['mode'] = obj['mode']
        self._last_mode = None

        logger.info('Component initialized')
Example #7
0
    def __init__(self, obj, parent=None):
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class

	
	Actuator.__init__(self, obj, parent=)

	self.left.eye = parent.bge_object,children["left_eye"]
	self.right.eye = parent.bge_object,children["right_eye"]

        logger.info('Component initialized')
Example #8
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency

        self.zero_motion = True

        logger.info('Component initialized')
Example #9
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency
        elif self._type == 'Differential':
            self._stopped = True
            # get track width for calculating wheel speeds from yaw rate
            parent = self.robot_parent
            self._trackWidth = parent._trackWidth
            self._radius = parent._wheel_radius

        logger.info('Component initialized')
Example #10
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Correct the speed considering the Blender clock
        if self._type == 'Position':
            self._speed = self._speed / self.frequency
        elif self._type == 'Differential':
            self._stopped = True
            # get track width for calculating wheel speeds from yaw rate
            parent = self.robot_parent
            self._trackWidth = parent._trackWidth
            self._radius = parent._wheelRadius

        logger.info('Component initialized')
Example #11
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Get the references (based on their name) to the childen object and
        # store a transformation3d structure for their position
        for child in self.bge_object.childrenRecursive:
            if 'PanBase' in child.name:
                self._pan_base = child
                self._pan_orientation = child.localOrientation
            elif 'TiltBase' in child.name:
                self._tilt_base = child
                self._tilt_orientation = child.localOrientation

        # Any other objects children of the PTU are assumed
        #  to be mounted on top of it
        for child in self.bge_object.children:
            if not 'PanBase' in child.name:
                child.setParent(self._tilt_base)

        # Check the bases were found, or exit with a message
        try:
            logger.info("Using pan base: '%s'" % self._pan_base.name)
            logger.info("Using tilt base: '%s'" % self._tilt_base.name)
        except AttributeError:
            logger.error(
                "PTU is missing the pan and/or tilt bases. Module will not work!"
            )
            return

        # Variables to store current angles
        self._current_pan = 0.0
        self._current_tilt = 0.0

        logger.info('Component initialized')
Example #12
0
    def __init__(self, obj, parent=None):
        logger.info('%s initialization' % obj.name)
        # Call the constructor of the parent class
        Actuator.__init__(self, obj, parent)

        # Get the references (based on their name) to the childen object and
        # store a transformation3d structure for their position
        for child in self.bge_object.childrenRecursive:
            if 'PanBase' in child.name:
                self._pan_base = child
                self._pan_orientation = child.localOrientation
            elif 'TiltBase' in child.name:
                self._tilt_base = child
                self._tilt_orientation = child.localOrientation

        # Any other objects children of the PTU are assumed
        #  to be mounted on top of it
        for child in self.bge_object.children:
            if not 'PanBase' in child.name:
                child.setParent(self._tilt_base)

        # Check the bases were found, or exit with a message
        try:
            logger.info("Using pan base: '%s'" % self._pan_base.name)
            logger.info("Using tilt base: '%s'" % self._tilt_base.name)
        except AttributeError:
            logger.error("PTU is missing the pan and/or tilt bases. Module will not work!")
            return


        # Variables to store current angles
        self._current_pan = 0.0
        self._current_tilt = 0.0


        logger.info('Component initialized')