How can I modify autopilot parameters?

Hi, how can I get autopilot parameters for a vehicle, modify them and send them back to the vehicle?

My goal is to have a car which would be run by autopilot, but where autopilot would control the steering and my code would control throttle and brake. Is it possible to divide control in this way?

I am trying to modify manual_control.py in order to test this. This is what the documentation says about getting the autopilot parameters and modifying them:

measurements, sensor_data = carla_client.read_data()
control = measurements.player_measurements.autopilot_control
//modify here control if wanted.
carla_client.send_control(control)

However as far as I can see carla.Client has no method read_data, so I assumed this is outdated info.

I have tried doing this:

player.get_control()
// modify the VehicleControl
player.set_control().

I can see that this has some impact but the behaviour of the vehicle is erratic. Are these the right functions to do this?

Any help is appreciated.

Hey. First of all, what version of CARLA are you using? The autopilot was changed from to the TrafficManager in 0.9.7, which dramatically changes how it works. For the TM, the answer is no, the TM either manages all the control, or nothing at all. I am not sure about the previous autopilot.

Additionally, watch out for the get_control and set_control. These do no call the simulation, so whenever you get a control, you are getting the one at the previous frame, even if you’ve already set one this frame. In other words, you can’t set_control, then retrieve it with get_control somewhere else, modify the throttle and brake, and set_control again.

Hi,

Thanks a lot for your answer! I think I am using the version 0.9.6 but I am not sure (it was not myself who installed it). How can I check the version?

So I would only like to add some noise to throttle and brake signals that autopilot sets. Is it possible to do so in any version? I see that get_control and set_control are not the best solution.

I am looking for a solution like the one which was described here but for the newer verions of the API.

Thanks!

Hmm, then I might not be able to help you, because I’ve always used 0.9.7 and later releases, so my knowledge about the old autopilot is very minimal. I’ll take a look see if I can find something out.

In any case, the advice I can give you is, use versions older than 0.9.7.

Thanks a lot for your help!