options.simple_intersection package¶
Submodules¶
options.simple_intersection.maneuver_base module¶
-
class
options.simple_intersection.maneuver_base.
ManeuverBase
(env)¶ Bases:
env.env_base.EpisodicEnvBase
The abstract class from which each maneuver is defined and inherited.
In all of the maneuvers, we assume that the ego-vehicle is supposed to drive on the ‘h’orizontal route.
-
action_space
¶
-
extra_initiation_condition
¶
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-
generate_scenario
(enable_LTL_preconditions=True, timeout=inf, **kwargs)¶ generates the scenario for low-level policy learning and validation. This method will be used in generate_learning_scenario and generate_validation_scenario in the subclasses.
- Param:
- enable_LTL_preconditions: whether to enable LTL preconditions in the maneuver or not timeout: the timeout for the scenario (which is infinity by default) **kwargs: the arguments of generate_scenario of the environment.
-
generate_validation_scenario
()¶
-
get_reduced_feature_length
()¶ get the length of the feature tuple after applying _features_dim_reduction.
Returns:
-
get_reduced_features_tuple
()¶
-
goal_achieved
¶ Check whether the ego vehicle achieves the goal of the maneuver or not.
By default, there is no goal, so the ego vehicle never achieves it (i.e., goal_achieved is always False).
-
high_level_extra_reward
= 0¶
-
initiation_condition
¶ this method specifies the initiation condition (or in a technical term, initiation set) of the maneuver.
Returns True if the condition is satisfied, and False otherwise.
-
learning_mode
= 'training'¶
-
low_level_policy
(reduced_features_tuple)¶ the low level policy as a map from a feature vector to an action (a, dot_psi).
By default, it’ll call low_level_manual_policy below if it’s implemented in the subclass.
-
observation_space
¶
-
render
(mode='human')¶ Gym compliant step function which will be implemented in the subclass.
-
reset
()¶ Gym compliant reset function.
Reset the environment as specified by the generate_learning_scenario() in this class and the maneuver, and then return the initial features tuple.
Returns: features tuple after _features_dim_reduction Reinitialize the maneuver and the environment with whatever parameters it was initially called with. This will be implemented in each subclass maneuver. (to reset the maneuver part within the implementation of this method in the subclass, use reset_maneuver below after resetting the environment). Use this function only for the low-level policy learning of each maneuver.
-
reset_maneuver
()¶
-
set_low_level_trained_policy
(trained_policy)¶ Sets the trained policy as a function which takes in feature vector and returns an action (a, dot_psi).
By default, trained_policy is None
-
step
(u_ego)¶ The main function, increases timeout count and calculates the reward based on model- and collision-checking.
- Returns: a tuple (reduced_features_tuple, R, terminal, info), where
- reduced_features_tuple: the features tuple after _features_dim_reduction; R: the reward for the transition; terminal: True if the next state is the terminal state, False if not; info: log info.
-
termination_condition
¶ In the subclass, specify the condition for termination of the episode (or the maneuver).
-
timeout
= 1¶
-
timeout_happened
¶
-
trained_policy
= None¶
-
options.simple_intersection.maneuvers module¶
-
class
options.simple_intersection.maneuvers.
ChangeLane
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
generate_learning_scenario
()¶
-
generate_validation_scenario
()¶
-
goal_achieved
¶ Check whether the ego vehicle achieves the goal of the maneuver or not.
By default, there is no goal, so the ego vehicle never achieves it (i.e., goal_achieved is always False).
-
high_level_extra_reward
= -50¶
-
min_y_distance
= 1.0¶
-
-
class
options.simple_intersection.maneuvers.
Follow
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-
-
class
options.simple_intersection.maneuvers.
Halt
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-
generate_validation_scenario
()¶
-
-
class
options.simple_intersection.maneuvers.
KeepLane
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-
generate_validation_scenario
()¶
-
initiation_condition
¶ a virtual function (property) from ManeuverBase. As KeepLane is a default maneuver, it has to be activated to be chosen at any time, state, and condition (refer to initiation_condition of ManeuverBase for the usual case). :returns True.
-
-
class
options.simple_intersection.maneuvers.
Left
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_initiation_condition
¶
-
goal_achieved
¶ Check whether the ego vehicle achieves the goal of the maneuver or not.
By default, there is no goal, so the ego vehicle never achieves it (i.e., goal_achieved is always False).
-
min_y_distance
= 1.0¶
-
-
class
options.simple_intersection.maneuvers.
ManualWait
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
class
options.simple_intersection.maneuvers.
Right
(env)¶ Bases:
options.simple_intersection.maneuvers.Left
-
extra_initiation_condition
¶
-
-
class
options.simple_intersection.maneuvers.
Stop
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-
-
class
options.simple_intersection.maneuvers.
Wait
(env)¶ Bases:
options.simple_intersection.maneuver_base.ManeuverBase
-
extra_termination_condition
¶
-
generate_learning_scenario
()¶
-