Added wheel sweep by default in manual_control

This commit is contained in:
Daniel Santos-Olivan 2020-11-23 11:47:43 +01:00 committed by Axel1092
parent 560dc5a56d
commit 235cc8ffee
1 changed files with 7 additions and 0 deletions

View File

@ -234,6 +234,7 @@ class World(object):
spawn_point.rotation.pitch = 0.0 spawn_point.rotation.pitch = 0.0
self.destroy() self.destroy()
self.player = self.world.try_spawn_actor(blueprint, spawn_point) self.player = self.world.try_spawn_actor(blueprint, spawn_point)
self.modify_vehicle_physics(self.player)
while self.player is None: while self.player is None:
if not self.map.get_spawn_points(): if not self.map.get_spawn_points():
print('There are no spawn points available in your map/town.') print('There are no spawn points available in your map/town.')
@ -242,6 +243,7 @@ class World(object):
spawn_points = self.map.get_spawn_points() spawn_points = self.map.get_spawn_points()
spawn_point = random.choice(spawn_points) if spawn_points else carla.Transform() spawn_point = random.choice(spawn_points) if spawn_points else carla.Transform()
self.player = self.world.try_spawn_actor(blueprint, spawn_point) self.player = self.world.try_spawn_actor(blueprint, spawn_point)
self.modify_vehicle_physics(self.player)
# Set up the sensors. # Set up the sensors.
self.collision_sensor = CollisionSensor(self.player, self.hud) self.collision_sensor = CollisionSensor(self.player, self.hud)
self.lane_invasion_sensor = LaneInvasionSensor(self.player, self.hud) self.lane_invasion_sensor = LaneInvasionSensor(self.player, self.hud)
@ -282,6 +284,11 @@ class World(object):
self.radar_sensor.sensor.destroy() self.radar_sensor.sensor.destroy()
self.radar_sensor = None self.radar_sensor = None
def modify_vehicle_physics(self, vehicle):
physics_control = vehicle.get_physics_control()
physics_control.use_sweep_wheel_collision = True
vehicle.apply_physics_control(physics_control)
def tick(self, clock): def tick(self, clock):
self.hud.tick(self, clock) self.hud.tick(self, clock)