Skip to content

Commit fd98d2b

Browse files
Adding patches for improving robustness of Windows build pipeline for Carla 0.9.13
1 parent 984d756 commit fd98d2b

File tree

11 files changed

+929
-19
lines changed

11 files changed

+929
-19
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## DReyeVR 0.1.2 (for Carla 0.9.13)
2+
- Update documentation to refer to CarlaUnreal UE4 fork rather than HarpLab fork
3+
- Apply patches for installation of zlib (broken link) and xerces (broken link & `-Dtranscoder=windows` flag) and PythonAPI
4+
- Fix crash on BeginPlay when EgoVehicle blueprint is already present in map (before world start)
5+
16
## DReyeVR 0.1.1 (for Carla 0.9.13)
27
- Update documentation, add developer-centric in-depth documentation
38
- Adding missing includes for TrafficSign RoadInfoSignal in SignComponent

DReyeVR/EgoVehicle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ FVector AEgoVehicle::GetCameraOffset() const
347347
}
348348
FVector AEgoVehicle::GetCameraPosn() const
349349
{
350-
return GetCamera()->GetComponentLocation();
350+
return GetCamera() ? GetCamera()->GetComponentLocation() : FVector::ZeroVector;
351351
}
352352
FVector AEgoVehicle::GetNextCameraPosn(const float DeltaSeconds) const
353353
{
@@ -356,7 +356,7 @@ FVector AEgoVehicle::GetNextCameraPosn(const float DeltaSeconds) const
356356
}
357357
FRotator AEgoVehicle::GetCameraRot() const
358358
{
359-
return GetCamera()->GetComponentRotation();
359+
return GetCamera() ? GetCamera()->GetComponentRotation() : FRotator::ZeroRotator;
360360
}
361361
const class AEgoSensor *AEgoVehicle::GetSensor() const
362362
{

Docs/Install.md

+5-16
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,7 @@ make check CARLA=../carla
291291
```bat
292292
conda activate carla13
293293
```
294-
2. When trying to `make PythonAPI` you'll need to apply [this fix](https://github.com/carla-simulator/carla/issues/2881#issuecomment-699452386) (Replace `py` with `python` in `BuildPythonAPI.bat`)
295-
```bat
296-
...
297-
rem previously called "py -3 setup.py ..." --> replace with just "python setup.py ..."
298-
if %BUILD_FOR_PYTHON3%==true (
299-
echo Building Python API for Python 3.
300-
python setup.py bdist_egg bdist_wheel
301-
if %errorlevel% neq 0 goto error_build_wheel
302-
)
303-
```
304-
- This is because Carla (by default) installs the PythonAPI to the native Python client that comes pre-installed with every Windows machine. This goes 100% against compartmentalizing python environments so we have to patch this file to proceed.
305-
3. Add carla to "path" to locate the PythonAPI and ScenarioRunner. But since Anaconda [does not use the traditional `PYTHONPATH`](https://stackoverflow.com/questions/37006114/anaconda-permanently-include-external-packages-like-in-pythonpath) you'll need to:
294+
2. Add carla to "path" to locate the PythonAPI and ScenarioRunner. But since Anaconda [does not use the traditional `PYTHONPATH`](https://stackoverflow.com/questions/37006114/anaconda-permanently-include-external-packages-like-in-pythonpath) you'll need to:
306295
- 3.1. Create a file `carla.pth` in `\PATH\TO\ANACONDA\envs\carla\Lib\site-packages\`
307296
- 3.2. Insert the following content into `carla.pth`:
308297
```bat
@@ -313,22 +302,22 @@ make check CARLA=../carla
313302
C:\PATH\TO\CARLA\PythonAPI\examples
314303
C:\PATH\TO\SCENARIO_RUNNER\
315304
```
316-
4. Install the specific carla wheel (`whl`) to Anaconda
305+
3. Install the specific carla wheel (`whl`) to Anaconda
317306
```bash
318-
conda activate carla
307+
conda activate carla13
319308
pip install --no-deps --force-reinstall PATH\TO\CARLA\PythonAPI\carla\dist\carla-0.9.13-cp37-cp37m-win_amd64.whl
320309
321310
# if applicable (and you installed Scenario runner)
322311
cd %SCENARIO_RUNNER_ROOT%
323312
pip install -r requirements.txt # install all SR dependencies
324313
```
325-
5. Finally, there are some problems with `shapely` (SR dependency) and Conda. Luckily the solution is simple:
314+
4. Finally, you might run into problems with `shapely` (scenario-runner dependency) and Conda. Luckily the solution is simple:
326315
- Copy the files:
327316
- `PATH\TO\ANACONDA\envs\carla13\Lib\site-packages\shapely\DLLs\geos.dll`
328317
- `PATH\TO\ANACONDA\envs\carla13\Lib\site-packages\shapely\DLLs\geos_c.dll`
329318
- To destination:
330319
- `PATH\TO\ANACONDA\envs\carla13\Library\bin\`
331-
6. Now finally, you should be able to verify all PythonAPI actions work as expected via:
320+
5. Now finally, you should be able to verify all PythonAPI actions work as expected via:
332321
```bat
333322
conda activate carla13
334323
python

Scripts/Paths/DReyeVR.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ Content,Unreal/CarlaUE4/
99
LibCarla,/
1010
PythonAPI,/
1111
Carla,Unreal/CarlaUE4/Plugins/Carla/Source/
12-
Tools/BuildTools/*.sh,Util/BuildTools/
12+
Util,/
1313
Scripts/Other/.gitignore,/
1414
Shaders/*.uasset,Unreal/CarlaUE4/Plugins/Carla/Content/PostProcessingMaterials/
File renamed without changes.

Util/BuildTools/BuildPythonAPI.bat

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
@echo off
2+
setlocal
3+
4+
rem BAT script that creates the client python api of LibCarla (carla.org).
5+
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
6+
7+
set LOCAL_PATH=%~dp0
8+
set FILE_N=-[%~n0]:
9+
10+
rem Print batch params (debug purpose)
11+
echo %FILE_N% [Batch params]: %*
12+
13+
rem ============================================================================
14+
rem -- Parse arguments ---------------------------------------------------------
15+
rem ============================================================================
16+
17+
set DOC_STRING=Build and package CARLA Python API.
18+
set "USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--clean]"
19+
20+
set REMOVE_INTERMEDIATE=false
21+
set BUILD_FOR_PYTHON2=false
22+
set BUILD_FOR_PYTHON3=false
23+
24+
:arg-parse
25+
if not "%1"=="" (
26+
if "%1"=="--rebuild" (
27+
set REMOVE_INTERMEDIATE=true
28+
rem We don't provide support for py2 right now
29+
set BUILD_FOR_PYTHON2=false
30+
set BUILD_FOR_PYTHON3=true
31+
)
32+
33+
if "%1"=="--py2" (
34+
set BUILD_FOR_PYTHON2=true
35+
)
36+
37+
if "%1"=="--py3" (
38+
set BUILD_FOR_PYTHON3=true
39+
)
40+
41+
42+
if "%1"=="--clean" (
43+
set REMOVE_INTERMEDIATE=true
44+
)
45+
46+
if "%1"=="-h" (
47+
echo %DOC_STRING%
48+
echo %USAGE_STRING%
49+
GOTO :eof
50+
)
51+
52+
if "%1"=="--help" (
53+
echo %DOC_STRING%
54+
echo %USAGE_STRING%
55+
GOTO :eof
56+
)
57+
58+
shift
59+
goto :arg-parse
60+
)
61+
62+
set PYTHON_LIB_PATH=%ROOT_PATH:/=\%PythonAPI\carla\
63+
64+
if %REMOVE_INTERMEDIATE% == false (
65+
if %BUILD_FOR_PYTHON3% == false (
66+
if %BUILD_FOR_PYTHON2% == false (
67+
echo Nothing selected to be done.
68+
goto :eof
69+
)
70+
)
71+
)
72+
73+
if %REMOVE_INTERMEDIATE% == true (
74+
rem Remove directories
75+
for %%G in (
76+
"%PYTHON_LIB_PATH%build",
77+
"%PYTHON_LIB_PATH%dist",
78+
"%PYTHON_LIB_PATH%source\carla.egg-info"
79+
) do (
80+
if exist %%G (
81+
echo %FILE_N% Cleaning %%G
82+
rmdir /s/q %%G
83+
)
84+
)
85+
if %BUILD_FOR_PYTHON3% == false (
86+
if %BUILD_FOR_PYTHON2% == false (
87+
goto good_exit
88+
)
89+
)
90+
)
91+
92+
cd "%PYTHON_LIB_PATH%"
93+
rem if exist "%PYTHON_LIB_PATH%dist" goto already_installed
94+
95+
rem ============================================================================
96+
rem -- Check for py ------------------------------------------------------------
97+
rem ============================================================================
98+
99+
rem prefer invoking 'python' (for externally installed, eg conda) over 'py' (built in to Windows)
100+
rem
101+
set PYTHON_EXEC=python
102+
103+
where %PYTHON_EXEC%>nul
104+
if %errorlevel% neq 0 set PYTHON_EXEC=py -3
105+
106+
where %PYTHON_EXEC%>nul
107+
if %errorlevel% neq 0 goto error_py
108+
109+
rem Build for Python 2
110+
rem
111+
if %BUILD_FOR_PYTHON2%==true (
112+
goto py2_not_supported
113+
)
114+
115+
rem Build for Python 3
116+
rem
117+
if %BUILD_FOR_PYTHON3%==true (
118+
echo Building Python API for Python 3.
119+
%PYTHON_EXEC% setup.py bdist_egg bdist_wheel
120+
if %errorlevel% neq 0 goto error_build_wheel
121+
)
122+
123+
goto success
124+
125+
rem ============================================================================
126+
rem -- Messages and Errors -----------------------------------------------------
127+
rem ============================================================================
128+
129+
:success
130+
echo.
131+
if %BUILD_FOR_PYTHON3%==true echo %FILE_N% Carla lib for python has been successfully installed in "%PYTHON_LIB_PATH%dist"!
132+
goto good_exit
133+
134+
:already_installed
135+
echo.
136+
echo %FILE_N% [ERROR] Already installed in "%PYTHON_LIB_PATH%dist"
137+
goto good_exit
138+
139+
:py2_not_supported
140+
echo.
141+
echo %FILE_N% [ERROR] Python 2 is not currently suported in Windows.
142+
goto bad_exit
143+
144+
:error_py
145+
echo.
146+
echo %FILE_N% [ERROR] An error ocurred while executing the py.
147+
echo %FILE_N% [ERROR] Possible causes:
148+
echo %FILE_N% [ERROR] - Make sure "py" is installed.
149+
echo %FILE_N% [ERROR] - py = python launcher. This utility is bundled with Python installation but not installed by default.
150+
echo %FILE_N% [ERROR] - Make sure it is available on your Windows "py".
151+
goto bad_exit
152+
153+
:error_build_wheel
154+
echo.
155+
echo %FILE_N% [ERROR] An error occurred while building the wheel file.
156+
goto bad_exit
157+
158+
:good_exit
159+
endlocal
160+
exit /b 0
161+
162+
:bad_exit
163+
endlocal
164+
exit /b %errorlevel%
165+
File renamed without changes.

0 commit comments

Comments
 (0)