srunner/scenariomanager/scenarioatomics/atomic_behaviors.py
def update(self):
        """
        Check the actor's state along the waypoint route.

        returns:
            py_trees.common.Status.SUCCESS, if the lane offset was reached (and 'continuous' was False), or
                                            if another waypoint atomic for the same actor was triggered
            py_trees.common.Status.FAILURE, if the actor is not found in ActorsWithController Blackboard dictionary.
            py_trees.common.Status.RUNNING, else.
        """
        try:
            check_actors = operator.attrgetter("ActorsWithController")
            actor_dict = check_actors(py_trees.blackboard.Blackboard())
        except AttributeError:
            pass

        if not actor_dict or not self._actor.id in actor_dict:
            return py_trees.common.Status.FAILURE

        if actor_dict[self._actor.id].get_last_lane_offset_command() != self._start_time:
            # Differentiate between lane offset and other lateral commands
            self._overwritten = True
            return py_trees.common.Status.SUCCESS

        if actor_dict[self._actor.id].get_last_waypoint_command() != self._start_time:
            return py_trees.common.Status.SUCCESS

        if self._relative_actor:
            # Calculate new offset
            relative_actor_loc = CarlaDataProvider.get_location(self._relative_actor)
            relative_center_wp = self._map.get_waypoint(relative_actor_loc)

            # Value
            relative_center_loc = relative_center_wp.transform.location
            relative_actor_offset = relative_actor_loc.distance(relative_center_loc)

            # Sign
            f_vec = relative_center_wp.transform.get_forward_vector()
            d_vec = relative_actor_loc - relative_center_loc
            cross = f_vec.x * d_vec.y - f_vec.y * d_vec.x

            if cross < 0:
                relative_actor_offset *= -1.0

            self._current_target_offset = relative_actor_offset + self._offset
            # Set the new offset
            actor_dict[self._actor.id].update_offset(self._current_target_offset)

        if not self._continuous:
            # Calculate new offset
            actor_loc = CarlaDataProvider.get_location(self._actor)
            center_wp = self._map.get_waypoint(actor_loc)

            # Value
            center_loc = center_wp.transform.location
            actor_offset = actor_loc.distance(center_loc)

            # Sign
            f_vec = center_wp.transform.get_forward_vector()
            d_vec = actor_loc - center_loc
            cross = f_vec.x * d_vec.y - f_vec.y * d_vec.x

            if cross < 0:
                actor_offset *= -1.0

            # Check if the offset has been reached
            if abs(actor_offset - self._current_target_offset) < self.OFFSET_THRESHOLD:
                return py_trees.common.Status.SUCCESS

        # TODO: As their is no way to check the distance to a specific lane, both checks will fail if the
        # actors are outside its 'route lane' or at an intersection

        new_status = py_trees.common.Status.RUNNING

        return new_status

        Check the actor's state along the waypoint route.

        returns:
            py_trees.common.Status.SUCCESS, if the lane offset was reached (and 'continuous' was False), or
                                            if another waypoint atomic for the same actor was triggered
            py_trees.common.Status.FAILURE, if the actor is not found in ActorsWithController Blackboard dictionary.
            py_trees.common.Status.RUNNING, else.
        
Check the actor's state along the waypoint route.
returns:
py_trees.common.Status.SUCCESS, if the lane offset was reached (and 'continuous' was False), or
if another waypoint atomic for the same actor was triggered
py_trees.common.Status.FAILURE, if the actor is not found in ActorsWithController Blackboard dictionary.
Check the actor ' s state along the waypoint route . returns : py_trees . common . Status . SUCCESS if the lane offset was reached ( and ' continuous ' was False ) or if another waypoint atomic for the same actor was triggered py_trees . common . Status . FAILURE if the actor is not found in ActorsWithController Blackboard dictionary .
def update(self):
        try:
            check_actors = operator.attrgetter("ActorsWithController")
            actor_dict = check_actors(py_trees.blackboard.Blackboard())
        except AttributeError:
            pass
        if not actor_dict or not self._actor.id in actor_dict:
            return py_trees.common.Status.FAILURE
        if actor_dict[self._actor.id].get_last_lane_offset_command() != self._start_time:
            self._overwritten = True
            return py_trees.common.Status.SUCCESS
        if actor_dict[self._actor.id].get_last_waypoint_command() != self._start_time:
            return py_trees.common.Status.SUCCESS
        if self._relative_actor:
            relative_actor_loc = CarlaDataProvider.get_location(self._relative_actor)
            relative_center_wp = self._map.get_waypoint(relative_actor_loc)
            relative_center_loc = relative_center_wp.transform.location
            relative_actor_offset = relative_actor_loc.distance(relative_center_loc)
            f_vec = relative_center_wp.transform.get_forward_vector()
            d_vec = relative_actor_loc - relative_center_loc
            cross = f_vec.x * d_vec.y - f_vec.y * d_vec.x
            if cross < 0:
                relative_actor_offset *= -1.0
            self._current_target_offset = relative_actor_offset + self._offset
            actor_dict[self._actor.id].update_offset(self._current_target_offset)
        if not self._continuous:
            actor_loc = CarlaDataProvider.get_location(self._actor)
            center_wp = self._map.get_waypoint(actor_loc)
            center_loc = center_wp.transform.location
            actor_offset = actor_loc.distance(center_loc)
            f_vec = center_wp.transform.get_forward_vector()
            d_vec = actor_loc - center_loc
            cross = f_vec.x * d_vec.y - f_vec.y * d_vec.x
            if cross < 0:
                actor_offset *= -1.0
            if abs(actor_offset - self._current_target_offset) < self.OFFSET_THRESHOLD:
                return py_trees.common.Status.SUCCESS
        new_status = py_trees.common.Status.RUNNING
        return new_status
def update ( self ) : try : check_actors = operator . attrgetter ( "ActorsWithController" ) actor_dict = check_actors ( py_trees . blackboard . Blackboard ( ) ) except AttributeError : pass if not actor_dict or not self . _actor . id in actor_dict : return py_trees . common . Status . FAILURE if actor_dict [ self . _actor . id ] . get_last_lane_offset_command ( ) != self . _start_time : self . _overwritten = True return py_trees . common . Status . SUCCESS if actor_dict [ self . _actor . id ] . get_last_waypoint_command ( ) != self . _start_time : return py_trees . common . Status . SUCCESS if self . _relative_actor : relative_actor_loc = CarlaDataProvider . get_location ( self . _relative_actor ) relative_center_wp = self . _map . get_waypoint ( relative_actor_loc ) relative_center_loc = relative_center_wp . transform . location relative_actor_offset = relative_actor_loc . distance ( relative_center_loc ) f_vec = relative_center_wp . transform . get_forward_vector ( ) d_vec = relative_actor_loc - relative_center_loc cross = f_vec . x * d_vec . y - f_vec . y * d_vec . x if cross < 0 : relative_actor_offset *= - 1.0 self . _current_target_offset = relative_actor_offset + self . _offset actor_dict [ self . _actor . id ] . update_offset ( self . _current_target_offset ) if not self . _continuous : actor_loc = CarlaDataProvider . get_location ( self . _actor ) center_wp = self . _map . get_waypoint ( actor_loc ) center_loc = center_wp . transform . location actor_offset = actor_loc . distance ( center_loc ) f_vec = center_wp . transform . get_forward_vector ( ) d_vec = actor_loc - center_loc cross = f_vec . x * d_vec . y - f_vec . y * d_vec . x if cross < 0 : actor_offset *= - 1.0 if abs ( actor_offset - self . _current_target_offset ) < self . OFFSET_THRESHOLD : return py_trees . common . Status . SUCCESS new_status = py_trees . common . Status . RUNNING return new_status
Check the actor's state along the waypoint route.
Check the actor ' s state along the waypoint route .
"""
        Check the actor's state along the waypoint route.

        returns:
            py_trees.common.Status.SUCCESS, if the lane offset was reached (and 'continuous' was False), or
                                            if another waypoint atomic for the same actor was triggered
            py_trees.common.Status.FAILURE, if the actor is not found in ActorsWithController Blackboard dictionary.
            py_trees.common.Status.RUNNING, else.
        """ # Differentiate between lane offset and other lateral commands # Calculate new offset # Value # Sign # Set the new offset # Calculate new offset # Value # Sign # Check if the offset has been reached # TODO: As their is no way to check the distance to a specific lane, both checks will fail if the # actors are outside its 'route lane' or at an intersection
self