Ejemplo n.º 1
0
    def set_step(self, step, force_refresh=False):
        """
        Set the absolulte position of the vehicle along it's path
        """

        if not self.path:
            return

        _num_segs = len(self.path.segments) - 1

        if step > _num_segs:
            step = _num_segs

        if self.step == step and not force_refresh:
            return

        self.orientation = \
            -TupleMath.bearing(
                self.path.segments[step].vector, (1.0, 0.0, 0.0)
            )

        _ori = \
            -TupleMath.signed_bearing(
                self.path.segments[step].vector, (1.0, 0.0, 0.0)
            )

        if self.step < _num_segs:

            _angle = self.path.segments[step].angle

            if _angle:
                self.update(_angle)

        self.step = step
Ejemplo n.º 2
0
    def set_look_ahead(self, vector):
        """
        Set the angle between the segment vector and passed vector
        vector - a unit vecotr in tuple form
        """

        self.angle = -TupleMath.signed_bearing(vector, self.vector)
        self.tangent = TupleMath.add(vector, self.vector)