Esempio n. 1
0
    def _create_behavior(self):
        """
        Passing a pedestrian behavior.
        The ego vehicle drives a distance of 50 meters, or stops for the
        pedestrian, depending on the scenario variant.
        """

        ego_drive = py_trees.composites.Parallel(
            "Ego Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))
        if (self._variant == 'Rss_Ext_PASSPED_b'):
            sub_drive = py_trees.composites.Sequence("Ego Stopping")
            sub_drive.add_child(DriveDistance(self.ego_vehicles[0], 20))
            sub_drive.add_child(
                StopVehicle(self.ego_vehicles[0],
                            self._rss_params['alpha_lon_brake_min']))
            ego_drive.add_child(sub_drive)
        else:
            ego_drive.add_child(DriveDistance(self.ego_vehicles[0], 50))

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(TimeOut(1))
        sequence.add_child(ego_drive)
        sequence.add_child(ActorDestroy(self._pedestrian))

        return sequence
Esempio n. 2
0
    def _create_behavior(self):
        """
        Side Incursion behavior
        The lead vehicle remains still for 10 seconds and is partially obstructing the ego vehicle's lane.
        The ego vehicle approaches the lead vehicle from behind.
        The scenario ends after ten seconds.
        """

        lead_drive = py_trees.composites.Sequence("Lead Sequence")
        lead_drive.add_child(Idle(duration=10))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(RssExtBehavior(self._rss_params, self.ego_vehicles[0], self._ego_target_speed, self._target, variant=self._variant))

        parallel_drive = py_trees.composites.Parallel("All Cars Driving", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(lead_drive)
        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(ActorTransformSetter(self.other_actors[0], self._lead_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
    def _create_behavior(self):
        """
        Parking lot behavior
        The ego vehicle drives out of a parking lot towards a destination
        outside of the parking lot.  The scenario ends after the ego vehicle
        has driven 50 meters.
        """

        ego_drive = py_trees.composites.Parallel(
            "Ego Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))
        ego_drive.add_child(DriveDistance(self.ego_vehicles[0], 50))

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(TimeOut(1))
        sequence.add_child(ego_drive)

        return sequence
    def _create_behavior(self):
        """
        The ego vehicle is initially at rest behind a tall lead vehicle at a
        traffic light.  The lead vehicle waits for the light to change and
        proceeds.  The ego vehicle either proceeds immediately (variant a)
        or waits until the light is visible (variant b).
        """

        other_drive = py_trees.composites.Sequence("Other Sequence")
        other_drive.add_child(KeepVelocity(self.other_actors[0], target_velocity=self._other_actor_target_speed, distance=80))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        if (self._variant == "Rss_Ext_TEMPOCCL_b"):
            ego_drive.add_child(TimeOut(3))
        ego_drive.add_child(RssExtBehavior(self._rss_params, self.ego_vehicles[0], self._ego_target_speed, self._target, variant=self._variant))


        parallel_drive = py_trees.composites.Parallel("All Cars Driving", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(other_drive)

        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(ActorTransformSetter(self.other_actors[0], self._other_0_transform))
        sequence.add_child(TimeOut(13))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
Esempio n. 5
0
    def _create_behavior(self):
        """
        Occlusion behavior.
        A vehicle is traveling straight through a T intersection.
        A tree partially occludes view of the T intersection.
        The ego vehicle approaches the intersection from a right angle and must
        plan how to yield to the traveling vehicle.
        """

        other_0_drive = py_trees.composites.Sequence("Other Sequence")
        other_0_drive.add_child(
            KeepVelocity(self.other_actors[0],
                         target_velocity=self._other_actor_target_speed,
                         distance=90))
        #lead_drive.add_child(DriveDistance(self.other_actors[0], 30))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))

        parallel_drive = py_trees.composites.Parallel(
            "All Cars Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(other_0_drive)

        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(
            ActorTransformSetter(self.other_actors[0],
                                 self._other_0_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))

        return sequence
Esempio n. 6
0
    def _create_behavior(self):
        """
        Merge behavior.
        A fleet of four vehicles is traveling along a lane with a gap between
        vehicles 2 and 3.  The vehicles travel for 110 meters.
        The ego vehicle attempts to merge into the gap.
        """

        other_0_drive = py_trees.composites.Sequence("Other 0 Sequence")
        other_0_drive.add_child(KeepVelocity(self.other_actors[0], target_velocity=self._other_actor_target_speed, distance=110))

        other_1_drive = py_trees.composites.Sequence("Other 1 Sequence")
        other_1_drive.add_child(KeepVelocity(self.other_actors[1], target_velocity=self._other_actor_target_speed, distance=110))

        other_2_drive = py_trees.composites.Sequence("Other 2 Sequence")
        other_2_drive.add_child(KeepVelocity(self.other_actors[2], target_velocity=self._other_actor_target_speed, distance=110))

        other_3_drive = py_trees.composites.Sequence("Other 3 Sequence")
        other_3_drive.add_child(KeepVelocity(self.other_actors[3], target_velocity=self._other_actor_target_speed, distance=110))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(RssExtBehavior(self._rss_params, self.ego_vehicles[0], self._ego_target_speed, self._target, variant=self._variant))

        parallel_drive = py_trees.composites.Parallel("All Cars Driving", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(other_0_drive)
        parallel_drive.add_child(other_1_drive)
        parallel_drive.add_child(other_2_drive)
        parallel_drive.add_child(other_3_drive)

        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(ActorTransformSetter(self.other_actors[0], self._other_0_transform))
        sequence.add_child(ActorTransformSetter(self.other_actors[1], self._other_1_transform))
        sequence.add_child(ActorTransformSetter(self.other_actors[2], self._other_2_transform))
        sequence.add_child(ActorTransformSetter(self.other_actors[3], self._other_3_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
    def _create_behavior(self):
        """
        Shorter following distance multiple geometry behavior.
        The lead vehicle drives for 60 meters, passing through a roundabout.
        The ego vehicle follows the lead vehicle for a portion of the roundabout.
        """

        other_drive = py_trees.composites.Parallel(
            "Other Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        other_drive.add_child(
            WaypointFollower(self.other_actors[0],
                             self._other_actor_target_speed))
        other_drive.add_child(DriveDistance(self.other_actors[0], 60))

        ego_drive = py_trees.composites.Sequence("Ego Driving")
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))

        parallel_drive = py_trees.composites.Parallel(
            "All Cars Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(other_drive)
        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(
            ActorTransformSetter(self.other_actors[0], self._other_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
    def _create_behavior(self):
        """
        Shorter Following Distance behavior
        The lead vehicle drives for 100 meters.
        The ego vehicle follows at the RSS Classic or RSS Extended safe
        following distance.
        """

        lead_drive = py_trees.composites.Sequence("Lead Sequence")
        lead_drive.add_child(
            KeepVelocity(self.other_actors[0],
                         target_velocity=self._other_actor_target_speed,
                         distance=100))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))

        parallel_drive = py_trees.composites.Parallel(
            "All Cars Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(lead_drive)
        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(
            ActorTransformSetter(self.other_actors[0], self._lead_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
Esempio n. 9
0
    def _create_behavior(self):
        """
        Forward Incursion behavior
        All vehicles are initially at rest.
        - Lead vehicle accelerates to target speed, driving for 60 meters total.
        - Cut-in vehicle changes lanes at 10 meters, driving for 60 meters total.
        - Ego is intially following lead vehicle and brakes to RSS safe following distance after cut-in.
        """

        lead_drive = py_trees.composites.Sequence("Lead Sequence")
        lead_drive.add_child(KeepVelocity(self.other_actors[0], target_velocity=self._other_actor_target_speed, distance=60))

        cut_in_drive = py_trees.composites.Sequence("Cut-In Sequence")
        cut_in_drive.add_child(LaneChange(self.other_actors[1], speed=self._cut_in_target_speed, direction="right", distance_same_lane=10, distance_other_lane=50))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(RssExtBehavior(self._rss_params, self.ego_vehicles[0], self._ego_target_speed, self._target, variant=self._variant))

        two_other_cars_drive = py_trees.composites.Parallel("Other Cars Driving", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        two_other_cars_drive.add_child(lead_drive)
        two_other_cars_drive.add_child(cut_in_drive)

        parallel_drive = py_trees.composites.Parallel("All Cars Driving", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(two_other_cars_drive)
        parallel_drive.add_child(ego_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(ActorTransformSetter(self.other_actors[0], self._lead_transform))
        sequence.add_child(ActorTransformSetter(self.other_actors[1], self._lane_changer_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence
    def _create_behavior(self):
        """
        Platooning behavior.
        The lead vehicle travels for 100 meters.
        A fleet of ego vehicles follows single-file behind the leader.
        """

        lead_drive = py_trees.composites.Sequence("Lead Sequence")
        lead_drive.add_child(
            KeepVelocity(self.other_actors[0],
                         target_velocity=self._other_actor_target_speed,
                         distance=100))

        ego_drive = py_trees.composites.Sequence("Ego Sequence")
        ego_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.ego_vehicles[0],
                           self._ego_target_speed,
                           self._target,
                           variant=self._variant))

        platoon_1_drive = py_trees.composites.Sequence("Platoon 1 Sequence")
        platoon_1_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.other_actors[1],
                           self._platoon_speed,
                           self._target,
                           variant=self._variant))

        platoon_2_drive = py_trees.composites.Sequence("Platoon 2 Sequence")
        platoon_2_drive.add_child(
            RssExtBehavior(self._rss_params,
                           self.other_actors[2],
                           self._platoon_speed,
                           self._target,
                           variant=self._variant))

        parallel_drive = py_trees.composites.Parallel(
            "All Cars Driving",
            policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        parallel_drive.add_child(lead_drive)
        parallel_drive.add_child(ego_drive)
        parallel_drive.add_child(platoon_1_drive)
        parallel_drive.add_child(platoon_2_drive)

        # Build behavior tree
        sequence = py_trees.composites.Sequence("All Behavior Sequence")

        sequence.add_child(
            ActorTransformSetter(self.other_actors[0], self._lead_transform))
        sequence.add_child(
            ActorTransformSetter(self.other_actors[1],
                                 self._platoon_1_transform))
        sequence.add_child(
            ActorTransformSetter(self.other_actors[2],
                                 self._platoon_2_transform))
        sequence.add_child(TimeOut(1))
        sequence.add_child(parallel_drive)

        for actor in self.other_actors:
            sequence.add_child(ActorDestroy(actor))
        return sequence