carla icon indicating copy to clipboard operation
carla copied to clipboard

Delayed acceleration even with full throttle

Open SailorBrandon opened this issue 1 year ago • 10 comments

CARLA version: 0.9.10.1 Platform/OS: ubuntu 20.04

Description:

I am currently utilizing the Tesla Model 3 blueprint in Carla and have encountered an issue related to delayed acceleration. Despite setting the throttle to its maximum value of 1 (full), there is a noticeable delay of approximately 2 seconds before the car starts accelerating.

Steps to Reproduce:

  1. Launch Carla with the Tesla Model 3 blueprint.
  2. Set the throttle input to its maximum value of 1 (full).
  3. Observe the car's behavior and note the delay before acceleration kicks in.

Expected Behavior:

The Tesla Model 3 blueprint should initiate acceleration promptly upon receiving a throttle input of 1 (full).

Actual Behavior:

The car experiences a delay of approximately 2 seconds before it starts accelerating, despite the throttle being set to its maximum value.

SailorBrandon avatar May 17 '23 16:05 SailorBrandon

From my experience, I noticed that the moment a vehicle spawns (I have mostly used Tesla Model 3) it's like the vehicle is stuck to the ground, and it takes some time for a vehicle to get “unstuck”. Once it does, then it's much more responsive to the acceleration. I guess it's just a nature of Carla.

ivevasiljevic avatar May 23 '23 10:05 ivevasiljevic

@ivevasiljevic @SailorBrandon Hey, I'm experiencing this problem too(I'm using carla 0.9.13), I found a solution here: https://github.com/carla-simulator/carla/issues/1640 but it did not work me, still getting half second of delay no matter what, and this delay only exist when applying throttle for the first time. image let me know if you guys find a way to cancel that delay

CodeTornato avatar Jun 09 '23 06:06 CodeTornato

Hi Guys, I actually got the same issue with most of the vehicles in the blueprint library.

First workaround I used was choosing the first gear with apply_control(). That decreased the response time, but still there was delay.

It was quiet obvious that the vehicle dynamics are not simulated correctly. So I have changed Physics substepping settings as increase # max_substeps and decrease max_substep_delta_time.

The code below shows my current settings for physics substepping and I can see that the vehicle dynamics are simulated more precisely, and the delay was gone.

settings = world.get_settings()
settings.substepping = True
settings.max_substep_delta_time = 0.001
settings.max_substeps = 100
world.apply_settings(settings)

Hope this helps :)

kaynaremre avatar Jun 12 '23 22:06 kaynaremre

@kaynaremre hey, thanks for this solution, I was using 2 client, one python for set up a static environment, and a C++ client to actually control the vehicle, and I tried using this solution add this physics setting to the python program, but unfortunately did not work for me, here is my some code: client = carla.Client('localhost', 2000) client.set_timeout(2.0) world = client.get_world() settings = world.get_settings() settings.substepping = True settings.max_substep_delta_time = 0.001 settings.max_substeps = 100 world.apply_settings(settings) blueprint_library = world.get_blueprint_library() host_vehicle_bp = random.choice(blueprint_library.filter('vehicle.tesla.model3')) # next is just spawn a vehicle in a specific place, and waiting for a control is there any restriction to add this code to specific place, like before spawning vehicle or after, and can you show me one of your example, I really want to fix this :sob::sob: :sob:

CodeTornato avatar Jun 14 '23 07:06 CodeTornato

@CodeTornato Are you running on synchronous mode and fixed time step ?

kaynaremre avatar Jun 14 '23 09:06 kaynaremre

@kaynaremre well i did not set it to synchronous mode explicitly, I'm just knowing it right know after you told me it can be run on different mode

CodeTornato avatar Jun 14 '23 11:06 CodeTornato

There is no specific place to write the lines for physics subsetting. You can add these lines after you connect with the carla server. I can say that your application is correct. You don't need to enable synchronous mode I guess but it will be better to run with a fixed time step. Add this line to your world settings and let's see if it works for you.

settings.fixed_delta_seconds = 0.01

client = carla.Client('localhost', 2000)
client.set_timeout(2.0)
world = client.get_world()
settings = world.get_settings()
settings.substepping = True
settings.max_substep_delta_time = 0.001
settings.max_substeps = 100
settings.fixed_delta_seconds = 0.01
world.apply_settings(settings)
blueprint_library = world.get_blueprint_library()
host_vehicle_bp = random.choice(blueprint_library.filter('vehicle.tesla.model3'))

kaynaremre avatar Jun 14 '23 13:06 kaynaremre

@CodeTornato Hi, can you please explain how did you get the gradual increase in the speed? I'm also using Tesla3. But i cant control the acceleration, it accelerates with the max throttle, and decelerates with the max too. This can help me so much, if you share.

VidaAPI avatar Aug 03 '23 18:08 VidaAPI

@VidaAPI hey,in my case,I have a planning and control algorithms, so control decide how much throttle it should apply base on the desired speed. and can you provide me with your source code so I could take a look on why it's being decelerating. And Also By The Way,I have updated my carla to the newest version(0.9.14), because in newest version there is a new api for giving a ackermman control,so you could control speed and acceleration directly,cuz using throttle is hard to reach a given speed. image

CodeTornato avatar Aug 04 '23 02:08 CodeTornato