srunner/scenariomanager/scenarioatomics/atomic_behaviors.py
def update(self):
        """
        Check the actor's current state and if the lane change was completed

        returns:
            py_trees.common.Status.SUCCESS, if lane change was successful, or
                                            if another ChangeActorLateralMotion 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.FAILURE, 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 not self._plan:
            print("{} couldn't perform the expected lane change".format(self._actor))
            return py_trees.common.Status.FAILURE

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

        new_status = py_trees.common.Status.RUNNING

        current_position_actor = CarlaDataProvider.get_map().get_waypoint(self._actor.get_location())
        current_lane_id = current_position_actor.lane_id

        if current_lane_id == self._target_lane_id:
            # driving on new lane
            distance = current_position_actor.transform.location.distance(self._pos_before_lane_change)

            if distance > self._distance_other_lane:
                # long enough distance on new lane --> SUCCESS
                new_status = py_trees.common.Status.SUCCESS

                new_waypoints = []
                map_wp = current_position_actor
                while len(new_waypoints) < 200:
                    map_wps = map_wp.next(2.0)
                    if map_wps:
                        new_waypoints.append(map_wps[0].transform)
                        map_wp = map_wps[0]
                    else:
                        break

                actor_dict[self._actor.id].update_waypoints(new_waypoints, start_time=self._start_time)

        else:
            self._pos_before_lane_change = current_position_actor.transform.location

        return new_status

        Check the actor's current state and if the lane change was completed

        returns:
            py_trees.common.Status.SUCCESS, if lane change was successful, or
                                            if another ChangeActorLateralMotion 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.FAILURE, else.
        
Check the actor's current state and if the lane change was completed
returns:
py_trees.common.Status.SUCCESS, if lane change was successful, or
if another ChangeActorLateralMotion 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 current state and if the lane change was completed returns : py_trees . common . Status . SUCCESS if lane change was successful or if another ChangeActorLateralMotion 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 not self._plan:
            print("{} couldn't perform the expected lane change".format(self._actor))
            return py_trees.common.Status.FAILURE
        if actor_dict[self._actor.id].get_last_waypoint_command() != self._start_time:
            return py_trees.common.Status.SUCCESS
        new_status = py_trees.common.Status.RUNNING
        current_position_actor = CarlaDataProvider.get_map().get_waypoint(self._actor.get_location())
        current_lane_id = current_position_actor.lane_id
        if current_lane_id == self._target_lane_id:
            distance = current_position_actor.transform.location.distance(self._pos_before_lane_change)
            if distance > self._distance_other_lane:
                new_status = py_trees.common.Status.SUCCESS
                new_waypoints = []
                map_wp = current_position_actor
                while len(new_waypoints) < 200:
                    map_wps = map_wp.next(2.0)
                    if map_wps:
                        new_waypoints.append(map_wps[0].transform)
                        map_wp = map_wps[0]
                    else:
                        break
                actor_dict[self._actor.id].update_waypoints(new_waypoints, start_time=self._start_time)
        else:
            self._pos_before_lane_change = current_position_actor.transform.location
        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 not self . _plan : print ( "{} couldn't perform the expected lane change" . format ( self . _actor ) ) return py_trees . common . Status . FAILURE if actor_dict [ self . _actor . id ] . get_last_waypoint_command ( ) != self . _start_time : return py_trees . common . Status . SUCCESS new_status = py_trees . common . Status . RUNNING current_position_actor = CarlaDataProvider . get_map ( ) . get_waypoint ( self . _actor . get_location ( ) ) current_lane_id = current_position_actor . lane_id if current_lane_id == self . _target_lane_id : distance = current_position_actor . transform . location . distance ( self . _pos_before_lane_change ) if distance > self . _distance_other_lane : new_status = py_trees . common . Status . SUCCESS new_waypoints = [ ] map_wp = current_position_actor while len ( new_waypoints ) < 200 : map_wps = map_wp . next ( 2.0 ) if map_wps : new_waypoints . append ( map_wps [ 0 ] . transform ) map_wp = map_wps [ 0 ] else : break actor_dict [ self . _actor . id ] . update_waypoints ( new_waypoints , start_time = self . _start_time ) else : self . _pos_before_lane_change = current_position_actor . transform . location return new_status
Check the actor's current state and if the lane change was completed
returns:
py_trees.common.Status.SUCCESS, if lane change was successful, or
if another ChangeActorLateralMotion atomic for the same actor was triggered.
Check the actor ' s current state and if the lane change was completed returns : py_trees . common . Status . SUCCESS if lane change was successful or if another ChangeActorLateralMotion atomic for the same actor was triggered .
"""
        Check the actor's current state and if the lane change was completed

        returns:
            py_trees.common.Status.SUCCESS, if lane change was successful, or
                                            if another ChangeActorLateralMotion 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.FAILURE, else.
        """ # driving on new lane # long enough distance on new lane --> SUCCESS
self