manual_control: fix pedestrians
This commit is contained in:
parent
49447d6ce9
commit
6a879c89db
|
@ -284,10 +284,14 @@ 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):
|
def modify_vehicle_physics(self, actor):
|
||||||
physics_control = vehicle.get_physics_control()
|
#If actor is not a vehicle, we cannot use the physics control
|
||||||
physics_control.use_sweep_wheel_collision = True
|
try:
|
||||||
vehicle.apply_physics_control(physics_control)
|
physics_control = actor.get_physics_control()
|
||||||
|
physics_control.use_sweep_wheel_collision = True
|
||||||
|
actor.apply_physics_control(physics_control)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
def tick(self, clock):
|
def tick(self, clock):
|
||||||
self.hud.tick(self, clock)
|
self.hud.tick(self, clock)
|
||||||
|
@ -955,12 +959,22 @@ class CameraManager(object):
|
||||||
bound_y = 0.5 + self._parent.bounding_box.extent.y
|
bound_y = 0.5 + self._parent.bounding_box.extent.y
|
||||||
bound_z = 0.5 + self._parent.bounding_box.extent.z
|
bound_z = 0.5 + self._parent.bounding_box.extent.z
|
||||||
Attachment = carla.AttachmentType
|
Attachment = carla.AttachmentType
|
||||||
self._camera_transforms = [
|
|
||||||
(carla.Transform(carla.Location(x=-2.0*bound_x, y=+0.0*bound_y, z=2.0*bound_z), carla.Rotation(pitch=8.0)), Attachment.SpringArm),
|
if not self._parent.type_id.startswith("walker.pedestrian"):
|
||||||
(carla.Transform(carla.Location(x=+0.8*bound_x, y=+0.0*bound_y, z=1.3*bound_z)), Attachment.Rigid),
|
self._camera_transforms = [
|
||||||
(carla.Transform(carla.Location(x=+1.9*bound_x, y=+1.0*bound_y, z=1.2*bound_z)), Attachment.SpringArm),
|
(carla.Transform(carla.Location(x=-2.0*bound_x, y=+0.0*bound_y, z=2.0*bound_z), carla.Rotation(pitch=8.0)), Attachment.SpringArm),
|
||||||
(carla.Transform(carla.Location(x=-2.8*bound_x, y=+0.0*bound_y, z=4.6*bound_z), carla.Rotation(pitch=6.0)), Attachment.SpringArm),
|
(carla.Transform(carla.Location(x=+0.8*bound_x, y=+0.0*bound_y, z=1.3*bound_z)), Attachment.Rigid),
|
||||||
(carla.Transform(carla.Location(x=-1.0, y=-1.0*bound_y, z=0.4*bound_z)), Attachment.Rigid)]
|
(carla.Transform(carla.Location(x=+1.9*bound_x, y=+1.0*bound_y, z=1.2*bound_z)), Attachment.SpringArm),
|
||||||
|
(carla.Transform(carla.Location(x=-2.8*bound_x, y=+0.0*bound_y, z=4.6*bound_z), carla.Rotation(pitch=6.0)), Attachment.SpringArm),
|
||||||
|
(carla.Transform(carla.Location(x=-1.0, y=-1.0*bound_y, z=0.4*bound_z)), Attachment.Rigid)]
|
||||||
|
else:
|
||||||
|
self._camera_transforms = [
|
||||||
|
(carla.Transform(carla.Location(x=-5.5, z=2.5), carla.Rotation(pitch=8.0)), Attachment.SpringArm),
|
||||||
|
(carla.Transform(carla.Location(x=1.6, z=1.7)), Attachment.Rigid),
|
||||||
|
(carla.Transform(carla.Location(x=5.5, y=1.5, z=1.5)), Attachment.SpringArm),
|
||||||
|
(carla.Transform(carla.Location(x=-8.0, z=6.0), carla.Rotation(pitch=6.0)), Attachment.SpringArm),
|
||||||
|
(carla.Transform(carla.Location(x=-1, y=-bound_y, z=0.5)), Attachment.Rigid)]
|
||||||
|
|
||||||
self.transform_index = 1
|
self.transform_index = 1
|
||||||
self.sensors = [
|
self.sensors = [
|
||||||
['sensor.camera.rgb', cc.Raw, 'Camera RGB', {}],
|
['sensor.camera.rgb', cc.Raw, 'Camera RGB', {}],
|
||||||
|
|
Loading…
Reference in New Issue