srunner/scenariomanager/scenarioatomics/atomic_behaviors.py
def update(self):
        """
        Dynamic control update for actor velocity to ensure that both actors reach their target
        positions at the same time.
        """

        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_longitudinal_command() != self._start_time:
            return py_trees.common.Status.SUCCESS

        new_status = py_trees.common.Status.RUNNING

        # Get the distance of the actor to its endpoint
        distance = calculate_distance(
            CarlaDataProvider.get_location(self._actor), self._actor_target.location)

        if distance < self.DISTANCE_THRESHOLD:
            return py_trees.common.Status.SUCCESS  # Behaviour ends when the actor reaches its endpoint

        # Get the time to arrival of the reference to its endpoint
        distance_reference = calculate_distance(
            CarlaDataProvider.get_location(self._master_actor), self._master_target.location)

        velocity_reference = CarlaDataProvider.get_velocity(self._master_actor)
        if velocity_reference > 0:
            time_reference = distance_reference / velocity_reference
        else:
            time_reference = float('inf')

        # Get the required velocity of the actor
        desired_velocity = distance / time_reference
        actor_dict[self._actor.id].update_target_speed(desired_velocity)

        self.logger.debug("%s.update()[%s->%s]" % (self.__class__.__name__, self.status, new_status))
        return new_status

        Dynamic control update for actor velocity to ensure that both actors reach their target
        positions at the same time.
        
Dynamic control update for actor velocity to ensure that both actors reach their target
positions at the same time.
Dynamic control update for actor velocity to ensure that both actors reach their target positions at the same time .
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_longitudinal_command() != self._start_time:
            return py_trees.common.Status.SUCCESS
        new_status = py_trees.common.Status.RUNNING
        distance = calculate_distance(
            CarlaDataProvider.get_location(self._actor), self._actor_target.location)
        if distance < self.DISTANCE_THRESHOLD:
            return py_trees.common.Status.SUCCESS  
        distance_reference = calculate_distance(
            CarlaDataProvider.get_location(self._master_actor), self._master_target.location)
        velocity_reference = CarlaDataProvider.get_velocity(self._master_actor)
        if velocity_reference > 0:
            time_reference = distance_reference / velocity_reference
        else:
            time_reference = float('inf')
        desired_velocity = distance / time_reference
        actor_dict[self._actor.id].update_target_speed(desired_velocity)
        self.logger.debug("%s.update()[%s->%s]" % (self.__class__.__name__, self.status, new_status))
        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_longitudinal_command ( ) != self . _start_time : return py_trees . common . Status . SUCCESS new_status = py_trees . common . Status . RUNNING distance = calculate_distance ( CarlaDataProvider . get_location ( self . _actor ) , self . _actor_target . location ) if distance < self . DISTANCE_THRESHOLD : return py_trees . common . Status . SUCCESS distance_reference = calculate_distance ( CarlaDataProvider . get_location ( self . _master_actor ) , self . _master_target . location ) velocity_reference = CarlaDataProvider . get_velocity ( self . _master_actor ) if velocity_reference > 0 : time_reference = distance_reference / velocity_reference else : time_reference = float ( 'inf' ) desired_velocity = distance / time_reference actor_dict [ self . _actor . id ] . update_target_speed ( desired_velocity ) self . logger . debug ( "%s.update()[%s->%s]" % ( self . __class__ . __name__ , self . status , new_status ) ) return new_status
Dynamic control update for actor velocity to ensure that both actors reach their target
positions at the same time.
Dynamic control update for actor velocity to ensure that both actors reach their target positions at the same time .
"""
        Dynamic control update for actor velocity to ensure that both actors reach their target
        positions at the same time.
        """ # Get the distance of the actor to its endpoint # Behaviour ends when the actor reaches its endpoint # Get the time to arrival of the reference to its endpoint # Get the required velocity of the actor
self