carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.57k stars 3.73k forks source link

Unstable Lane Change depending on distance with ScenarioRunner #5983

Open Fornerio opened 2 years ago

Fornerio commented 2 years ago

CARLA version: 9.13 Platform/OS: Ubuntu Python 3.8.13

Hello everyone, I am collecting different scenarios for a synthetic scenarios classification system. I am currently working on lane change on a curved road, and I am using LaneChange class from atomic_behaviors.py.

The vehicle performs a correct maneuver only using _distance_lanechange values from a certain range, otherwise the vehicle skids since it steers too much.

Is there a way to smooth the trajectory (e.g. by adjusting the steering angle) in order to obtain a correct lane change for every possible value of _distance_lanechange parameter? Here is the creation of the behaviour for the scenario:

def _create_behavior(self):

        behaviour = py_trees.composites.Sequence("CarOn_{}_Lane" .format(self._direction))
        leading = self.other_actors[len(self.other_actors)-1]
        INIT, just_drive, just_drive2 = SpawnEgoLeadingVehicles( self.ego_vehicles[0], leading, self._velocity_ego, self._velocity, self.starting_point_ego, self._transform_visible.transform)

        just_drive, just_drive2 = TrueTrafficCutOutFront(self.other_actors, self._velocity_ego, just_drive, just_drive2, self._velocity, self.ego_vehicles[0], self.th)

        behaviour.add_child(INIT)
        behaviour.add_child(just_drive)
        behaviour.add_child(just_drive2)

        lc = py_trees.composites.Parallel(
            "LC", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)

        car_driving_ego_2 = WaypointFollower(self.ego_vehicles[0], self._velocity_ego)

        lc.add_child(car_driving_ego_2)

        if(self._direction=='right'):
            lane_change = LaneChange(actor=leading, speed=self._velocity, direction = 'left', distance_same_lane=25, distance_other_lane=50,
                 distance_lane_change=120, lane_changes=1, name='LaneChange')
        else:
            print('Changing lane R')
        lane_change = LaneChange(actor=leading, speed=self._velocity, direction = 'right', distance_same_lane=25, distance_other_lane=50,
                 distance_lane_change=120, lane_changes=1, name='LaneChange')
        lc.add_child(lane_change)

        behaviour.add_child(lc)

        root = py_trees.composites.Sequence("Behavior", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        root.add_child(behaviour)

        return root

Speed needs to be about 30/36 m/s since the classification system involves recognizing highway scenarios. Thanks to everyone in advance,

Luca Forneris University of Genoa

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.