作者:mobiledu2502916313 | 来源:互联网 | 2023-09-08 15:37
Iwanttoaddnoisetothesteeringoftheautopilotoneverytickofthesimulation.
I want to add noise to the steering of the autopilot on every tick of the simulation.
What I tried: Add a callback via the
method as follows:
1 2 3 4 5 6 7
| Python
def my_callback(vehicle, world_snapshot):
control = vehicle.get_control()
control.steer += random.uniform(-0.1, 0.1)
vehicle.apply_control(control)
world.on_tick(functools.partial(add_steer_noise, vehicle)) |
Unfortunately, this had no effect on the steering control. Is there any other way to achieve this with the Python API?
I am using the precompiled version 0.9.9.4.
This question was already asked in https://github.com/carla-simulator/carla/issues/1522 but the provided answers did not work for me either, and I cannot reopen issues.
该提问来源于开源项目:carla-simulator/carla
Yeah, that's definitely to be expected. You are assigning this random noise steering behavior to every vehicle that is controlled by the Traffic Manager or autopilot. If you want to assign it only to your vehicle (or any subset of all the vehicles controlled by the TM) you have to implement a parameter, such as we do with ignore_lights_percentage, and then in your script only assign this particular behavior to your vehicle.