codes of the parallel-parking scenario.
Note that all of the files should be in the same directory. Here is the structure of files:
- autoParking.py: includes the main implementation
- maneuver.py: contains calculation for vehicle maneuver which is imported to autoParking and is called during maneuver step iby parking_maneuver() function in the main file(autoParking) 3.config.py: all of the thresholds and global values for vehicle's parameters(like steering and celocity) are difined here. This file is imported to maneuver.py file and its values are called by calculationn function.
- parking.m: this is a matlab file which calls detector and examine the results of the detection to find parking vacancy. The output is overlap-ratio which returned to python(auto-parking)
- interface.py: is an API to interface matlab and python.
In order to run python scripts, Carla-server should be executed at first, then python scripts could be called and connect to the server on port 2000 or 2001. To run Carla-server, if you use built/compiled version(offered by carla.org) the following command in terminal should be executed to open CarlaUE4.sh
./CarlaUE4.sh Town02 -carla-server -windowed -X=50px -Y=40p -benchmark -fps=20
And when Carla is made from source code manually(not a compiled version), UnrealEditor could be opened as server. And as it open the editor, it would be slower than the compiled version. To open UE4Editor as carla-server, following command should be executed. CarlaUE4.uproject is the project made by Carla and this command run this project on UE4Editor.
~/UnrealEngine_4.21/Engine/Binaries/Linux/UE4Editor ~/carla/Unreal/CarlaUE4/CarlaUE4.uproject Town02 -benchmark -fps 20 1877
It is also possible to access CarlaUE4.sh here and run the implementation without opening UnrealEngine but CarlaUE4.sh file is located on Dist (../Carla/Dist/0.9.5/LinuxNoEditor)
After running Carla-Server in another terminal the main python script(autoParking.py) should be called or if you just want to see the maneuver parkingManeuver.py can be executed
#please consider that all scripts are based on python2.7... so the carla connection may not work with python3