Carla SemiTruck and Trailer

video

Run it under windows 10 with carla 0.0.13 and unreal 4.26

This version is still under construction!

Problems:

  • Some time the truck gets stuck, (it looks like it is stuck in the floor)
  • Spawning the combination in the world could give problems because I did not take the length into account. So the trailer could be placed on an other vehicle
  • Cornering with the tractor,does not take into account that there is a trailer behind the truck, so corner me be cut off.

Put the files in the right place

The whole directory structure and files nee to be copied in to the root folder of Carla.

Add the Truck and trailer to the Blueprint Library

You also need to add the vehicle to the Blueprint Library.

As described in the carla docs in the section : 9. Add the vehicle to the Blueprint Library.

9. Add the vehicle to the Blueprint Library.

Point 4. (below) is important!

  1. In Content/Carla/Blueprint/Vehicle, open the VehicleFactory file.
  2. In the Generate Definitions tab, double click Vehicles.
  3. In the Details panel, expand the Default Value section and add a new element to the vehicles array.
  4. Fill in the Make and Model of your vehicle. For the truck name de Make "DAFxf". And for the trailer name the Make: "trailer".
  5. Fill in the Class value with your BP_<vehicle_name> file.
  6. Optionally, provide a set of recommended colors for the vehicle. Name the "model" an "make" as below in the picture image
  1. Compile and save.

vehicle factory

Test the vehicle

Manual driving

Launch CARLA, open a terminal in PythonAPI/examples and run the following command:

python manual_controlSemiTrailer.py

Note

Even if you used upper case characters in your make and model, they need to be converted to lower case when passed to the filter.

Generate traffic

Not sure if the below line is correct. Pease try it.

python generate_trafficsemiTrailer.py -n5

Manual coupling

If you want to couple the tractor to the trailer manually you should place a trailer in the world and then run the standard manual_control.py with the option --filter dafxf

python manual_control.py --filter dafxf

Then drive backwards with the tractor to the front of the trailer and it will couple. It needs a lot of improvement, but it works.