Compare commits
5 Commits
606a8f01bd
...
9c85f8a383
Author | SHA1 | Date |
---|---|---|
berndgassmann | 9c85f8a383 | |
berndgassmann | 83068cbc74 | |
berndgassmann | fa5b123c48 | |
berndgassmann | edcbae1ee1 | |
berndgassmann | 634e418777 |
|
@ -12,13 +12,11 @@
|
||||||
* Fixed bug in python agents when vehicle list was empty causing a check on all vehicles (BasicAgent.py) and detected pedestrians as vehicles if no pedestrains are present (BehaviourAgent.py)
|
* Fixed bug in python agents when vehicle list was empty causing a check on all vehicles (BasicAgent.py) and detected pedestrians as vehicles if no pedestrains are present (BehaviourAgent.py)
|
||||||
* Extended debug drawing functions to allow drawing primitives on HUD layer
|
* Extended debug drawing functions to allow drawing primitives on HUD layer
|
||||||
* Added possibility to change gravity variable in imui sensor for the accelerometer
|
* Added possibility to change gravity variable in imui sensor for the accelerometer
|
||||||
* Fixed ROS2 native extension build error when ROS2 is installed in the system.
|
|
||||||
* ROS2Native: Force fast-dds dependencies download to avoid build crash when boost_asio and tinyxml2 are not installed in Linux.
|
|
||||||
* Added API function `get_telemetry_data` to the vehicle actor.
|
* Added API function `get_telemetry_data` to the vehicle actor.
|
||||||
* PythonAPI `Sensor.is_listening` was defined twice (property and method), cleaned and clarified it as a method.
|
* PythonAPI `Sensor.is_listening` was defined twice (property and method), cleaned and clarified it as a method.
|
||||||
* Added V2X sensors for cooperative awareness message and custom user-defined messages to support vehicle-to-vehicle communication
|
* Added V2X sensors for cooperative awareness message and custom user-defined messages to support vehicle-to-vehicle communication
|
||||||
* Added named tuples for BasicAgent.py's detection result to allow for type-hints and better semantics.
|
* Added named tuples for BasicAgent.py's detection result to allow for type-hints and better semantics.
|
||||||
|
* Cleaned up the client/server build and respective naming
|
||||||
|
|
||||||
## CARLA 0.9.15
|
## CARLA 0.9.15
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ CARLA requires many different kinds of software to run. Some are built during th
|
||||||
sudo apt-get update &&
|
sudo apt-get update &&
|
||||||
sudo apt-get install wget software-properties-common &&
|
sudo apt-get install wget software-properties-common &&
|
||||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add
|
sudo apt-get update
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
|
@ -50,41 +50,28 @@ To avoid compatibility issues between Unreal Engine and the CARLA dependencies,
|
||||||
|
|
||||||
__Ubuntu 22.04__.
|
__Ubuntu 22.04__.
|
||||||
```sh
|
```sh
|
||||||
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu focal main universe"
|
sudo apt-get install build-essential g++-13 cmake ninja-build libvulkan1 python3 python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git git-lfs
|
||||||
sudo apt-get update
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 180
|
||||||
sudo apt-get install build-essential clang-10 lld-10 g++-7 cmake ninja-build libvulkan1 python python3 python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git git-lfs
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-10/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-10/bin/clang 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 180
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__Ubuntu 20.04__.
|
__Ubuntu 20.04__.
|
||||||
```sh
|
```sh
|
||||||
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main"
|
sudo apt-get install build-essential g++-13 cmake ninja-build libvulkan1 python python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
sudo apt-get update
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 180
|
||||||
sudo apt-get install build-essential clang-10 lld-10 g++-7 cmake ninja-build libvulkan1 python python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-10/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-10/bin/clang 180
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__Ubuntu 18.04__.
|
__Ubuntu 18.04__.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main"
|
sudo apt-get install build-essential g++-13 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
sudo apt-get update
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 180
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__Ubuntu 16.04__.
|
__Ubuntu 16.04__.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" &&
|
sudo apt-get install build-essential g++-13 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
sudo apt-get update
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 180
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__Previous Ubuntu versions__.
|
__Previous Ubuntu versions__.
|
||||||
|
@ -92,11 +79,8 @@ __Previous Ubuntu versions__.
|
||||||
We strongly advise using Ubuntu 18.04 or later to build CARLA. However, you may attempt to build CARLA on older versions of Ubuntu with the following commands:
|
We strongly advise using Ubuntu 18.04 or later to build CARLA. However, you may attempt to build CARLA on older versions of Ubuntu with the following commands:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-add-repository "deb http://apt.llvm.org/<code_name>/ llvm-toolchain-<code_name>-8 main" &&
|
sudo apt-get install build-essential g++-13 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
sudo apt-get update
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 180
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__All Ubuntu systems__.
|
__All Ubuntu systems__.
|
||||||
|
|
|
@ -4,8 +4,8 @@ BINDIR=$(CURDIR)/bin
|
||||||
INSTALLDIR=$(CURDIR)/libcarla-install
|
INSTALLDIR=$(CURDIR)/libcarla-install
|
||||||
TOOLCHAIN=$(CURDIR)/ToolChain.cmake
|
TOOLCHAIN=$(CURDIR)/ToolChain.cmake
|
||||||
|
|
||||||
CC=/usr/bin/gcc-7
|
CC=/usr/bin/gcc-13
|
||||||
CXX=/usr/bin/g++-7
|
CXX=/usr/bin/g++-13
|
||||||
CXXFLAGS=-std=c++14 -pthread -fPIC -O3 -DNDEBUG -Werror -Wall -Wextra
|
CXXFLAGS=-std=c++14 -pthread -fPIC -O3 -DNDEBUG -Werror -Wall -Wextra
|
||||||
|
|
||||||
define log
|
define log
|
||||||
|
|
|
@ -4,10 +4,12 @@ project(libcarla)
|
||||||
option(LIBCARLA_BUILD_DEBUG "Build debug configuration" ON)
|
option(LIBCARLA_BUILD_DEBUG "Build debug configuration" ON)
|
||||||
option(LIBCARLA_BUILD_RELEASE "Build release configuration" ON)
|
option(LIBCARLA_BUILD_RELEASE "Build release configuration" ON)
|
||||||
option(LIBCARLA_BUILD_TEST "Build unit tests" ON)
|
option(LIBCARLA_BUILD_TEST "Build unit tests" ON)
|
||||||
|
option(LIBCARLA_USE_ROS "Build ROS variant" OFF)
|
||||||
|
|
||||||
message(STATUS "Build debug: ${LIBCARLA_BUILD_DEBUG}")
|
message(STATUS "Build debug: ${LIBCARLA_BUILD_DEBUG}")
|
||||||
message(STATUS "Build release: ${LIBCARLA_BUILD_RELEASE}")
|
message(STATUS "Build release: ${LIBCARLA_BUILD_RELEASE}")
|
||||||
message(STATUS "Build test: ${LIBCARLA_BUILD_TEST}")
|
message(STATUS "Build test: ${LIBCARLA_BUILD_TEST}")
|
||||||
|
message(STATUS "Enable ROS: ${LIBCARLA_USE_ROS}")
|
||||||
|
|
||||||
set(libcarla_source_path "${PROJECT_SOURCE_DIR}/../source")
|
set(libcarla_source_path "${PROJECT_SOURCE_DIR}/../source")
|
||||||
set(libcarla_source_thirdparty_path "${libcarla_source_path}/third-party")
|
set(libcarla_source_thirdparty_path "${libcarla_source_path}/third-party")
|
||||||
|
@ -24,14 +26,12 @@ if (CMAKE_BUILD_TYPE STREQUAL "Client")
|
||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "Server")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Server")
|
||||||
add_subdirectory("server")
|
add_subdirectory("server")
|
||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "Pytorch")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Pytorch")
|
||||||
add_subdirectory("pytorch")
|
add_subdirectory("pytorch")
|
||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "ros2")
|
|
||||||
add_subdirectory("fast_dds")
|
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Unknown build type '${CMAKE_BUILD_TYPE}'")
|
message(FATAL_ERROR "Unknown build type '${CMAKE_BUILD_TYPE}'")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# GTest is not compiled on Windows.
|
# GTest is not compiled on Windows.
|
||||||
if ((LIBCARLA_BUILD_TEST) AND (NOT WIN32) AND (NOT (CMAKE_BUILD_TYPE STREQUAL "Pytorch")) AND (NOT (CMAKE_BUILD_TYPE STREQUAL "ros2")))
|
if ((LIBCARLA_BUILD_TEST) AND (NOT WIN32) AND (NOT (CMAKE_BUILD_TYPE STREQUAL "Pytorch")))
|
||||||
add_subdirectory("test")
|
add_subdirectory("test")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -21,8 +21,8 @@ if (BUILD_RSS_VARIANT)
|
||||||
install(FILES ${spdlog_file} DESTINATION lib)
|
install(FILES ${spdlog_file} DESTINATION lib)
|
||||||
list(APPEND ADRSS_LIBS ${spdlog_file})
|
list(APPEND ADRSS_LIBS ${spdlog_file})
|
||||||
|
|
||||||
set(proj_include_dir ${ADRSS_INSTALL_DIR}/../../proj-install/include)
|
set(proj_include_dir ${PROJ_INCLUDE_PATH})
|
||||||
set(proj_lib ${ADRSS_INSTALL_DIR}/../../proj-install/lib/libproj.a)
|
set(proj_lib ${PROJ_LIBPATH}/libproj.a)
|
||||||
install(DIRECTORY ${proj_include_dir} DESTINATION include/system)
|
install(DIRECTORY ${proj_include_dir} DESTINATION include/system)
|
||||||
list(APPEND ADRSS_INCLUDE_DIRS ${proj_include_dir})
|
list(APPEND ADRSS_INCLUDE_DIRS ${proj_include_dir})
|
||||||
install(FILES ${proj_lib} DESTINATION lib)
|
install(FILES ${proj_lib} DESTINATION lib)
|
||||||
|
@ -98,6 +98,12 @@ file(GLOB libcarla_carla_sources
|
||||||
set(libcarla_sources "${libcarla_sources};${libcarla_carla_sources}")
|
set(libcarla_sources "${libcarla_sources};${libcarla_carla_sources}")
|
||||||
install(FILES ${libcarla_carla_sources} DESTINATION include/carla)
|
install(FILES ${libcarla_carla_sources} DESTINATION include/carla)
|
||||||
|
|
||||||
|
file(GLOB libcarla_carla_actors_sources
|
||||||
|
"${libcarla_source_path}/carla/actors/*.cpp"
|
||||||
|
"${libcarla_source_path}/carla/actors/*.h")
|
||||||
|
set(libcarla_sources "${libcarla_sources};${libcarla_carla_actors_sources}")
|
||||||
|
install(FILES ${libcarla_carla_actors_sources} DESTINATION include/carla/actors)
|
||||||
|
|
||||||
file(GLOB libcarla_carla_client_sources
|
file(GLOB libcarla_carla_client_sources
|
||||||
"${libcarla_source_path}/carla/client/*.cpp"
|
"${libcarla_source_path}/carla/client/*.cpp"
|
||||||
"${libcarla_source_path}/carla/client/*.h")
|
"${libcarla_source_path}/carla/client/*.h")
|
||||||
|
@ -266,11 +272,10 @@ file(GLOB libcarla_carla_trafficmanager_sources
|
||||||
set(libcarla_sources "${libcarla_sources};${libcarla_carla_trafficmanager_sources}")
|
set(libcarla_sources "${libcarla_sources};${libcarla_carla_trafficmanager_sources}")
|
||||||
install(FILES ${libcarla_carla_trafficmanager_sources} DESTINATION include/carla/trafficmanager)
|
install(FILES ${libcarla_carla_trafficmanager_sources} DESTINATION include/carla/trafficmanager)
|
||||||
|
|
||||||
file(GLOB libcarla_carla_ros2_sources
|
file(GLOB libcarla_carla_ros2_public_headers
|
||||||
"${libcarla_source_path}/carla/ros2/*.cpp"
|
"${libcarla_source_path}/carla/ros2/*.h"
|
||||||
"${libcarla_source_path}/carla/ros2/*.h")
|
)
|
||||||
set(libcarla_sources "${libcarla_sources};${libcarla_carla_ros2_sources}")
|
install(FILES ${libcarla_carla_ros2_public_headers} DESTINATION include/carla/ros2)
|
||||||
install(FILES ${libcarla_carla_ros2_sources} DESTINATION include/carla/ros2)
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Create targets for debug and release in the same build type.
|
# Create targets for debug and release in the same build type.
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.5.1)
|
|
||||||
project(libcarla_fastdds)
|
|
||||||
|
|
||||||
# Install headers.
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_fastdds_headers
|
|
||||||
"${libcarla_source_path}/carla/ros2/publishers/*.h"
|
|
||||||
"${libcarla_source_path}/carla/ros2/subscribers/*.h"
|
|
||||||
"${libcarla_source_path}/carla/ros2/listeners/*.h"
|
|
||||||
"${libcarla_source_path}/carla/ros2/types/*.h"
|
|
||||||
)
|
|
||||||
install(FILES ${libcarla_carla_fastdds_headers} DESTINATION include/carla/ros2)
|
|
||||||
|
|
||||||
file(GLOB fast_dds_dependencies "${FASTDDS_LIB_PATH}/*.so*")
|
|
||||||
install(FILES ${fast_dds_dependencies} DESTINATION lib)
|
|
||||||
|
|
||||||
|
|
||||||
file(GLOB libcarla_fastdds_sources
|
|
||||||
"${libcarla_source_path}/carla/ros2/publishers/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/ros2/subscribers/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/ros2/listeners/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/ros2/types/*.cpp")
|
|
||||||
|
|
||||||
set(FASTDDS_CPP_STD_INCLUDES "/usr/include/c++/7")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -I${FASTDDS_CPP_STD_INCLUDES}" CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# Create targets for debug and release in the same build type.
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
if (LIBCARLA_BUILD_RELEASE)
|
|
||||||
add_library(carla_fastdds STATIC ${libcarla_fastdds_sources})
|
|
||||||
|
|
||||||
target_include_directories(carla_fastdds SYSTEM PRIVATE
|
|
||||||
"${BOOST_INCLUDE_PATH}"
|
|
||||||
"${RPCLIB_INCLUDE_PATH}")
|
|
||||||
|
|
||||||
target_include_directories(carla_fastdds PRIVATE "${FASTDDS_INCLUDE_PATH}")
|
|
||||||
target_include_directories(carla_fastdds PRIVATE "${libcarla_source_path}/carla/ros2")
|
|
||||||
target_link_libraries(carla_fastdds fastrtps fastcdr "${FAST_DDS_LIBRARIES}")
|
|
||||||
install(TARGETS carla_fastdds DESTINATION lib)
|
|
||||||
set_target_properties(carla_fastdds PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}")
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LIBCARLA_BUILD_DEBUG)
|
|
||||||
|
|
||||||
add_library(carla_fastdds_debug STATIC ${libcarla_fastdds_sources})
|
|
||||||
target_include_directories(carla_fastdds_debug SYSTEM PRIVATE
|
|
||||||
"${BOOST_INCLUDE_PATH}"
|
|
||||||
"${RPCLIB_INCLUDE_PATH}")
|
|
||||||
install(TARGETS carla_fastdds_debug DESTINATION lib)
|
|
||||||
set_target_properties(carla_fastdds_debug PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
|
|
||||||
target_compile_definitions(carla_fastdds_debug PUBLIC -DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
|
|
||||||
|
|
||||||
endif()
|
|
|
@ -1,78 +1,51 @@
|
||||||
cmake_minimum_required(VERSION 3.5.1)
|
cmake_minimum_required(VERSION 3.5.1)
|
||||||
project(libcarla-server)
|
project(libcarla-server)
|
||||||
|
|
||||||
# Install libc++ shared libraries.
|
|
||||||
file(GLOB LibCXX_Libraries "${LLVM_LIB_PATH}/libc++*")
|
|
||||||
install(FILES ${LibCXX_Libraries} DESTINATION lib)
|
|
||||||
|
|
||||||
# Install rpclib.
|
|
||||||
install(DIRECTORY "${RPCLIB_INCLUDE_PATH}/rpc" DESTINATION include)
|
|
||||||
file(GLOB libcarla_carla_rpclib "${RPCLIB_LIB_PATH}/*.*")
|
|
||||||
install(FILES ${libcarla_carla_rpclib} DESTINATION lib)
|
|
||||||
|
|
||||||
# Install headers.
|
|
||||||
|
|
||||||
install(DIRECTORY "${libcarla_source_path}/compiler" DESTINATION include)
|
install(DIRECTORY "${libcarla_source_path}/compiler" DESTINATION include)
|
||||||
|
|
||||||
file(GLOB libcarla_carla_headers "${libcarla_source_path}/carla/*.h")
|
foreach(dir ""
|
||||||
install(FILES ${libcarla_carla_headers} DESTINATION include/carla)
|
"actors/"
|
||||||
|
"geom/"
|
||||||
|
"opendrive/" "opendrive/parser/"
|
||||||
|
"profiler/"
|
||||||
|
"road/" "road/element/" "road/general/" "road/object/" "road/signal/"
|
||||||
|
"rpc/"
|
||||||
|
"sensor/" "sensor/data/" "sensor/s11n/"
|
||||||
|
"streaming/" "streaming/detail/" "streaming/detail/tcp/" "streaming/low_level/"
|
||||||
|
"multigpu/")
|
||||||
|
|
||||||
file(GLOB libcarla_carla_geom_headers "${libcarla_source_path}/carla/geom/*.h")
|
file(GLOB headers "${libcarla_source_path}/carla/${dir}*.h")
|
||||||
install(FILES ${libcarla_carla_geom_headers} DESTINATION include/carla/geom)
|
install(FILES ${headers} DESTINATION include/carla/${dir})
|
||||||
|
|
||||||
file(GLOB libcarla_carla_opendrive "${libcarla_source_path}/carla/opendrive/*.h")
|
endforeach()
|
||||||
install(FILES ${libcarla_carla_opendrive} DESTINATION include/carla/opendrive)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_opendrive_parser "${libcarla_source_path}/carla/opendrive/parser/*.h")
|
|
||||||
install(FILES ${libcarla_carla_opendrive_parser} DESTINATION include/carla/opendrive/parser)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_profiler_headers "${libcarla_source_path}/carla/profiler/*.h")
|
|
||||||
install(FILES ${libcarla_carla_profiler_headers} DESTINATION include/carla/profiler)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_road_headers "${libcarla_source_path}/carla/road/*.h")
|
# only install the required public interface headers
|
||||||
install(FILES ${libcarla_carla_road_headers} DESTINATION include/carla/road)
|
foreach(dir "" "types/" )
|
||||||
|
file(GLOB libcarla_carla_ros2_public_headers
|
||||||
|
"${libcarla_source_path}/carla/ros2/${dir}*.h"
|
||||||
|
)
|
||||||
|
install(FILES ${libcarla_carla_ros2_public_headers} DESTINATION include/carla/ros2/${dir})
|
||||||
|
endforeach()
|
||||||
|
if (LIBCARLA_USE_ROS)
|
||||||
|
|
||||||
file(GLOB libcarla_carla_road_element_headers "${libcarla_source_path}/carla/road/element/*.h")
|
file(GLOB subdirs RELATIVE "${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}" "${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}/*")
|
||||||
install(FILES ${libcarla_carla_road_element_headers} DESTINATION include/carla/road/element)
|
foreach(typedir "msg" "srv")
|
||||||
|
foreach(dir ${subdirs})
|
||||||
|
if(IS_DIRECTORY "${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}/${dir}/${typedir}")
|
||||||
|
file(GLOB libcarla_carla_ros2_types_${dir}_headers
|
||||||
|
"${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}/${dir}/${typedir}/*.h"
|
||||||
|
)
|
||||||
|
install(FILES ${libcarla_carla_ros2_types_${dir}_headers} DESTINATION include/carla/ros2/ros_types/${dir}/${typedir}/)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
file(GLOB libcarla_carla_road_general_headers "${libcarla_source_path}/carla/road/general/*.h")
|
if(NOT WIN32)
|
||||||
install(FILES ${libcarla_carla_road_general_headers} DESTINATION include/carla/road/general)
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
file(GLOB libcarla_carla_road_object_headers "${libcarla_source_path}/carla/road/object/*.h")
|
endif()
|
||||||
install(FILES ${libcarla_carla_road_object_headers} DESTINATION include/carla/road/object)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_road_signal_headers "${libcarla_source_path}/carla/road/signal/*.h")
|
|
||||||
install(FILES ${libcarla_carla_road_signal_headers} DESTINATION include/carla/road/signal)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_rpc_headers "${libcarla_source_path}/carla/rpc/*.h")
|
|
||||||
install(FILES ${libcarla_carla_rpc_headers} DESTINATION include/carla/rpc)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_sensor_headers "${libcarla_source_path}/carla/sensor/*.h")
|
|
||||||
install(FILES ${libcarla_carla_sensor_headers} DESTINATION include/carla/sensor)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_sensor_data_headers "${libcarla_source_path}/carla/sensor/data/*.h")
|
|
||||||
install(FILES ${libcarla_carla_sensor_data_headers} DESTINATION include/carla/sensor/data)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_sensor_s11n_headers "${libcarla_source_path}/carla/sensor/s11n/*.h")
|
|
||||||
install(FILES ${libcarla_carla_sensor_s11n_headers} DESTINATION include/carla/sensor/s11n)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_streaming_headers "${libcarla_source_path}/carla/streaming/*.h")
|
|
||||||
install(FILES ${libcarla_carla_streaming_headers} DESTINATION include/carla/streaming)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_streaming_detail_headers "${libcarla_source_path}/carla/streaming/detail/*.h")
|
|
||||||
install(FILES ${libcarla_carla_streaming_detail_headers} DESTINATION include/carla/streaming/detail)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_streaming_detail_tcp_headers "${libcarla_source_path}/carla/streaming/detail/tcp/*.h")
|
|
||||||
install(FILES ${libcarla_carla_streaming_detail_tcp_headers} DESTINATION include/carla/streaming/detail/tcp)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_streaming_low_level_headers "${libcarla_source_path}/carla/streaming/low_level/*.h")
|
|
||||||
install(FILES ${libcarla_carla_streaming_low_level_headers} DESTINATION include/carla/streaming/low_level)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_multigpu_headers "${libcarla_source_path}/carla/multigpu/*.h")
|
|
||||||
install(FILES ${libcarla_carla_multigpu_headers} DESTINATION include/carla/multigpu)
|
|
||||||
|
|
||||||
file(GLOB libcarla_carla_ros2_headers "${libcarla_source_path}/carla/ros2/*.h")
|
|
||||||
install(FILES ${libcarla_carla_ros2_headers} DESTINATION include/carla/ros2)
|
|
||||||
|
|
||||||
install(DIRECTORY "${BOOST_INCLUDE_PATH}/boost" DESTINATION include)
|
install(DIRECTORY "${BOOST_INCLUDE_PATH}/boost" DESTINATION include)
|
||||||
|
|
||||||
|
@ -85,47 +58,62 @@ if(WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# carla_server library.
|
# carla_server library.
|
||||||
|
# first the sources which are picked from some directories
|
||||||
|
set(libcarla_server_sources
|
||||||
|
"${libcarla_source_path}/carla/Buffer.cpp"
|
||||||
|
"${libcarla_source_path}/carla/Exception.cpp"
|
||||||
|
"${libcarla_source_path}/carla/StringUtil.cpp"
|
||||||
|
# other cpp files only define Deserialize used in client
|
||||||
|
"${libcarla_source_path}/carla/sensor/s11n/SensorHeaderSerializer.cpp"
|
||||||
|
)
|
||||||
|
# then the globs on the folders to add as a whole
|
||||||
|
foreach(dir
|
||||||
|
"actors"
|
||||||
|
"geom"
|
||||||
|
"opendrive" "opendrive/parser"
|
||||||
|
"profiler"
|
||||||
|
"road" "road/element" "road/general" "road/object" "road/signal"
|
||||||
|
"rpc"
|
||||||
|
"sensor" "sensor/data"
|
||||||
|
"streaming" "streaming/detail" "streaming/detail/tcp" "streaming/low_level"
|
||||||
|
"multigpu")
|
||||||
|
|
||||||
file(GLOB libcarla_server_sources
|
file(GLOB sources "${libcarla_source_path}/carla/${dir}/*.cpp")
|
||||||
"${libcarla_source_path}/carla/*.h"
|
list(APPEND libcarla_server_sources ${sources})
|
||||||
"${libcarla_source_path}/carla/Buffer.cpp"
|
|
||||||
"${libcarla_source_path}/carla/Exception.cpp"
|
endforeach()
|
||||||
"${libcarla_source_path}/carla/geom/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/geom/*.h"
|
foreach(thirdparty_dir
|
||||||
"${libcarla_source_path}/carla/opendrive/*.cpp"
|
"odrSpiral"
|
||||||
"${libcarla_source_path}/carla/opendrive/*.h"
|
"moodycamel"
|
||||||
"${libcarla_source_path}/carla/opendrive/parser/*.cpp"
|
"pugixml")
|
||||||
"${libcarla_source_path}/carla/opendrive/parser/*.h"
|
|
||||||
"${libcarla_source_path}/carla/road/*.cpp"
|
file(GLOB sources "${libcarla_source_thirdparty_path}/${thirdparty_dir}/*.cpp")
|
||||||
"${libcarla_source_path}/carla/road/*.h"
|
list(APPEND libcarla_server_sources ${sources})
|
||||||
"${libcarla_source_path}/carla/road/element/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/road/element/*.h"
|
endforeach()
|
||||||
"${libcarla_source_path}/carla/road/general/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/road/general/*.h"
|
if (LIBCARLA_USE_ROS)
|
||||||
"${libcarla_source_path}/carla/road/object/*.cpp"
|
foreach(ros2_dir
|
||||||
"${libcarla_source_path}/carla/road/object/*.h"
|
"/"
|
||||||
"${libcarla_source_path}/carla/road/signal/*.cpp"
|
"${ROS2_MW_NAME}/carla/ros2/impl/"
|
||||||
"${libcarla_source_path}/carla/road/signal/*.h"
|
"listeners/"
|
||||||
"${libcarla_source_path}/carla/rpc/*.cpp"
|
"publishers/"
|
||||||
"${libcarla_source_path}/carla/rpc/*.h"
|
"services/"
|
||||||
"${libcarla_source_path}/carla/sensor/*.h"
|
"subscribers/"
|
||||||
"${libcarla_source_path}/carla/sensor/s11n/*.h"
|
"types/")
|
||||||
"${libcarla_source_path}/carla/sensor/s11n/SensorHeaderSerializer.cpp"
|
|
||||||
"${libcarla_source_path}/carla/streaming/*.h"
|
file(GLOB sources "${libcarla_source_path}/carla/ros2/${ros2_dir}*.cpp")
|
||||||
"${libcarla_source_path}/carla/streaming/detail/*.cpp"
|
list(APPEND libcarla_server_sources ${sources})
|
||||||
"${libcarla_source_path}/carla/streaming/detail/*.h"
|
endforeach()
|
||||||
"${libcarla_source_path}/carla/streaming/detail/tcp/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/streaming/low_level/*.h"
|
file(GLOB msg_sources "${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}/*/msg/*.cxx")
|
||||||
"${libcarla_source_path}/carla/multigpu/*.h"
|
list(APPEND libcarla_server_sources ${msg_sources})
|
||||||
"${libcarla_source_path}/carla/multigpu/*.cpp"
|
|
||||||
"${libcarla_source_path}/carla/ros2/*.h"
|
file(GLOB srv_sources "${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}/*/srv/*.cxx")
|
||||||
"${libcarla_source_path}/carla/ros2/*.cpp"
|
list(APPEND libcarla_server_sources ${srv_sources})
|
||||||
"${libcarla_source_thirdparty_path}/odrSpiral/*.cpp"
|
|
||||||
"${libcarla_source_thirdparty_path}/odrSpiral/*.h"
|
endif()
|
||||||
"${libcarla_source_thirdparty_path}/moodycamel/*.cpp"
|
|
||||||
"${libcarla_source_thirdparty_path}/moodycamel/*.h"
|
|
||||||
"${libcarla_source_thirdparty_path}/pugixml/*.cpp"
|
|
||||||
"${libcarla_source_thirdparty_path}/pugixml/*.hpp")
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Create targets for debug and release in the same build type.
|
# Create targets for debug and release in the same build type.
|
||||||
|
@ -133,7 +121,10 @@ file(GLOB libcarla_server_sources
|
||||||
|
|
||||||
if (LIBCARLA_BUILD_RELEASE)
|
if (LIBCARLA_BUILD_RELEASE)
|
||||||
|
|
||||||
add_library(carla_server STATIC ${libcarla_server_sources})
|
add_library(carla_server STATIC
|
||||||
|
${libcarla_server_sources}
|
||||||
|
)
|
||||||
|
target_compile_definitions(carla_server PUBLIC -DCARLA_SERVER_BUILD)
|
||||||
|
|
||||||
target_include_directories(carla_server SYSTEM PRIVATE
|
target_include_directories(carla_server SYSTEM PRIVATE
|
||||||
"${BOOST_INCLUDE_PATH}"
|
"${BOOST_INCLUDE_PATH}"
|
||||||
|
@ -143,11 +134,23 @@ if (LIBCARLA_BUILD_RELEASE)
|
||||||
|
|
||||||
set_target_properties(carla_server PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}")
|
set_target_properties(carla_server PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
|
||||||
|
if (LIBCARLA_USE_ROS)
|
||||||
|
target_include_directories(carla_server SYSTEM PRIVATE
|
||||||
|
# first the ROS2_MW_NAME local folder allowing potential overrides of header files
|
||||||
|
"${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}"
|
||||||
|
"${ROS2_MW_INCLUDE_PATH}")
|
||||||
|
target_link_directories(carla_server PRIVATE ${ROS2_MW_LIB_PATH})
|
||||||
|
target_link_libraries(carla_server ${ROS2_MW_LINK_LIBRARIES})
|
||||||
|
target_compile_definitions(carla_server PUBLIC -DWITH_ROS2)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LIBCARLA_BUILD_DEBUG)
|
if (LIBCARLA_BUILD_DEBUG)
|
||||||
|
|
||||||
add_library(carla_server_debug STATIC ${libcarla_server_sources})
|
add_library(carla_server_debug STATIC
|
||||||
|
${libcarla_server_sources}
|
||||||
|
)
|
||||||
|
target_compile_definitions(carla_server_debug PUBLIC -DCARLA_SERVER_BUILD)
|
||||||
|
|
||||||
target_include_directories(carla_server_debug SYSTEM PRIVATE
|
target_include_directories(carla_server_debug SYSTEM PRIVATE
|
||||||
"${BOOST_INCLUDE_PATH}"
|
"${BOOST_INCLUDE_PATH}"
|
||||||
|
@ -158,4 +161,13 @@ if (LIBCARLA_BUILD_DEBUG)
|
||||||
set_target_properties(carla_server_debug PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
|
set_target_properties(carla_server_debug PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
target_compile_definitions(carla_server_debug PUBLIC -DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
|
target_compile_definitions(carla_server_debug PUBLIC -DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||||
|
|
||||||
|
if (LIBCARLA_USE_ROS)
|
||||||
|
target_include_directories(carla_server_debug SYSTEM PRIVATE
|
||||||
|
# first the ROS2_MW_NAME local folder allowing potential overrides of header files
|
||||||
|
"${libcarla_source_path}/carla/ros2/${ROS2_MW_NAME}"
|
||||||
|
"${ROS2_MW_INCLUDE_PATH}")
|
||||||
|
target_link_directories(carla_server_debug PRIVATE ${ROS2_MW_LIB_PATH})
|
||||||
|
target_link_libraries(carla_server_debug ${ROS2_MW_LINK_LIBRARIES})
|
||||||
|
target_compile_definitions(carla_server_debug PUBLIC -DWITH_ROS2)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,6 +15,10 @@ endif()
|
||||||
link_directories(
|
link_directories(
|
||||||
${RPCLIB_LIB_PATH}
|
${RPCLIB_LIB_PATH}
|
||||||
${GTEST_LIB_PATH})
|
${GTEST_LIB_PATH})
|
||||||
|
if (LIBCARLA_USE_ROS)
|
||||||
|
link_directories(${ROS2_MW_LIB_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
file(GLOB libcarla_test_sources
|
file(GLOB libcarla_test_sources
|
||||||
"${libcarla_source_path}/carla/profiler/*.cpp"
|
"${libcarla_source_path}/carla/profiler/*.cpp"
|
||||||
|
|
|
@ -15,19 +15,18 @@
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
void throw_exception(const std::exception &e) {
|
void throw_exception(const std::exception &e) {
|
||||||
carla::throw_exception(e);
|
carla::throw_exception(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throw_exception(
|
void throw_exception(const std::exception &e, boost::source_location const &loc) {
|
||||||
const std::exception &e,
|
(void)loc;
|
||||||
boost::source_location const & loc) {
|
throw_exception(e);
|
||||||
throw_exception(e);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_EXCEPTIONS
|
#endif // BOOST_NO_EXCEPTIONS
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// -- Workaround for Boost.Asio bundled with rpclib ----------------------------
|
// -- Workaround for Boost.Asio bundled with rpclib ----------------------------
|
||||||
|
@ -42,16 +41,47 @@ namespace boost {
|
||||||
namespace clmdep_asio {
|
namespace clmdep_asio {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <typename Exception>
|
template <typename Exception>
|
||||||
void throw_exception(const Exception& e) {
|
void throw_exception(const Exception &e) {
|
||||||
carla::throw_exception(e);
|
carla::throw_exception(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
template void throw_exception<std::bad_cast>(const std::bad_cast &);
|
template void throw_exception<std::bad_cast>(const std::bad_cast &e);
|
||||||
template void throw_exception<std::exception>(const std::exception &);
|
template void throw_exception<std::exception>(const std::exception &e);
|
||||||
template void throw_exception<std::system_error>(const std::system_error &);
|
template void throw_exception<std::system_error>(const std::system_error &e);
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace clmdep_asio
|
} // namespace clmdep_asio
|
||||||
|
|
||||||
#endif // ASIO_NO_EXCEPTIONS
|
namespace asio {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename Exception>
|
||||||
|
void throw_exception(const Exception &e) {
|
||||||
|
carla::throw_exception(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void throw_exception<std::bad_cast>(const std::bad_cast &e);
|
||||||
|
template void throw_exception<std::exception>(const std::exception &e);
|
||||||
|
template void throw_exception<std::system_error>(const std::system_error &e);
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace asio
|
||||||
|
|
||||||
|
#endif // ASIO_NO_EXCEPTIONS
|
||||||
|
|
||||||
|
#ifndef LIBCARLA_NO_EXCEPTIONS
|
||||||
|
|
||||||
|
namespace carla {
|
||||||
|
template
|
||||||
|
#ifndef __clang__
|
||||||
|
// clang doesn't support C++11 attributes in template explicit instantiation, since attributes in each case cannot
|
||||||
|
// be changed here MSVC requires it (might be a bit too conservative and requires the attributes also in explicit
|
||||||
|
// instanciation)
|
||||||
|
[[noreturn]]
|
||||||
|
#endif
|
||||||
|
void
|
||||||
|
throw_exception<std::exception>(const std::exception &);
|
||||||
|
} // namespace carla
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -6,38 +6,34 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
#ifdef LIBCARLA_NO_EXCEPTIONS
|
#ifdef LIBCARLA_NO_EXCEPTIONS
|
||||||
|
|
||||||
namespace std {
|
|
||||||
|
|
||||||
class exception;
|
|
||||||
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
/// User define function, similar to Boost throw_exception.
|
/// User define function, similar to Boost throw_exception.
|
||||||
///
|
///
|
||||||
/// @important Boost exceptions are also routed to this function.
|
/// @important Boost exceptions are also routed to this function.
|
||||||
///
|
///
|
||||||
/// When compiled with LIBCARLA_NO_EXCEPTIONS, this function is left undefined
|
/// When compiled with LIBCARLA_NO_EXCEPTIONS, this function is left undefined
|
||||||
/// in LibCarla, and the modules using LibCarla are expected to supply an
|
/// in LibCarla, and the modules using LibCarla are expected to supply an
|
||||||
/// appropriate definition. Callers of throw_exception are allowed to assume
|
/// appropriate definition. Callers of throw_exception are allowed to assume
|
||||||
/// that the function never returns; therefore, if the user-defined
|
/// that the function never returns; therefore, if the user-defined
|
||||||
/// throw_exception returns, the behavior is undefined.
|
/// throw_exception returns, the behavior is undefined.
|
||||||
[[ noreturn ]] void throw_exception(const std::exception &e);
|
[[noreturn]] void throw_exception(const std::exception &e);
|
||||||
|
|
||||||
} // namespace carla
|
} // namespace carla
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
[[ noreturn ]] void throw_exception(const T &e) {
|
[[noreturn]] void throw_exception(const T &e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace carla
|
} // namespace carla
|
||||||
|
|
||||||
#endif // LIBCARLA_NO_EXCEPTIONS
|
#endif // LIBCARLA_NO_EXCEPTIONS
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace geom {
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
Location &operator+=(const Location &rhs) {
|
Location &operator+=(const Location &rhs) {
|
||||||
static_cast<Vector3D &>(*this) += rhs;
|
static_cast<Vector3D &>(*this) += static_cast<const Vector3D &>(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace geom {
|
||||||
}
|
}
|
||||||
|
|
||||||
Location &operator-=(const Location &rhs) {
|
Location &operator-=(const Location &rhs) {
|
||||||
static_cast<Vector3D &>(*this) -= rhs;
|
static_cast<Vector3D &>(*this) -= static_cast<const Vector3D &>(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace geom {
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
bool operator==(const Location &rhs) const {
|
bool operator==(const Location &rhs) const {
|
||||||
return static_cast<const Vector3D &>(*this) == rhs;
|
return static_cast<const Vector3D &>(*this) == static_cast<const Vector3D &>(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Location &rhs) const {
|
bool operator!=(const Location &rhs) const {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
|
// de Barcelona (UAB).
|
||||||
|
//
|
||||||
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
|
#include "carla/Exception.h"
|
||||||
|
#include <asio.hpp>
|
||||||
|
|
||||||
|
#ifdef ASIO_NO_EXCEPTIONS
|
||||||
|
|
||||||
|
namespace asio {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename Exception>
|
||||||
|
void throw_exception(const Exception &e) {
|
||||||
|
carla::throw_exception(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void throw_exception<std::length_error>(const std::length_error &e);
|
||||||
|
template void throw_exception<asio::service_already_exists>(const asio::service_already_exists &e);
|
||||||
|
template void throw_exception<asio::invalid_service_owner>(const asio::invalid_service_owner &e);
|
||||||
|
template void throw_exception<asio::execution::bad_executor>(const asio::execution::bad_executor &e);
|
||||||
|
template void throw_exception<asio::ip::bad_address_cast>(const asio::ip::bad_address_cast &e);
|
||||||
|
template void throw_exception<std::out_of_range>(const std::out_of_range &e);
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace asio
|
||||||
|
|
||||||
|
#endif // ASIO_NO_EXCEPTIONS
|
|
@ -16,6 +16,7 @@
|
||||||
#include "carla/sensor/s11n/ImageSerializer.h"
|
#include "carla/sensor/s11n/ImageSerializer.h"
|
||||||
#include "carla/sensor/s11n/SensorHeaderSerializer.h"
|
#include "carla/sensor/s11n/SensorHeaderSerializer.h"
|
||||||
|
|
||||||
|
#include "fastdds/carla/ros2/impl/DdsDomainParticipantImpl.h"
|
||||||
#include "publishers/CarlaPublisher.h"
|
#include "publishers/CarlaPublisher.h"
|
||||||
#include "publishers/CarlaClockPublisher.h"
|
#include "publishers/CarlaClockPublisher.h"
|
||||||
#include "publishers/CarlaRGBCameraPublisher.h"
|
#include "publishers/CarlaRGBCameraPublisher.h"
|
||||||
|
@ -46,6 +47,14 @@ namespace ros2 {
|
||||||
|
|
||||||
// static fields
|
// static fields
|
||||||
std::shared_ptr<ROS2> ROS2::_instance;
|
std::shared_ptr<ROS2> ROS2::_instance;
|
||||||
|
std::shared_ptr<DdsDomainParticipantImpl> ROS2::GetDdsDomainParticipant() {
|
||||||
|
auto _instance = ROS2::GetInstance();
|
||||||
|
if (_instance->_domain_participant_impl == nullptr)
|
||||||
|
{
|
||||||
|
_instance->_domain_participant_impl = std::make_shared<DdsDomainParticipantImpl>();
|
||||||
|
}
|
||||||
|
return _instance->_domain_participant_impl;
|
||||||
|
}
|
||||||
|
|
||||||
// list of sensors (should be equal to the list of SensorsRegistry
|
// list of sensors (should be equal to the list of SensorsRegistry
|
||||||
enum ESensors {
|
enum ESensors {
|
||||||
|
@ -841,6 +850,9 @@ void ROS2::Shutdown() {
|
||||||
_clock_publisher.reset();
|
_clock_publisher.reset();
|
||||||
_controller.reset();
|
_controller.reset();
|
||||||
_enabled = false;
|
_enabled = false;
|
||||||
|
// finally, release the rest of our resources by destroying our instance
|
||||||
|
// to prevent from race conditions on system level shutdown of global resources
|
||||||
|
_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ros2
|
} // namespace ros2
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace ros2 {
|
||||||
class CarlaTransformPublisher;
|
class CarlaTransformPublisher;
|
||||||
class CarlaClockPublisher;
|
class CarlaClockPublisher;
|
||||||
class CarlaEgoVehicleControlSubscriber;
|
class CarlaEgoVehicleControlSubscriber;
|
||||||
|
class DdsDomainParticipantImpl;
|
||||||
|
|
||||||
class ROS2
|
class ROS2
|
||||||
{
|
{
|
||||||
|
@ -54,6 +55,8 @@ class ROS2
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<DdsDomainParticipantImpl> GetDdsDomainParticipant();
|
||||||
|
|
||||||
// general
|
// general
|
||||||
void Enable(bool enable);
|
void Enable(bool enable);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
@ -148,6 +151,7 @@ void ProcessDataFromCollisionSensor(
|
||||||
ROS2() {};
|
ROS2() {};
|
||||||
|
|
||||||
static std::shared_ptr<ROS2> _instance;
|
static std::shared_ptr<ROS2> _instance;
|
||||||
|
std::shared_ptr<DdsDomainParticipantImpl> _domain_participant_impl;
|
||||||
|
|
||||||
bool _enabled { false };
|
bool _enabled { false };
|
||||||
uint64_t _frame { 0 };
|
uint64_t _frame { 0 };
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB).
|
||||||
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
|
#include "carla/ros2/impl/DdsDomainParticipantImpl.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
||||||
|
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
||||||
|
|
||||||
|
#include "carla/Logging.h"
|
||||||
|
|
||||||
|
namespace carla {
|
||||||
|
namespace ros2 {
|
||||||
|
|
||||||
|
DdsDomainParticipantImpl::DdsDomainParticipantImpl() {
|
||||||
|
_factory = eprosima::fastdds::dds::DomainParticipantFactory::get_shared_instance();
|
||||||
|
if (_factory == nullptr) {
|
||||||
|
carla::log_error("DdsDomainParticipantImpl(): Failed to acquire DomainParticipantFactory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *ros_domain_id_env = std::getenv("ROS_DOMAIN_ID");
|
||||||
|
unsigned int ros_domain_id = 0;
|
||||||
|
if ( ros_domain_id_env != nullptr ) {
|
||||||
|
try {
|
||||||
|
ros_domain_id = (unsigned int)(std::atoi(ros_domain_id_env));
|
||||||
|
} catch (...) {
|
||||||
|
ros_domain_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto pqos = eprosima::fastdds::dds::PARTICIPANT_QOS_DEFAULT;
|
||||||
|
pqos.name("carla-server");
|
||||||
|
_participant = _factory->create_participant(ros_domain_id, pqos);
|
||||||
|
if (_participant == nullptr) {
|
||||||
|
carla::log_error("DdsDomainParticipantImpl(): Failed to create DomainParticipant");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DdsDomainParticipantImpl::~DdsDomainParticipantImpl() {
|
||||||
|
carla::log_warning("DdsDomainParticipantImpl::Destructor()");
|
||||||
|
if ((_participant != nullptr) && (_factory != nullptr)) {
|
||||||
|
_factory->delete_participant(_participant);
|
||||||
|
_participant=nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ros2
|
||||||
|
} // namespace carla
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
// Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB).
|
||||||
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fastdds/dds/domain/DomainParticipant.hpp>
|
||||||
|
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
||||||
|
|
||||||
|
namespace carla {
|
||||||
|
namespace ros2 {
|
||||||
|
|
||||||
|
class DdsDomainParticipantImpl {
|
||||||
|
public:
|
||||||
|
DdsDomainParticipantImpl();
|
||||||
|
~DdsDomainParticipantImpl();
|
||||||
|
|
||||||
|
eprosima::fastdds::dds::DomainParticipant* GetDomainParticipant() {
|
||||||
|
return _participant;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eprosima::fastdds::dds::DomainParticipant* _participant{nullptr};
|
||||||
|
// keep also a copy of the factory that the underlying DDS is keeping their stuff up
|
||||||
|
std::shared_ptr<eprosima::fastdds::dds::DomainParticipantFactory> _factory;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ros2
|
||||||
|
} // namespace carla
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaClockPublisherImpl {
|
struct CarlaClockPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -44,18 +43,12 @@ namespace ros2 {
|
||||||
std::cerr << "Invalid TypeSupport" << std::endl;
|
std::cerr << "Invalid TypeSupport" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();;
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -63,7 +56,7 @@ namespace ros2 {
|
||||||
|
|
||||||
efd::TopicQos tqos = efd::TOPIC_QOS_DEFAULT;
|
efd::TopicQos tqos = efd::TOPIC_QOS_DEFAULT;
|
||||||
const std::string topic_name { "rt/clock" };
|
const std::string topic_name { "rt/clock" };
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -157,17 +150,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaClockPublisher::CarlaClockPublisher(const CarlaClockPublisher& other) {
|
CarlaClockPublisher::CarlaClockPublisher(const CarlaClockPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaCollisionPublisherImpl {
|
struct CarlaCollisionPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -46,18 +45,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,7 +62,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,17 +176,16 @@ void CarlaCollisionPublisher::SetData(int32_t seconds, uint32_t nanoseconds, uin
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaCollisionPublisher::CarlaCollisionPublisher(const CarlaCollisionPublisher& other) {
|
CarlaCollisionPublisher::CarlaCollisionPublisher(const CarlaCollisionPublisher& other) {
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaDVSCameraPublisherImpl {
|
struct CarlaDVSCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,7 +44,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -56,7 +54,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaPointCloudPublisherImpl {
|
struct CarlaPointCloudPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -85,18 +82,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -110,7 +101,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -134,18 +125,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_info->_type.register_type(_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_info->_publisher = _info->_participant->create_publisher(pubqos, nullptr);
|
_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_info->_publisher == nullptr) {
|
if (_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,7 +143,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_info->_topic = _info->_participant->create_topic(topic_name, _info->_type->getName(), tqos);
|
_info->_topic = participant->create_topic(topic_name, _info->_type->getName(), tqos);
|
||||||
if (_info->_topic == nullptr) {
|
if (_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -182,18 +166,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_point_cloud->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_point_cloud->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_point_cloud->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_point_cloud->_type.register_type(_point_cloud->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_point_cloud->_publisher = _point_cloud->_participant->create_publisher(pubqos, nullptr);
|
_point_cloud->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_point_cloud->_publisher == nullptr) {
|
if (_point_cloud->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -207,7 +184,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_point_cloud->_topic = _point_cloud->_participant->create_topic(topic_name, _point_cloud->_type->getName(), tqos);
|
_point_cloud->_topic = participant->create_topic(topic_name, _point_cloud->_type->getName(), tqos);
|
||||||
if (_point_cloud->_topic == nullptr) {
|
if (_point_cloud->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -519,17 +496,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_info)
|
if (!_info)
|
||||||
return;
|
return;
|
||||||
|
@ -538,13 +514,10 @@ namespace ros2 {
|
||||||
_info->_publisher->delete_datawriter(_info->_datawriter);
|
_info->_publisher->delete_datawriter(_info->_datawriter);
|
||||||
|
|
||||||
if (_info->_publisher)
|
if (_info->_publisher)
|
||||||
_info->_participant->delete_publisher(_info->_publisher);
|
participant->delete_publisher(_info->_publisher);
|
||||||
|
|
||||||
if (_info->_topic)
|
if (_info->_topic)
|
||||||
_info->_participant->delete_topic(_info->_topic);
|
participant->delete_topic(_info->_topic);
|
||||||
|
|
||||||
if (_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_info->_participant);
|
|
||||||
|
|
||||||
if (!_point_cloud)
|
if (!_point_cloud)
|
||||||
return;
|
return;
|
||||||
|
@ -553,13 +526,10 @@ namespace ros2 {
|
||||||
_point_cloud->_publisher->delete_datawriter(_point_cloud->_datawriter);
|
_point_cloud->_publisher->delete_datawriter(_point_cloud->_datawriter);
|
||||||
|
|
||||||
if (_point_cloud->_publisher)
|
if (_point_cloud->_publisher)
|
||||||
_point_cloud->_participant->delete_publisher(_point_cloud->_publisher);
|
participant->delete_publisher(_point_cloud->_publisher);
|
||||||
|
|
||||||
if (_point_cloud->_topic)
|
if (_point_cloud->_topic)
|
||||||
_point_cloud->_participant->delete_topic(_point_cloud->_topic);
|
participant->delete_topic(_point_cloud->_topic);
|
||||||
|
|
||||||
if (_point_cloud->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_point_cloud->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaDVSCameraPublisher::CarlaDVSCameraPublisher(const CarlaDVSCameraPublisher& other) {
|
CarlaDVSCameraPublisher::CarlaDVSCameraPublisher(const CarlaDVSCameraPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaDepthCameraPublisherImpl {
|
struct CarlaDepthCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -42,7 +41,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -72,18 +70,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,7 +89,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -121,18 +113,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -146,7 +131,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -348,17 +333,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -367,13 +351,10 @@ namespace ros2 {
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaDepthCameraPublisher::CarlaDepthCameraPublisher(const CarlaDepthCameraPublisher& other) {
|
CarlaDepthCameraPublisher::CarlaDepthCameraPublisher(const CarlaDepthCameraPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaGNSSPublisherImpl {
|
struct CarlaGNSSPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -173,17 +166,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaGNSSPublisher::CarlaGNSSPublisher(const CarlaGNSSPublisher& other) {
|
CarlaGNSSPublisher::CarlaGNSSPublisher(const CarlaGNSSPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaIMUPublisherImpl {
|
struct CarlaIMUPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -175,7 +168,7 @@ namespace ros2 {
|
||||||
geometry_msgs::msg::Quaternion orientation;
|
geometry_msgs::msg::Quaternion orientation;
|
||||||
|
|
||||||
const float rx = 0.0f; // pitch
|
const float rx = 0.0f; // pitch
|
||||||
const float ry = (M_PIf32 / 2.0f) - compass; // yaw
|
const float ry = (float(M_PI_2) / 2.0f) - compass; // yaw
|
||||||
const float rz = 0.0f; // roll
|
const float rz = 0.0f; // roll
|
||||||
|
|
||||||
const float cr = cosf(rz * 0.5f);
|
const float cr = cosf(rz * 0.5f);
|
||||||
|
@ -206,17 +199,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaIMUPublisher::CarlaIMUPublisher(const CarlaIMUPublisher& other) {
|
CarlaIMUPublisher::CarlaIMUPublisher(const CarlaIMUPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaISCameraPublisherImpl {
|
struct CarlaISCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -41,7 +40,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -70,18 +68,12 @@ namespace ros2 {
|
||||||
std::cerr << "Invalid TypeSupport" << std::endl;
|
std::cerr << "Invalid TypeSupport" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,7 +87,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -119,18 +111,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,7 +129,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -347,17 +332,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -366,13 +350,10 @@ namespace ros2 {
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaISCameraPublisher::CarlaISCameraPublisher(const CarlaISCameraPublisher& other) {
|
CarlaISCameraPublisher::CarlaISCameraPublisher(const CarlaISCameraPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaLidarPublisherImpl {
|
struct CarlaLidarPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -214,17 +207,16 @@ void CarlaLidarPublisher::SetData(int32_t seconds, uint32_t nanoseconds, size_t
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaLidarPublisher::CarlaLidarPublisher(const CarlaLidarPublisher& other) {
|
CarlaLidarPublisher::CarlaLidarPublisher(const CarlaLidarPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaLineInvasionPublisherImpl {
|
struct CarlaLineInvasionPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -171,17 +164,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaLineInvasionPublisher::CarlaLineInvasionPublisher(const CarlaLineInvasionPublisher& other) {
|
CarlaLineInvasionPublisher::CarlaLineInvasionPublisher(const CarlaLineInvasionPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaMapSensorPublisherImpl {
|
struct CarlaMapSensorPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -162,17 +155,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaMapSensorPublisher::CarlaMapSensorPublisher(const CarlaMapSensorPublisher& other) {
|
CarlaMapSensorPublisher::CarlaMapSensorPublisher(const CarlaMapSensorPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaNormalsCameraPublisherImpl {
|
struct CarlaNormalsCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -42,7 +41,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -72,18 +70,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,7 +89,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -121,18 +113,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -146,7 +131,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -348,17 +333,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -367,13 +351,10 @@ namespace ros2 {
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaNormalsCameraPublisher::CarlaNormalsCameraPublisher(const CarlaNormalsCameraPublisher& other) {
|
CarlaNormalsCameraPublisher::CarlaNormalsCameraPublisher(const CarlaNormalsCameraPublisher& other) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ namespace ros2 {
|
||||||
namespace efd = eprosima::fastdds::dds;
|
namespace efd = eprosima::fastdds::dds;
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
struct CarlaOpticalFlowCameraPublisherImpl {
|
struct CarlaOpticalFlowCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -46,7 +45,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -76,18 +74,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -101,7 +93,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,18 +117,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,7 +135,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -430,17 +415,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -449,13 +433,10 @@ namespace ros2 {
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaOpticalFlowCameraPublisher::CarlaOpticalFlowCameraPublisher(const CarlaOpticalFlowCameraPublisher& other) {
|
CarlaOpticalFlowCameraPublisher::CarlaOpticalFlowCameraPublisher(const CarlaOpticalFlowCameraPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaRGBCameraPublisherImpl {
|
struct CarlaRGBCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -42,7 +41,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -72,18 +70,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,7 +89,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -121,18 +113,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -146,7 +131,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -350,17 +335,16 @@ void CarlaRGBCameraPublisher::SetImageData(int32_t seconds, uint32_t nanoseconds
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -369,13 +353,10 @@ void CarlaRGBCameraPublisher::SetImageData(int32_t seconds, uint32_t nanoseconds
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaRGBCameraPublisher::CarlaRGBCameraPublisher(const CarlaRGBCameraPublisher& other) {
|
CarlaRGBCameraPublisher::CarlaRGBCameraPublisher(const CarlaRGBCameraPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaRadarPublisherImpl {
|
struct CarlaRadarPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -54,18 +53,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,7 +70,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -241,17 +234,16 @@ void CarlaRadarPublisher::SetData(int32_t seconds, uint32_t nanoseconds, size_t
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaRadarPublisher::CarlaRadarPublisher(const CarlaRadarPublisher& other) {
|
CarlaRadarPublisher::CarlaRadarPublisher(const CarlaRadarPublisher& other) {
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaSSCameraPublisherImpl {
|
struct CarlaSSCameraPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -41,7 +40,6 @@ namespace ros2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CarlaCameraInfoPublisherImpl {
|
struct CarlaCameraInfoPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -70,18 +68,12 @@ namespace ros2 {
|
||||||
std::cerr << "Invalid TypeSupport" << std::endl;
|
std::cerr << "Invalid TypeSupport" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,7 +87,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -119,18 +111,11 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
_impl_info->_type.register_type(participant);
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
|
||||||
_impl_info->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl_info->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl_info->_type.register_type(_impl_info->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl_info->_publisher = _impl_info->_participant->create_publisher(pubqos, nullptr);
|
_impl_info->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl_info->_publisher == nullptr) {
|
if (_impl_info->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,7 +129,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl_info->_topic = _impl_info->_participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
_impl_info->_topic = participant->create_topic(topic_name, _impl_info->_type->getName(), tqos);
|
||||||
if (_impl_info->_topic == nullptr) {
|
if (_impl_info->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -347,17 +332,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
|
|
||||||
if (!_impl_info)
|
if (!_impl_info)
|
||||||
return;
|
return;
|
||||||
|
@ -366,13 +350,10 @@ namespace ros2 {
|
||||||
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
_impl_info->_publisher->delete_datawriter(_impl_info->_datawriter);
|
||||||
|
|
||||||
if (_impl_info->_publisher)
|
if (_impl_info->_publisher)
|
||||||
_impl_info->_participant->delete_publisher(_impl_info->_publisher);
|
participant->delete_publisher(_impl_info->_publisher);
|
||||||
|
|
||||||
if (_impl_info->_topic)
|
if (_impl_info->_topic)
|
||||||
_impl_info->_participant->delete_topic(_impl_info->_topic);
|
participant->delete_topic(_impl_info->_topic);
|
||||||
|
|
||||||
if (_impl_info->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl_info->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaSSCameraPublisher::CarlaSSCameraPublisher(const CarlaSSCameraPublisher& other) {
|
CarlaSSCameraPublisher::CarlaSSCameraPublisher(const CarlaSSCameraPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaSemanticLidarPublisherImpl {
|
struct CarlaSemanticLidarPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -45,18 +44,12 @@ namespace ros2 {
|
||||||
std::cerr << "Invalid TypeSupport" << std::endl;
|
std::cerr << "Invalid TypeSupport" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +61,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -224,17 +217,16 @@ void CarlaSemanticLidarPublisher::SetData(int32_t seconds, uint32_t nanoseconds,
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaSemanticLidarPublisher::CarlaSemanticLidarPublisher(const CarlaSemanticLidarPublisher& other) {
|
CarlaSemanticLidarPublisher::CarlaSemanticLidarPublisher(const CarlaSemanticLidarPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaSpeedometerSensorImpl {
|
struct CarlaSpeedometerSensorImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -44,18 +43,12 @@ namespace ros2 {
|
||||||
std::cerr << "Invalid TypeSupport" << std::endl;
|
std::cerr << "Invalid TypeSupport" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -67,7 +60,7 @@ namespace ros2 {
|
||||||
if (!_parent.empty())
|
if (!_parent.empty())
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -161,17 +154,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaSpeedometerSensor::CarlaSpeedometerSensor(const CarlaSpeedometerSensor& other) {
|
CarlaSpeedometerSensor::CarlaSpeedometerSensor(const CarlaSpeedometerSensor& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/publisher/DataWriter.hpp>
|
#include <fastdds/dds/publisher/DataWriter.hpp>
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaTransformPublisherImpl {
|
struct CarlaTransformPublisherImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Publisher* _publisher { nullptr };
|
efd::Publisher* _publisher { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataWriter* _datawriter { nullptr };
|
efd::DataWriter* _datawriter { nullptr };
|
||||||
|
@ -50,18 +49,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
efd::PublisherQos pubqos = efd::PUBLISHER_QOS_DEFAULT;
|
||||||
_impl->_publisher = _impl->_participant->create_publisher(pubqos, nullptr);
|
_impl->_publisher = participant->create_publisher(pubqos, nullptr);
|
||||||
if (_impl->_publisher == nullptr) {
|
if (_impl->_publisher == nullptr) {
|
||||||
std::cerr << "Failed to create Publisher" << std::endl;
|
std::cerr << "Failed to create Publisher" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,7 +62,7 @@ namespace ros2 {
|
||||||
|
|
||||||
efd::TopicQos tqos = efd::TOPIC_QOS_DEFAULT;
|
efd::TopicQos tqos = efd::TOPIC_QOS_DEFAULT;
|
||||||
const std::string topic_name { "rt/tf" };
|
const std::string topic_name { "rt/tf" };
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -161,9 +154,9 @@ namespace ros2 {
|
||||||
const float ty = *translation++;
|
const float ty = *translation++;
|
||||||
const float tz = *translation++;
|
const float tz = *translation++;
|
||||||
|
|
||||||
const float rx = ((*rotation++) * -1.0f) * (M_PIf32 / 180.0f);
|
const float rx = ((*rotation++) * -1.0f) * (float(M_PI_2) / 180.0f);
|
||||||
const float ry = ((*rotation++) * -1.0f) * (M_PIf32 / 180.0f);
|
const float ry = ((*rotation++) * -1.0f) * (float(M_PI_2) / 180.0f);
|
||||||
const float rz = *rotation++ * (M_PIf32 / 180.0f);
|
const float rz = *rotation++ * (float(M_PI_2) / 180.0f);
|
||||||
|
|
||||||
const float cr = cosf(rz * 0.5f);
|
const float cr = cosf(rz * 0.5f);
|
||||||
const float sr = sinf(rz * 0.5f);
|
const float sr = sinf(rz * 0.5f);
|
||||||
|
@ -211,17 +204,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datawriter)
|
if (_impl->_datawriter)
|
||||||
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
_impl->_publisher->delete_datawriter(_impl->_datawriter);
|
||||||
|
|
||||||
if (_impl->_publisher)
|
if (_impl->_publisher)
|
||||||
_impl->_participant->delete_publisher(_impl->_publisher);
|
participant->delete_publisher(_impl->_publisher);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaTransformPublisher::CarlaTransformPublisher(const CarlaTransformPublisher& other) {
|
CarlaTransformPublisher::CarlaTransformPublisher(const CarlaTransformPublisher& other) {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <fastdds/dds/topic/TypeSupport.hpp>
|
#include <fastdds/dds/topic/TypeSupport.hpp>
|
||||||
#include <fastdds/dds/subscriber/SampleInfo.hpp>
|
#include <fastdds/dds/subscriber/SampleInfo.hpp>
|
||||||
|
|
||||||
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
|
#include <carla/ros2/ROS2.h>
|
||||||
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
|
#include <carla/ros2/impl/DdsDomainParticipantImpl.h>
|
||||||
#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
|
#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
|
||||||
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
#include <fastdds/dds/topic/qos/TopicQos.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace ros2 {
|
||||||
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
using erc = eprosima::fastrtps::types::ReturnCode_t;
|
||||||
|
|
||||||
struct CarlaEgoVehicleControlSubscriberImpl {
|
struct CarlaEgoVehicleControlSubscriberImpl {
|
||||||
efd::DomainParticipant* _participant { nullptr };
|
|
||||||
efd::Subscriber* _subscriber { nullptr };
|
efd::Subscriber* _subscriber { nullptr };
|
||||||
efd::Topic* _topic { nullptr };
|
efd::Topic* _topic { nullptr };
|
||||||
efd::DataReader* _datareader { nullptr };
|
efd::DataReader* _datareader { nullptr };
|
||||||
|
@ -50,18 +49,12 @@ namespace ros2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
pqos.name(_name);
|
|
||||||
auto factory = efd::DomainParticipantFactory::get_instance();
|
_impl->_type.register_type(participant);
|
||||||
_impl->_participant = factory->create_participant(0, pqos);
|
|
||||||
if (_impl->_participant == nullptr) {
|
|
||||||
std::cerr << "Failed to create DomainParticipant" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_impl->_type.register_type(_impl->_participant);
|
|
||||||
|
|
||||||
efd::SubscriberQos subqos = efd::SUBSCRIBER_QOS_DEFAULT;
|
efd::SubscriberQos subqos = efd::SUBSCRIBER_QOS_DEFAULT;
|
||||||
_impl->_subscriber = _impl->_participant->create_subscriber(subqos, nullptr);
|
_impl->_subscriber = participant->create_subscriber(subqos, nullptr);
|
||||||
if (_impl->_subscriber == nullptr) {
|
if (_impl->_subscriber == nullptr) {
|
||||||
std::cerr << "Failed to create Subscriber" << std::endl;
|
std::cerr << "Failed to create Subscriber" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -75,7 +68,7 @@ namespace ros2 {
|
||||||
topic_name += _parent + "/";
|
topic_name += _parent + "/";
|
||||||
topic_name += _name;
|
topic_name += _name;
|
||||||
topic_name += publisher_type;
|
topic_name += publisher_type;
|
||||||
_impl->_topic = _impl->_participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
_impl->_topic = participant->create_topic(topic_name, _impl->_type->getName(), tqos);
|
||||||
if (_impl->_topic == nullptr) {
|
if (_impl->_topic == nullptr) {
|
||||||
std::cerr << "Failed to create Topic" << std::endl;
|
std::cerr << "Failed to create Topic" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -191,17 +184,16 @@ namespace ros2 {
|
||||||
if (!_impl)
|
if (!_impl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto participant = ROS2::GetDdsDomainParticipant()->GetDomainParticipant();
|
||||||
if (_impl->_datareader)
|
if (_impl->_datareader)
|
||||||
_impl->_subscriber->delete_datareader(_impl->_datareader);
|
_impl->_subscriber->delete_datareader(_impl->_datareader);
|
||||||
|
|
||||||
if (_impl->_subscriber)
|
if (_impl->_subscriber)
|
||||||
_impl->_participant->delete_subscriber(_impl->_subscriber);
|
participant->delete_subscriber(_impl->_subscriber);
|
||||||
|
|
||||||
if (_impl->_topic)
|
if (_impl->_topic)
|
||||||
_impl->_participant->delete_topic(_impl->_topic);
|
participant->delete_topic(_impl->_topic);
|
||||||
|
|
||||||
if (_impl->_participant)
|
|
||||||
efd::DomainParticipantFactory::get_instance()->delete_participant(_impl->_participant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CarlaEgoVehicleControlSubscriber::CarlaEgoVehicleControlSubscriber(const CarlaEgoVehicleControlSubscriber& other) {
|
CarlaEgoVehicleControlSubscriber::CarlaEgoVehicleControlSubscriber(const CarlaEgoVehicleControlSubscriber& other) {
|
||||||
|
|
|
@ -57,14 +57,14 @@ EgoDynamicsOnRoute::EgoDynamicsOnRoute()
|
||||||
time_since_epoch_check_end_ms(0.),
|
time_since_epoch_check_end_ms(0.),
|
||||||
ego_speed(0.),
|
ego_speed(0.),
|
||||||
min_stopping_distance(0.),
|
min_stopping_distance(0.),
|
||||||
ego_center({0., 0., 0.}),
|
ego_center(),
|
||||||
ego_heading(0.),
|
ego_heading(0.),
|
||||||
ego_heading_change(0.),
|
ego_heading_change(0.),
|
||||||
ego_steering_angle(0.),
|
ego_steering_angle(0.),
|
||||||
ego_center_within_route(false),
|
ego_center_within_route(false),
|
||||||
crossing_border(false),
|
crossing_border(false),
|
||||||
route_heading(0.),
|
route_heading(0.),
|
||||||
route_nominal_center({0., 0., 0.}),
|
route_nominal_center(),
|
||||||
heading_diff(0.),
|
heading_diff(0.),
|
||||||
route_speed_lat(0.),
|
route_speed_lat(0.),
|
||||||
route_speed_lon(0.),
|
route_speed_lon(0.),
|
||||||
|
@ -73,6 +73,12 @@ EgoDynamicsOnRoute::EgoDynamicsOnRoute()
|
||||||
avg_route_accel_lat(0.),
|
avg_route_accel_lat(0.),
|
||||||
avg_route_accel_lon(0.) {
|
avg_route_accel_lon(0.) {
|
||||||
timestamp.elapsed_seconds = 0.;
|
timestamp.elapsed_seconds = 0.;
|
||||||
|
ego_center.x = 0.;
|
||||||
|
ego_center.y = 0.;
|
||||||
|
ego_center.z = 0.,
|
||||||
|
route_nominal_center.x = 0.;
|
||||||
|
route_nominal_center.y = 0.;
|
||||||
|
route_nominal_center.z = 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<spdlog::logger> getLogger() {
|
std::shared_ptr<spdlog::logger> getLogger() {
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
template <typename ViewT, typename PixelT>
|
template <typename ViewT, typename PixelT>
|
||||||
struct TestImage {
|
struct TestImage {
|
||||||
TestImage(TestImage &&) = default;
|
|
||||||
using pixel_type = PixelT;
|
using pixel_type = PixelT;
|
||||||
std::unique_ptr<PixelT[]> data;
|
std::unique_ptr<PixelT[]> data;
|
||||||
ViewT view;
|
ViewT view;
|
||||||
|
@ -28,7 +27,7 @@ static auto MakeTestImage(size_t width, size_t height) {
|
||||||
height,
|
height,
|
||||||
reinterpret_cast<PixelT*>(data.get()),
|
reinterpret_cast<PixelT*>(data.get()),
|
||||||
static_cast<long>(sizeof(PixelT) * width));
|
static_cast<long>(sizeof(PixelT) * width));
|
||||||
return TestImage<decltype(view), PixelT>{std::move(data), view};
|
return TestImage<decltype(view), PixelT>{.data = std::move(data), .view = view};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PLATFORM_WINDOWS
|
#ifndef PLATFORM_WINDOWS
|
||||||
|
|
|
@ -4,25 +4,17 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class Carla : ModuleRules
|
|
||||||
|
public class Carla : CarlaRules
|
||||||
{
|
{
|
||||||
bool UsingCarSim = false;
|
bool UsingCarSim = false;
|
||||||
bool UsingChrono = false;
|
bool UsingChrono = false;
|
||||||
bool UsingPytorch = false;
|
bool UsingPytorch = false;
|
||||||
bool UsingRos2 = false;
|
public Carla(ReadOnlyTargetRules Target) : base(Target, "../../CarlaDependencies")
|
||||||
private bool IsWindows(ReadOnlyTargetRules Target)
|
|
||||||
{
|
|
||||||
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Carla(ReadOnlyTargetRules Target) : base(Target)
|
|
||||||
{
|
{
|
||||||
PrivatePCHHeaderFile = "Carla.h";
|
PrivatePCHHeaderFile = "Carla.h";
|
||||||
|
bEnableExceptions = true;
|
||||||
if (IsWindows(Target))
|
CppStandard = CppStandardVersion.Cpp20;
|
||||||
{
|
|
||||||
bEnableExceptions = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read config about carsim
|
// Read config about carsim
|
||||||
string CarlaPluginPath = Path.GetFullPath( ModuleDirectory );
|
string CarlaPluginPath = Path.GetFullPath( ModuleDirectory );
|
||||||
|
@ -57,8 +49,12 @@ public class Carla : ModuleRules
|
||||||
{
|
{
|
||||||
Console.WriteLine("Enabling ros2");
|
Console.WriteLine("Enabling ros2");
|
||||||
UsingRos2 = true;
|
UsingRos2 = true;
|
||||||
PublicDefinitions.Add("WITH_ROS2");
|
}
|
||||||
PrivateDefinitions.Add("WITH_ROS2");
|
|
||||||
|
if (line.Contains("Debug ON"))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Enabling debug build");
|
||||||
|
Debug = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +87,10 @@ public class Carla : ModuleRules
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "CarSim" });
|
PublicDependencyModuleNames.AddRange(new string[] { "CarSim" });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Target.Type == TargetType.Editor)
|
if (Target.Type == TargetType.Editor)
|
||||||
{
|
{
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
|
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(
|
PrivateDependencyModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
|
@ -118,229 +114,143 @@ public class Carla : ModuleRules
|
||||||
"PhysicsCore"
|
"PhysicsCore"
|
||||||
// ... add private dependencies that you statically link with here ...
|
// ... add private dependencies that you statically link with here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (UsingCarSim)
|
if (UsingCarSim)
|
||||||
{
|
{
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { "CarSim" });
|
PrivateDependencyModuleNames.AddRange(new string[] { "CarSim" });
|
||||||
PrivateIncludePathModuleNames.AddRange(new string[] { "CarSim" });
|
PrivateIncludePathModuleNames.AddRange(new string[] { "CarSim" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DynamicallyLoadedModuleNames.AddRange(
|
DynamicallyLoadedModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
// ... add any modules that your module loads dynamically here ...
|
// ... add any modules that your module loads dynamically here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
AddCarlaServerDependency(Target);
|
AddCarlaServerDependency();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UseDebugLibs(ReadOnlyTargetRules Target)
|
private void AddCarlaServerDependency()
|
||||||
{
|
{
|
||||||
if (IsWindows(Target))
|
|
||||||
|
// Link dependencies.
|
||||||
|
AddStaticLibrary( "rpc");
|
||||||
|
if (UseDebugLibs())
|
||||||
{
|
{
|
||||||
// In Windows, Unreal uses the Release C++ Runtime (CRT) even in debug
|
AddStaticLibrary("carla_server_debug");
|
||||||
// mode, so unless we recompile the engine we cannot link the debug
|
|
||||||
// libraries.
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
AddStaticLibrary("carla_server");
|
||||||
}
|
}
|
||||||
}
|
if (IsWindows())
|
||||||
|
|
||||||
private void AddDynamicLibrary(string library)
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(library);
|
|
||||||
RuntimeDependencies.Add(library);
|
|
||||||
PublicDelayLoadDLLs.Add(library);
|
|
||||||
}
|
|
||||||
private void AddDllDependency(string PathToFolder, string DllName)
|
|
||||||
{
|
|
||||||
string Source = Path.Combine(PathToFolder, DllName);
|
|
||||||
string Destination = Path.Combine("$(BinaryOutputDir)", DllName);
|
|
||||||
RuntimeDependencies.Add(Destination, Source);
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate string ADelegate(string s);
|
|
||||||
|
|
||||||
private void AddBoostLibs(string LibPath)
|
|
||||||
{
|
|
||||||
string [] files = Directory.GetFiles(LibPath, "*boost*.lib");
|
|
||||||
foreach (string file in files) PublicAdditionalLibraries.Add(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
|
|
||||||
{
|
|
||||||
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies"));
|
|
||||||
|
|
||||||
ADelegate GetLibName = (string BaseName) => {
|
|
||||||
if (IsWindows(Target))
|
|
||||||
{
|
|
||||||
return BaseName + ".lib";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "lib" + BaseName + ".a";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Link dependencies.
|
|
||||||
if (IsWindows(Target))
|
|
||||||
{
|
{
|
||||||
AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib"));
|
PublicAdditionalLibraries.Add("shlwapi.lib");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
|
|
||||||
|
|
||||||
if (UseDebugLibs(Target))
|
AddBoostLibs();
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
|
|
||||||
}
|
|
||||||
if (UsingChrono)
|
if (UsingChrono)
|
||||||
{
|
{
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine")));
|
AddStaticLibrary("ChronoEngine");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine_vehicle")));
|
AddStaticLibrary("ChronoEngine_vehicle");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_vehicle")));
|
AddStaticLibrary("ChronoModels_vehicle");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_robot")));
|
AddStaticLibrary("ChronoModels_robot");
|
||||||
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine.dll");
|
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine.dll");
|
||||||
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine_vehicle.dll");
|
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine_vehicle.dll");
|
||||||
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_vehicle.dll");
|
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_vehicle.dll");
|
||||||
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_robot.dll");
|
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_robot.dll");
|
||||||
bUseRTTI = true;
|
bUseRTTI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//OsmToODR
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "sqlite3.lib"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "xerces-c_3.lib"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "proj.lib"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "osm2odr.lib"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "zlibstatic.lib"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
|
|
||||||
if (UseDebugLibs(Target))
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
|
|
||||||
}
|
|
||||||
if (UsingChrono)
|
if (UsingChrono)
|
||||||
{
|
{
|
||||||
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine.so"));
|
AddStaticLibrary( "ChronoEngine");
|
||||||
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine_vehicle.so"));
|
AddStaticLibrary( "ChronoEngine_vehicle");
|
||||||
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_vehicle.so"));
|
AddStaticLibrary( "ChronoModels_vehicle");
|
||||||
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_robot.so"));
|
AddStaticLibrary( "ChronoModels_robot");
|
||||||
|
|
||||||
bUseRTTI = true;
|
bUseRTTI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsingPytorch)
|
if (UsingPytorch)
|
||||||
{
|
{
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_pytorch")));
|
AddStaticLibrary( "carla_pytorch");
|
||||||
|
|
||||||
string LibTorchPath = LibCarlaInstallPath;
|
AddStaticLibrary("onnx_proto");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libonnx_proto.a"));
|
AddStaticLibrary("fbgemm");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfbgemm.a"));
|
AddStaticLibrary("gloo");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgloo.a"));
|
AddStaticLibrary("XNNPACK");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libXNNPACK.a"));
|
AddStaticLibrary("protobuf-lite");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotobuf-lite.a"));
|
AddStaticLibrary("protobuf");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotobuf.a"));
|
AddStaticLibrary("asmjit");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libasmjit.a"));
|
AddStaticLibrary("cpuinfo_internals");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcpuinfo_internals.a"));
|
AddStaticLibrary("clog");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libclog.a"));
|
// AddStaticLibrary("breakpad_common");
|
||||||
// PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbreakpad_common.a"));
|
AddStaticLibrary("benchmark");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbenchmark.a"));
|
AddStaticLibrary("tensorpipe");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe.a"));
|
AddStaticLibrary("pytorch_qnnpack");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libpytorch_qnnpack.a"));
|
AddStaticLibrary("tensorpipe_cuda");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe_cuda.a"));
|
AddStaticLibrary("nnpack_reference_layers");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libnnpack_reference_layers.a"));
|
AddStaticLibrary("gmock");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgmock.a"));
|
AddStaticLibrary("dnnl");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libdnnl.a"));
|
AddStaticLibrary("pthreadpool");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libpthreadpool.a"));
|
AddStaticLibrary("cpuinfo");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcpuinfo.a"));
|
AddStaticLibrary("qnnpack");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libqnnpack.a"));
|
// AddStaticLibrary("breakpad"));
|
||||||
// PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbreakpad.a"));
|
AddStaticLibrary("kineto");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libkineto.a"));
|
AddStaticLibrary("protoc");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotoc.a"));
|
AddStaticLibrary("gtest");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgtest.a"));
|
AddStaticLibrary("gmock_main");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgmock_main.a"));
|
AddStaticLibrary("gtest_main");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgtest_main.a"));
|
AddStaticLibrary("benchmark_main");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbenchmark_main.a"));
|
AddStaticLibrary("fmt");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfmt.a"));
|
AddStaticLibrary("tensorpipe_uv");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe_uv.a"));
|
AddStaticLibrary("foxi_loader");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfoxi_loader.a"));
|
AddStaticLibrary("gloo_cuda");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgloo_cuda.a"));
|
AddStaticLibrary("nnpack");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libnnpack.a"));
|
AddStaticLibrary("caffe2_protos");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcaffe2_protos.a"));
|
AddStaticLibrary("onnx");
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libonnx.a"));
|
AddDynamicLibrary("torch");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch.so"));
|
AddDynamicLibrary("nnapi_backend");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libnnapi_backend.so"));
|
AddDynamicLibrary("backend_with_compiler");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libbackend_with_compiler.so"));
|
AddDynamicLibrary("caffe2_nvrtc");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libcaffe2_nvrtc.so"));
|
AddDynamicLibrary("torch_cuda_cpp");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda_cpp.so"));
|
AddDynamicLibrary("c10_cuda");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libc10_cuda.so"));
|
AddDynamicLibrary("torchbind_test");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchbind_test.so"));
|
AddDynamicLibrary("jitbackend_test");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libjitbackend_test.so"));
|
AddDynamicLibrary("c10");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libc10.so"));
|
AddDynamicLibrary("torch_cuda");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda.so"));
|
AddDynamicLibrary("torch_global_deps");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_global_deps.so"));
|
AddDynamicLibrary("torch_cpu");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cpu.so"));
|
AddDynamicLibrary("shm");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libshm.so"));
|
AddDynamicLibrary("torch_cuda_cu");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda_cu.so"));
|
AddDynamicLibrary("torchscatter");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchscatter.so"));
|
AddDynamicLibrary("torchcluster");
|
||||||
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchcluster.so"));
|
AddDynamicLibrary("cuda", "/usr/local/cuda/lib64/stubs");
|
||||||
// AddDynamicLibrary("/usr/local/cuda/lib64/stubs/libcuda.so");
|
AddDynamicLibrary("nvrtc", "/usr/local/cuda/lib64");
|
||||||
// AddDynamicLibrary("/usr/local/cuda/lib64/libnvrtc.so");
|
AddDynamicLibrary("nvToolsExt", "/usr/local/cuda/lib64");
|
||||||
// AddDynamicLibrary("/usr/local/cuda/lib64/libnvToolsExt.so");
|
AddDynamicLibrary("cudart", "/usr/local/cuda/lib64");
|
||||||
// AddDynamicLibrary("/usr/local/cuda/lib64/libcudart.so");
|
AddDynamicLibrary("gomp", "/usr/lib/llvm-10/lib");
|
||||||
// AddDynamicLibrary("/usr/lib/llvm-10/lib/libgomp.so");
|
RuntimeDependencies.Add(Path.Combine("libcudart-a7b20f20.so.11.0"));
|
||||||
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/stubs/libcuda.so");
|
RuntimeDependencies.Add(Path.Combine("libgomp-a34b3233.so.1"));
|
||||||
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libnvrtc.so");
|
RuntimeDependencies.Add(Path.Combine("libnvrtc-builtins-4730a239.so.11.3"));
|
||||||
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libnvToolsExt.so");
|
RuntimeDependencies.Add(Path.Combine("libnvrtc-1ea278b5.so.11.2"));
|
||||||
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libcudart.so");
|
RuntimeDependencies.Add(Path.Combine("libnvToolsExt-24de1d56.so.1"));
|
||||||
PublicAdditionalLibraries.Add("/usr/lib/llvm-10/lib/libgomp.so");
|
|
||||||
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libcudart-a7b20f20.so.11.0"));
|
|
||||||
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libgomp-a34b3233.so.1"));
|
|
||||||
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvrtc-builtins-4730a239.so.11.3"));
|
|
||||||
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvrtc-1ea278b5.so.11.2"));
|
|
||||||
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvToolsExt-24de1d56.so.1"));
|
|
||||||
PublicAdditionalLibraries.Add("stdc++");
|
PublicAdditionalLibraries.Add("stdc++");
|
||||||
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libpython3.9.so");
|
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libpython3.9.so");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsingRos2)
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_fastdds")));
|
|
||||||
|
|
||||||
string LibFastDDSPath = LibCarlaInstallPath;
|
|
||||||
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfoonathan_memory-0.7.3.so"));
|
|
||||||
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfastcdr.so"));
|
|
||||||
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfastrtps.so"));
|
|
||||||
PublicAdditionalLibraries.Add("stdc++");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//OsmToODR
|
|
||||||
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libc.so");
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libsqlite3.so"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libxerces-c.a"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libproj.a"));
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libosm2odr.a"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
bEnableExceptions = true;
|
|
||||||
|
addOsmToODR();
|
||||||
|
|
||||||
|
addROS2();
|
||||||
|
|
||||||
|
|
||||||
// Include path.
|
// Include path.
|
||||||
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
|
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
|
||||||
|
|
||||||
PublicIncludePaths.Add(LibCarlaIncludePath);
|
PublicIncludePaths.Add(LibCarlaIncludePath);
|
||||||
PrivateIncludePaths.Add(LibCarlaIncludePath);
|
PrivateIncludePaths.Add(LibCarlaIncludePath);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using UnrealBuildTool;
|
||||||
|
|
||||||
|
public class CarlaRules : ModuleRules
|
||||||
|
{
|
||||||
|
protected string LibCarlaInstallPath;
|
||||||
|
protected bool UsingRos2 = false;
|
||||||
|
protected bool Debug = false;
|
||||||
|
|
||||||
|
public CarlaRules(ReadOnlyTargetRules Target, string LibCarlaInstallPathRelativeToModule) : base(Target)
|
||||||
|
{
|
||||||
|
LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, LibCarlaInstallPathRelativeToModule));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IsWindows()
|
||||||
|
{
|
||||||
|
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IsLinux()
|
||||||
|
{
|
||||||
|
return (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.LinuxAArch64);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IsMac()
|
||||||
|
{
|
||||||
|
return (Target.Platform == UnrealTargetPlatform.Mac);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool UseDebugLibs()
|
||||||
|
{
|
||||||
|
if (IsWindows())
|
||||||
|
{
|
||||||
|
// In Windows, Unreal uses the Release C++ Runtime (CRT) even in debug
|
||||||
|
// mode, so unless we recompile the engine we cannot link the debug
|
||||||
|
// libraries.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Debug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AddDllDependency(string PathToFolder, string DllName)
|
||||||
|
{
|
||||||
|
string Source = Path.Combine(PathToFolder, DllName);
|
||||||
|
string Destination = Path.Combine("$(BinaryOutputDir)", DllName);
|
||||||
|
RuntimeDependencies.Add(Destination, Source);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AddBoostLibs()
|
||||||
|
{
|
||||||
|
string [] files = Directory.GetFiles(Path.Combine(LibCarlaInstallPath, "lib"), "*boost*.lib");
|
||||||
|
foreach (string file in files) PublicAdditionalLibraries.Add(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AddStaticLibrary(string LibBaseName, string LinkBasePath = "", string LibPrefix = "", string LibPostfix = "") {
|
||||||
|
string linkBasePath = LinkBasePath;
|
||||||
|
if ( linkBasePath == "" )
|
||||||
|
{
|
||||||
|
linkBasePath = Path.GetFullPath(Path.Combine(LibCarlaInstallPath, "lib"));
|
||||||
|
}
|
||||||
|
|
||||||
|
string libPrefix = LibPrefix;
|
||||||
|
if ( libPrefix == "" )
|
||||||
|
{
|
||||||
|
if (IsWindows())
|
||||||
|
{
|
||||||
|
libPrefix = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
libPrefix = "lib";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string libPostfix = LibPostfix;
|
||||||
|
if ( libPostfix == "" )
|
||||||
|
{
|
||||||
|
if (IsWindows())
|
||||||
|
{
|
||||||
|
libPostfix = ".lib";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
libPostfix = ".a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string linkLibrary= Path.Combine(linkBasePath, libPrefix + LibBaseName + libPostfix);
|
||||||
|
PublicAdditionalLibraries.Add(linkLibrary);
|
||||||
|
}
|
||||||
|
protected void AddDynamicLibrary(string LibBaseName, string LinkBasePath = "", string LibPrefix = "", string LibPostfix = "")
|
||||||
|
{
|
||||||
|
string linkBasePath = LinkBasePath;
|
||||||
|
if ( linkBasePath == "" )
|
||||||
|
{
|
||||||
|
linkBasePath = Path.GetFullPath(Path.Combine(LibCarlaInstallPath, "lib"));
|
||||||
|
}
|
||||||
|
|
||||||
|
string libPrefix;
|
||||||
|
if (IsWindows())
|
||||||
|
{
|
||||||
|
libPrefix = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
libPrefix = "lib";
|
||||||
|
}
|
||||||
|
if ( LibPrefix != "" )
|
||||||
|
{
|
||||||
|
libPrefix = LibPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
string libPostfix;
|
||||||
|
if (IsWindows())
|
||||||
|
{
|
||||||
|
libPostfix = ".dll";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
libPostfix = ".so";
|
||||||
|
}
|
||||||
|
if (LibPostfix != "")
|
||||||
|
{
|
||||||
|
libPostfix = LibPostfix;
|
||||||
|
}
|
||||||
|
|
||||||
|
string linkLibrary= Path.Combine(linkBasePath, libPrefix + LibBaseName + libPostfix);
|
||||||
|
PublicAdditionalLibraries.Add(linkLibrary);
|
||||||
|
RuntimeDependencies.Add(linkLibrary);
|
||||||
|
if ( IsWindows() )
|
||||||
|
{
|
||||||
|
PublicDelayLoadDLLs.Add(linkLibrary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addOsmToODR()
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "sqlite3");
|
||||||
|
AddStaticLibrary( "proj");
|
||||||
|
AddStaticLibrary( "osm2odr");
|
||||||
|
if ( IsWindows() )
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "xerces-c_3");
|
||||||
|
AddStaticLibrary( "zlibstatic");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "xerces-c");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addROS2()
|
||||||
|
{
|
||||||
|
if (UsingRos2)
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "foonathan_memory-0.7.3");
|
||||||
|
if ( IsWindows() )
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "libfastcdr-1.1");
|
||||||
|
AddStaticLibrary( "libfastrtps-2.11");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddStaticLibrary( "fastcdr");
|
||||||
|
AddStaticLibrary( "fastrtps");
|
||||||
|
}
|
||||||
|
PublicIncludePaths.Add(Path.Combine(LibCarlaInstallPath, "include", "carla", "ros2", "ros_types"));
|
||||||
|
PrivateIncludePaths.Add(Path.Combine(LibCarlaInstallPath, "include", "carla", "ros2", "ros_types"));
|
||||||
|
PublicDefinitions.Add("WITH_ROS2");
|
||||||
|
PrivateDefinitions.Add("WITH_ROS2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,21 +4,17 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class CarlaTools : ModuleRules
|
public class CarlaTools : CarlaRules
|
||||||
{
|
{
|
||||||
bool bUsingOmniverseConnector = false;
|
bool bUsingOmniverseConnector = false;
|
||||||
private bool IsWindows(ReadOnlyTargetRules Target)
|
|
||||||
{
|
|
||||||
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CarlaTools(ReadOnlyTargetRules Target) : base(Target)
|
public CarlaTools(ReadOnlyTargetRules Target) : base(Target, "../../../Carla/CarlaDependencies")
|
||||||
{
|
{
|
||||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
// PrivatePCHHeaderFile = "Carla.h";
|
// PrivatePCHHeaderFile = "Carla.h";
|
||||||
|
|
||||||
if (IsWindows(Target))
|
if (IsWindows())
|
||||||
{
|
{
|
||||||
bEnableExceptions = true;
|
bEnableExceptions = true;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +32,13 @@ public class CarlaTools : ModuleRules
|
||||||
PublicDefinitions.Add("WITH_OMNIVERSE");
|
PublicDefinitions.Add("WITH_OMNIVERSE");
|
||||||
PrivateDefinitions.Add("WITH_OMNIVERSE");
|
PrivateDefinitions.Add("WITH_OMNIVERSE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (line.Contains("Ros2 ON"))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Enabling ros2");
|
||||||
|
UsingRos2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicIncludePaths.AddRange(
|
PublicIncludePaths.AddRange(
|
||||||
|
@ -112,78 +115,32 @@ public class CarlaTools : ModuleRules
|
||||||
// ... add any modules that your module loads dynamically here ...
|
// ... add any modules that your module loads dynamically here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
AddCarlaServerDependency(Target);
|
AddCarlaServerDependency();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UseDebugLibs(ReadOnlyTargetRules Target)
|
|
||||||
{
|
|
||||||
if (IsWindows(Target))
|
|
||||||
{
|
|
||||||
// In Windows, Unreal uses the Release C++ Runtime (CRT) even in debug
|
|
||||||
// mode, so unless we recompile the engine we cannot link the debug
|
|
||||||
// libraries.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate string ADelegate(string s);
|
private void AddCarlaServerDependency()
|
||||||
|
|
||||||
private void AddBoostLibs(string LibPath)
|
|
||||||
{
|
|
||||||
string [] files = Directory.GetFiles(LibPath, "*boost*.lib");
|
|
||||||
foreach (string file in files)
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
|
|
||||||
{
|
{
|
||||||
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../../Carla/CarlaDependencies"));
|
|
||||||
|
|
||||||
ADelegate GetLibName = (string BaseName) => {
|
|
||||||
if (IsWindows(Target))
|
|
||||||
{
|
|
||||||
return BaseName + ".lib";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "lib" + BaseName + ".a";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Link dependencies.
|
// Link dependencies.
|
||||||
if (IsWindows(Target))
|
if (IsWindows())
|
||||||
{
|
{
|
||||||
AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib"));
|
AddBoostLibs();
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
|
}
|
||||||
|
AddStaticLibrary("rpc");
|
||||||
if (UseDebugLibs(Target))
|
if (UseDebugLibs())
|
||||||
{
|
{
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
|
AddStaticLibrary("carla_server_debug");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
|
AddStaticLibrary("carla_server");
|
||||||
if (UseDebugLibs(Target))
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addOsmToODR();
|
||||||
|
|
||||||
|
addROS2();
|
||||||
|
|
||||||
// Include path.
|
// Include path.
|
||||||
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
|
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
|
||||||
|
|
||||||
|
@ -192,7 +149,7 @@ public class CarlaTools : ModuleRules
|
||||||
|
|
||||||
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
|
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
|
||||||
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
|
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
|
||||||
// PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
|
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
|
||||||
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
|
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
|
||||||
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
|
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
|
||||||
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
|
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
|
||||||
|
|
|
@ -22,6 +22,13 @@ done
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
source $(dirname "$0")/Environment.sh
|
source $(dirname "$0")/Environment.sh
|
||||||
|
|
||||||
|
|
||||||
|
UNREAL_SYSROOT="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu"
|
||||||
|
export CC="${UNREAL_SYSROOT}/bin/clang"
|
||||||
|
export CXX="${UNREAL_SYSROOT}/bin/clang++"
|
||||||
|
export PATH="${UNREAL_SYSROOT}/bin:$PATH"
|
||||||
|
|
||||||
|
|
||||||
# Convert comma-separated string to array of unique elements.
|
# Convert comma-separated string to array of unique elements.
|
||||||
IFS="," read -r -a PY_VERSION_LIST <<< "${PY_VERSION_LIST}"
|
IFS="," read -r -a PY_VERSION_LIST <<< "${PY_VERSION_LIST}"
|
||||||
|
|
||||||
|
@ -29,7 +36,7 @@ IFS="," read -r -a PY_VERSION_LIST <<< "${PY_VERSION_LIST}"
|
||||||
# -- Get ad-rss -------------------------------------------
|
# -- Get ad-rss -------------------------------------------
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
ADRSS_VERSION=4.4.4
|
ADRSS_VERSION=4.4.5
|
||||||
ADRSS_BASENAME=ad-rss-${ADRSS_VERSION}
|
ADRSS_BASENAME=ad-rss-${ADRSS_VERSION}
|
||||||
ADRSS_COLCON_WORKSPACE="${CARLA_BUILD_FOLDER}/${ADRSS_BASENAME}"
|
ADRSS_COLCON_WORKSPACE="${CARLA_BUILD_FOLDER}/${ADRSS_BASENAME}"
|
||||||
ADRSS_SRC_DIR="${ADRSS_COLCON_WORKSPACE}/src"
|
ADRSS_SRC_DIR="${ADRSS_COLCON_WORKSPACE}/src"
|
||||||
|
@ -42,11 +49,8 @@ if [[ ! -d "${ADRSS_SRC_DIR}" ]]; then
|
||||||
|
|
||||||
# clone ad-rss with all submodules, but remove proj, as CARLA already uses it
|
# clone ad-rss with all submodules, but remove proj, as CARLA already uses it
|
||||||
pushd "${ADRSS_SRC_DIR}" >/dev/null
|
pushd "${ADRSS_SRC_DIR}" >/dev/null
|
||||||
git clone -b v${ADRSS_VERSION} https://github.com/intel/ad-rss-lib.git && cd ad-rss-lib && git submodule update --init --recursive && rm -rf dependencies/map/dependencies/PROJ4 && cd ..
|
git clone -b v${ADRSS_VERSION} https://github.com/intel/ad-rss-lib.git && cd ad-rss-lib && git submodule update --init --recursive && cd ..
|
||||||
|
|
||||||
# ADRSS_VERSION is designed for older boost, update datatype from boost::array to std::array
|
|
||||||
grep -rl "boost::array" | xargs sed -i 's/boost::array/std::array/g'
|
|
||||||
grep -rl "find_package(Boost" | xargs sed -i 's/find_package(Boost/find_package(Boost 1.80/g'
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
cat >"${ADRSS_COLCON_WORKSPACE}/colcon.meta" <<EOL
|
cat >"${ADRSS_COLCON_WORKSPACE}/colcon.meta" <<EOL
|
||||||
|
@ -91,8 +95,6 @@ ADRSS_INSTALL_DIR="${CARLA_BUILD_FOLDER}/${ADRSS_BASENAME}/install"
|
||||||
#else
|
#else
|
||||||
# echo "Using clang-$CARLA_LLVM_VERSION_MAJOR as the CARLA compiler."
|
# echo "Using clang-$CARLA_LLVM_VERSION_MAJOR as the CARLA compiler."
|
||||||
#fi
|
#fi
|
||||||
CXX_TAG=c10
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Since it it not possible with boost-python to build more than one python version at once (find_package has some bugs)
|
# Since it it not possible with boost-python to build more than one python version at once (find_package has some bugs)
|
||||||
# we have to build it for every version in a separate colcon build
|
# we have to build it for every version in a separate colcon build
|
||||||
|
@ -107,9 +109,9 @@ for PY_VERSION in ${PY_VERSION_LIST[@]} ; do
|
||||||
|
|
||||||
pushd "${ADRSS_COLCON_WORKSPACE}" >/dev/null
|
pushd "${ADRSS_COLCON_WORKSPACE}" >/dev/null
|
||||||
if [[ "${CMAKE_PREFIX_PATH}" == "" ]]; then
|
if [[ "${CMAKE_PREFIX_PATH}" == "" ]]; then
|
||||||
CMAKE_PREFIX_PATH="${CARLA_BUILD_FOLDER}/boost-1.80.0-$CXX_TAG-install;${CARLA_BUILD_FOLDER}/proj-install"
|
CMAKE_PREFIX_PATH="${CARLA_BUILD_FOLDER}/boost-1.80.0-client-install;${CARLA_BUILD_FOLDER}/proj-client-install"
|
||||||
else
|
else
|
||||||
CMAKE_PREFIX_PATH="${CARLA_BUILD_FOLDER}/boost-1.80.0-$CXX_TAG-install;${CARLA_BUILD_FOLDER}/proj-install;${CMAKE_PREFIX_PATH}"
|
CMAKE_PREFIX_PATH="${CARLA_BUILD_FOLDER}/boost-1.80.0-client-install;${CARLA_BUILD_FOLDER}/proj-client-install;${CMAKE_PREFIX_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get the python version of the binding to be built, need to query the binary,
|
# get the python version of the binding to be built, need to query the binary,
|
||||||
|
@ -120,7 +122,7 @@ for PY_VERSION in ${PY_VERSION_LIST[@]} ; do
|
||||||
echo "PYTHON_BINDING_VERSIONS=${PYTHON_BINDING_VERSIONS}"
|
echo "PYTHON_BINDING_VERSIONS=${PYTHON_BINDING_VERSIONS}"
|
||||||
|
|
||||||
# enforce sequential executor to reduce the required memory for compilation
|
# enforce sequential executor to reduce the required memory for compilation
|
||||||
colcon build --executor sequential --packages-up-to ad_rss_map_integration --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE="${CARLA_BUILD_FOLDER}/LibStdCppToolChain.cmake" -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" -DPYTHON_BINDING_VERSIONS="${PYTHON_BINDING_VERSIONS}" --build-base ${ADRSS_BUILD_DIR} --install-base ${ADRSS_INSTALL_DIR}
|
colcon build --executor sequential --packages-up-to ad_rss_map_integration --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE="${CARLA_BUILD_FOLDER}/CarlaClientToolChain.cmake" -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" -DPYTHON_BINDING_VERSIONS="${PYTHON_BINDING_VERSIONS}" --build-base ${ADRSS_BUILD_DIR} --install-base ${ADRSS_INSTALL_DIR}
|
||||||
|
|
||||||
COLCON_RESULT=$?
|
COLCON_RESULT=$?
|
||||||
if (( COLCON_RESULT )); then
|
if (( COLCON_RESULT )); then
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
DOC_STRING="Build and launch CarlaUE4."
|
DOC_STRING="Build and launch CarlaUE4."
|
||||||
|
|
||||||
USAGE_STRING="Usage: $0 [-h|--help] [--build] [--rebuild] [--launch] [--clean] [--hard-clean] [--opengl]"
|
USAGE_STRING="Usage: $0 [-h|--help] [--build] [--rebuild] [--launch] [--clean] [--hard-clean] [--opengl] [--ros2]"
|
||||||
|
|
||||||
REMOVE_INTERMEDIATE=false
|
REMOVE_INTERMEDIATE=false
|
||||||
HARD_CLEAN=false
|
HARD_CLEAN=false
|
||||||
|
@ -17,11 +17,13 @@ USE_CHRONO=false
|
||||||
USE_PYTORCH=false
|
USE_PYTORCH=false
|
||||||
USE_UNITY=true
|
USE_UNITY=true
|
||||||
USE_ROS2=false
|
USE_ROS2=false
|
||||||
|
EDITOR_ROS2_FLAGS=""
|
||||||
|
|
||||||
EDITOR_FLAGS=""
|
EDITOR_FLAGS=""
|
||||||
|
|
||||||
GDB=
|
GDB=
|
||||||
RHI="-vulkan"
|
RHI="-vulkan"
|
||||||
|
DEBUG=false
|
||||||
|
|
||||||
OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean,gdb,opengl,carsim,pytorch,chrono,ros2,no-unity,editor-flags: -n 'parse-options' -- "$@"`
|
OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean,gdb,opengl,carsim,pytorch,chrono,ros2,no-unity,editor-flags: -n 'parse-options' -- "$@"`
|
||||||
|
|
||||||
|
@ -35,6 +37,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
--gdb )
|
--gdb )
|
||||||
GDB="gdb --args";
|
GDB="gdb --args";
|
||||||
shift ;;
|
shift ;;
|
||||||
|
--debug )
|
||||||
|
DEBUG=true;
|
||||||
|
shift ;;
|
||||||
--build )
|
--build )
|
||||||
BUILD_CARLAUE4=true;
|
BUILD_CARLAUE4=true;
|
||||||
shift ;;
|
shift ;;
|
||||||
|
@ -66,6 +71,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
shift ;;
|
shift ;;
|
||||||
--ros2 )
|
--ros2 )
|
||||||
USE_ROS2=true;
|
USE_ROS2=true;
|
||||||
|
# Due to continued segfaults in reallocations of MallocBinned2 enforce using AnsiMalloc calls
|
||||||
|
# (see https://forums.unrealengine.com/t/dealing-with-allocator-mismatches-with-external-libraries/1416830)
|
||||||
|
EDITOR_ROS2_FLAGS="-ansimalloc"
|
||||||
shift ;;
|
shift ;;
|
||||||
--no-unity )
|
--no-unity )
|
||||||
USE_UNITY=false
|
USE_UNITY=false
|
||||||
|
@ -110,7 +118,7 @@ if ${HARD_CLEAN} ; then
|
||||||
|
|
||||||
log "Doing a \"hard\" clean of the Unreal Engine project."
|
log "Doing a \"hard\" clean of the Unreal Engine project."
|
||||||
|
|
||||||
make CarlaUE4Editor ARGS=-clean
|
make CarlaUE4Editor ARGS="-clean"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -122,16 +130,16 @@ if ${REMOVE_INTERMEDIATE} ; then
|
||||||
|
|
||||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||||
|
|
||||||
|
cd Plugins
|
||||||
|
rm -Rf HoudiniEngine
|
||||||
|
cd ..
|
||||||
|
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
|
|
||||||
pushd "${CARLAUE4_PLUGIN_ROOT_FOLDER}" >/dev/null
|
pushd "${CARLAUE4_PLUGIN_ROOT_FOLDER}" >/dev/null
|
||||||
|
|
||||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||||
|
|
||||||
cd Plugins
|
|
||||||
rm -Rf HoudiniEngine
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -165,12 +173,16 @@ if ${BUILD_CARLAUE4} ; then
|
||||||
else
|
else
|
||||||
OPTIONAL_MODULES_TEXT="Ros2 OFF"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
OPTIONAL_MODULES_TEXT="Ros2 OFF"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
||||||
fi
|
fi
|
||||||
|
if ${DEBUG} ; then
|
||||||
|
OPTIONAL_MODULES_TEXT="Debug ON"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
||||||
|
else
|
||||||
|
OPTIONAL_MODULES_TEXT="Debug OFF"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
||||||
|
fi
|
||||||
if ${USE_UNITY} ; then
|
if ${USE_UNITY} ; then
|
||||||
OPTIONAL_MODULES_TEXT="Unity ON"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
OPTIONAL_MODULES_TEXT="Unity ON"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
||||||
else
|
else
|
||||||
OPTIONAL_MODULES_TEXT="Unity OFF"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
OPTIONAL_MODULES_TEXT="Unity OFF"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
||||||
fi
|
fi
|
||||||
OPTIONAL_MODULES_TEXT="Fast_dds ON"$'\n'"${OPTIONAL_MODULES_TEXT}"
|
|
||||||
echo ${OPTIONAL_MODULES_TEXT} > ${PWD}/Config/OptionalModules.ini
|
echo ${OPTIONAL_MODULES_TEXT} > ${PWD}/Config/OptionalModules.ini
|
||||||
|
|
||||||
if [ ! -f Makefile ]; then
|
if [ ! -f Makefile ]; then
|
||||||
|
@ -200,7 +212,7 @@ fi
|
||||||
if ${LAUNCH_UE4_EDITOR} ; then
|
if ${LAUNCH_UE4_EDITOR} ; then
|
||||||
|
|
||||||
log "Launching UE4Editor..."
|
log "Launching UE4Editor..."
|
||||||
${GDB} ${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject" ${RHI} ${EDITOR_FLAGS}
|
${GDB} ${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject" ${RHI} ${EDITOR_FLAGS} ${EDITOR_ROS2_FLAGS}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,13 @@ rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
set DOC_STRING=Build LibCarla.
|
set DOC_STRING=Build LibCarla.
|
||||||
set USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--server] [--client] [--clean]
|
set USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--server] [--client] [--clean] [--ros2]
|
||||||
|
|
||||||
set REMOVE_INTERMEDIATE=false
|
set REMOVE_INTERMEDIATE=false
|
||||||
set BUILD_SERVER=false
|
set BUILD_SERVER=false
|
||||||
set BUILD_CLIENT=false
|
set BUILD_CLIENT=false
|
||||||
|
set M_ROS2=OFF
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -34,6 +36,9 @@ if not "%1"=="" (
|
||||||
if "%1"=="--client" (
|
if "%1"=="--client" (
|
||||||
set BUILD_CLIENT=true
|
set BUILD_CLIENT=true
|
||||||
)
|
)
|
||||||
|
if "%1"=="--ros2" (
|
||||||
|
set M_ROS2=ON
|
||||||
|
)
|
||||||
if "%1"=="--clean" (
|
if "%1"=="--clean" (
|
||||||
set REMOVE_INTERMEDIATE=true
|
set REMOVE_INTERMEDIATE=true
|
||||||
)
|
)
|
||||||
|
@ -73,7 +78,11 @@ rem
|
||||||
set LIBCARLA_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%libcarla-visualstudio\
|
set LIBCARLA_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%libcarla-visualstudio\
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
set LIBCARLA_SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\
|
set LIBCARLA_SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\
|
||||||
set LIBCARLA_CLIENT_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\
|
set LIBCARLA_CLIENT_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\
|
||||||
|
@ -104,12 +113,6 @@ if %REMOVE_INTERMEDIATE% == true (
|
||||||
if not exist "%LIBCARLA_VSPROJECT_PATH%" mkdir "%LIBCARLA_VSPROJECT_PATH%"
|
if not exist "%LIBCARLA_VSPROJECT_PATH%" mkdir "%LIBCARLA_VSPROJECT_PATH%"
|
||||||
cd "%LIBCARLA_VSPROJECT_PATH%"
|
cd "%LIBCARLA_VSPROJECT_PATH%"
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
rem For some reason the findstr above sets an errorlevel even if it finds the string in this batch file.
|
rem For some reason the findstr above sets an errorlevel even if it finds the string in this batch file.
|
||||||
set errorlevel=0
|
set errorlevel=0
|
||||||
|
|
||||||
|
@ -121,6 +124,7 @@ if %BUILD_SERVER% == true (
|
||||||
-DCMAKE_BUILD_TYPE=Server^
|
-DCMAKE_BUILD_TYPE=Server^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
-DCMAKE_INSTALL_PREFIX="%LIBCARLA_SERVER_INSTALL_PATH:\=/%"^
|
-DCMAKE_INSTALL_PREFIX="%LIBCARLA_SERVER_INSTALL_PATH:\=/%"^
|
||||||
|
-DLIBCARLA_USE_ROS="%M_ROS2%"^
|
||||||
"%ROOT_PATH%"
|
"%ROOT_PATH%"
|
||||||
|
|
||||||
if %errorlevel% neq 0 goto error_cmake
|
if %errorlevel% neq 0 goto error_cmake
|
||||||
|
|
|
@ -125,28 +125,31 @@ function build_libcarla {
|
||||||
|
|
||||||
CMAKE_EXTRA_OPTIONS=''
|
CMAKE_EXTRA_OPTIONS=''
|
||||||
|
|
||||||
|
M_ROS=false
|
||||||
if [ $1 == Server ] ; then
|
if [ $1 == Server ] ; then
|
||||||
M_TOOLCHAIN=${LIBCPP_TOOLCHAIN_FILE}
|
M_TOOLCHAIN=${CARLA_SERVER_TOOLCHAIN_FILE}
|
||||||
M_BUILD_FOLDER=${LIBCARLA_BUILD_SERVER_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
M_BUILD_FOLDER=${LIBCARLA_BUILD_SERVER_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
||||||
|
elif [ $1 == ServerROS ] ; then
|
||||||
|
BUILD_TYPE='Server'
|
||||||
|
M_TOOLCHAIN=${CARLA_SERVER_TOOLCHAIN_FILE}
|
||||||
|
M_BUILD_FOLDER=${LIBCARLA_BUILD_SERVER_FOLDER}.ROS.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
|
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
||||||
|
M_ROS=true
|
||||||
elif [ $1 == Client ] ; then
|
elif [ $1 == Client ] ; then
|
||||||
M_TOOLCHAIN=${LIBSTDCPP_TOOLCHAIN_FILE}
|
M_TOOLCHAIN=${CARLA_CLIENT_TOOLCHAIN_FILE}
|
||||||
M_BUILD_FOLDER=${LIBCARLA_BUILD_CLIENT_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
M_BUILD_FOLDER=${LIBCARLA_BUILD_CLIENT_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_CLIENT_FOLDER}
|
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_CLIENT_FOLDER}
|
||||||
elif [ $1 == Pytorch ] ; then
|
elif [ $1 == Pytorch ] ; then
|
||||||
M_TOOLCHAIN=${LIBSTDCPP_TOOLCHAIN_FILE}
|
M_TOOLCHAIN=${CARLA_SERVER_TOOLCHAIN_FILE}
|
||||||
M_BUILD_FOLDER=${LIBCARLA_BUILD_PYTORCH_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
M_BUILD_FOLDER=${LIBCARLA_BUILD_PYTORCH_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
||||||
elif [ $1 == ros2 ] ; then
|
|
||||||
M_TOOLCHAIN=${LIBSTDCPP_TOOLCHAIN_FILE}
|
|
||||||
M_BUILD_FOLDER=${LIBCARLA_FASTDDS_FOLDER}.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
|
||||||
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_SERVER_FOLDER}
|
|
||||||
elif [ $1 == ClientRSS ] ; then
|
elif [ $1 == ClientRSS ] ; then
|
||||||
BUILD_TYPE='Client'
|
BUILD_TYPE='Client'
|
||||||
M_TOOLCHAIN=${LIBSTDCPP_TOOLCHAIN_FILE}
|
M_TOOLCHAIN=${CARLA_CLIENT_TOOLCHAIN_FILE}
|
||||||
M_BUILD_FOLDER=${LIBCARLA_BUILD_CLIENT_FOLDER}.rss.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
M_BUILD_FOLDER=${LIBCARLA_BUILD_CLIENT_FOLDER}.rss.$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_CLIENT_FOLDER}
|
M_INSTALL_FOLDER=${LIBCARLA_INSTALL_CLIENT_FOLDER}
|
||||||
CMAKE_EXTRA_OPTIONS="${CMAKE_EXTRA_OPTIONS:+${CMAKE_EXTRA_OPTIONS} }-DBUILD_RSS_VARIANT=ON -DADRSS_INSTALL_DIR=${CARLA_BUILD_FOLDER}/ad-rss-4.4.4/install"
|
CMAKE_EXTRA_OPTIONS="${CMAKE_EXTRA_OPTIONS:+${CMAKE_EXTRA_OPTIONS} }-DBUILD_RSS_VARIANT=ON -DADRSS_INSTALL_DIR=${CARLA_BUILD_FOLDER}/ad-rss-4.4.5/install"
|
||||||
else
|
else
|
||||||
fatal_error "Invalid build configuration \"$1\""
|
fatal_error "Invalid build configuration \"$1\""
|
||||||
fi
|
fi
|
||||||
|
@ -184,6 +187,7 @@ function build_libcarla {
|
||||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-$1} \
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-$1} \
|
||||||
-DLIBCARLA_BUILD_DEBUG=${M_DEBUG} \
|
-DLIBCARLA_BUILD_DEBUG=${M_DEBUG} \
|
||||||
-DLIBCARLA_BUILD_RELEASE=${M_RELEASE} \
|
-DLIBCARLA_BUILD_RELEASE=${M_RELEASE} \
|
||||||
|
-DLIBCARLA_USE_ROS=${M_ROS} \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${M_TOOLCHAIN} \
|
-DCMAKE_TOOLCHAIN_FILE=${M_TOOLCHAIN} \
|
||||||
-DCMAKE_INSTALL_PREFIX=${M_INSTALL_FOLDER} \
|
-DCMAKE_INSTALL_PREFIX=${M_INSTALL_FOLDER} \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
|
||||||
|
@ -205,23 +209,22 @@ function build_libcarla {
|
||||||
# -- Build all possible configurations -----------------------------------------
|
# -- Build all possible configurations -----------------------------------------
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
SERVER_VARIANT='Server'
|
||||||
|
if ${USE_ROS2}; then
|
||||||
|
SERVER_VARIANT='ServerROS'
|
||||||
|
fi
|
||||||
if { ${BUILD_SERVER} && ${BUILD_OPTION_DEBUG}; }; then
|
if { ${BUILD_SERVER} && ${BUILD_OPTION_DEBUG}; }; then
|
||||||
|
|
||||||
build_libcarla Server Debug
|
build_libcarla ${SERVER_VARIANT} Debug
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if { ${BUILD_SERVER} && ${BUILD_OPTION_RELEASE}; }; then
|
if { ${BUILD_SERVER} && ${BUILD_OPTION_RELEASE}; }; then
|
||||||
|
|
||||||
build_libcarla Server Release
|
build_libcarla ${SERVER_VARIANT} Release
|
||||||
if ${USE_PYTORCH} ; then
|
if ${USE_PYTORCH} ; then
|
||||||
build_libcarla Pytorch Release
|
build_libcarla Pytorch Release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${USE_ROS2} ; then
|
|
||||||
build_libcarla ros2 Release
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLIENT_VARIANT='Client'
|
CLIENT_VARIANT='Client'
|
||||||
|
|
|
@ -6,6 +6,7 @@ rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
|
||||||
|
|
||||||
set LOCAL_PATH=%~dp0
|
set LOCAL_PATH=%~dp0
|
||||||
set FILE_N=-[%~n0]:
|
set FILE_N=-[%~n0]:
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
rem Print batch params (debug purpose)
|
rem Print batch params (debug purpose)
|
||||||
echo %FILE_N% [Batch params]: %*
|
echo %FILE_N% [Batch params]: %*
|
||||||
|
@ -57,6 +58,13 @@ if not "%1"=="" (
|
||||||
goto :arg-parse
|
goto :arg-parse
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
if %REMOVE_INTERMEDIATE% == false (
|
if %REMOVE_INTERMEDIATE% == false (
|
||||||
if %BUILD_OSM2ODR% == false (
|
if %BUILD_OSM2ODR% == false (
|
||||||
echo Nothing selected to be done.
|
echo Nothing selected to be done.
|
||||||
|
@ -76,8 +84,6 @@ set OSM2ODR_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\
|
||||||
set OSM2ODR__SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies
|
set OSM2ODR__SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies
|
||||||
set CARLA_DEPENDENCIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\
|
set CARLA_DEPENDENCIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
|
||||||
|
|
||||||
if %REMOVE_INTERMEDIATE% == true (
|
if %REMOVE_INTERMEDIATE% == true (
|
||||||
rem Remove directories
|
rem Remove directories
|
||||||
for %%G in (
|
for %%G in (
|
||||||
|
@ -90,6 +96,7 @@ if %REMOVE_INTERMEDIATE% == true (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
rem Build OSM2ODR
|
rem Build OSM2ODR
|
||||||
if %BUILD_OSM2ODR% == true (
|
if %BUILD_OSM2ODR% == true (
|
||||||
cd "%INSTALLATION_DIR%"
|
cd "%INSTALLATION_DIR%"
|
||||||
|
|
|
@ -14,7 +14,7 @@ END
|
||||||
REMOVE_INTERMEDIATE=false
|
REMOVE_INTERMEDIATE=false
|
||||||
BUILD_OSM2ODR=false
|
BUILD_OSM2ODR=false
|
||||||
GIT_PULL=true
|
GIT_PULL=true
|
||||||
CURRENT_OSM2ODR_COMMIT=1835e1e9538d0778971acc8b19b111834aae7261
|
CURRENT_OSM2ODR_COMMIT=2a490962dc54da711ab09265393a4dc2f6d31813
|
||||||
OSM2ODR_BRANCH=aaron/defaultsidewalkwidth
|
OSM2ODR_BRANCH=aaron/defaultsidewalkwidth
|
||||||
OSM2ODR_REPO=https://github.com/carla-simulator/sumo.git
|
OSM2ODR_REPO=https://github.com/carla-simulator/sumo.git
|
||||||
|
|
||||||
|
@ -51,13 +51,15 @@ source $(dirname "$0")/Environment.sh
|
||||||
|
|
||||||
function get_source_code_checksum {
|
function get_source_code_checksum {
|
||||||
local EXCLUDE='*__pycache__*'
|
local EXCLUDE='*__pycache__*'
|
||||||
find "${OSM2ODR_SOURCE_FOLDER}"/* \! -path "${EXCLUDE}" -print0 | sha1sum | awk '{print $1}'
|
find "${OSM2ODR_BASENAME}-source"/* \! -path "${EXCLUDE}" -print0 | sha1sum | awk '{print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_OSM2ODR}; }; then
|
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_OSM2ODR}; }; then
|
||||||
fatal_error "Nothing selected to be done."
|
fatal_error "Nothing selected to be done."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OSM2ODR_BASENAME=${CARLA_BUILD_FOLDER}/osm2odr
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# -- Clean intermediate files --------------------------------------------------
|
# -- Clean intermediate files --------------------------------------------------
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
@ -66,7 +68,8 @@ if ${REMOVE_INTERMEDIATE} ; then
|
||||||
|
|
||||||
log "Cleaning intermediate files and folders."
|
log "Cleaning intermediate files and folders."
|
||||||
|
|
||||||
rm -Rf ${OSM2ODR_BUILD_FOLDER}*
|
rm -Rf ${OSM2ODR_BASENAME}-client-build* ${OSM2ODR_BASENAME}-server-build*
|
||||||
|
rm -Rf ${OSM2ODR_BASENAME}-server-install* ${OSM2ODR_BASENAME}-client-install*
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -75,75 +78,64 @@ fi
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
if ${BUILD_OSM2ODR} ; then
|
if ${BUILD_OSM2ODR} ; then
|
||||||
log "Building OSM2ODR."
|
|
||||||
if [ ! -d ${OSM2ODR_SOURCE_FOLDER} ] ; then
|
if [[ -d ${OSM2ODR_BASENAME}-client-install && -d ${OSM2ODR_BASENAME}-server-install ]] ; then
|
||||||
cd ${CARLA_BUILD_FOLDER}
|
log "OSM2ODR already installed."
|
||||||
curl --retry 5 --retry-max-time 120 -L -o OSM2ODR.zip https://github.com/carla-simulator/sumo/archive/${CURRENT_OSM2ODR_COMMIT}.zip
|
else
|
||||||
unzip -qq OSM2ODR.zip
|
rm -Rf \
|
||||||
rm -f OSM2ODR.zip
|
${OSM2ODR_BASENAME}-source \
|
||||||
mv sumo-${CURRENT_OSM2ODR_COMMIT} ${OSM2ODR_SOURCE_FOLDER}
|
${OSM2ODR_BASENAME}-server-build ${OSM2ODR_BASENAME}-client-build \
|
||||||
|
${OSM2ODR_BASENAME}-server-install ${OSM2ODR_BASENAME}-client-install
|
||||||
|
|
||||||
|
log "Building OSM2ODR."
|
||||||
|
if [ ! -d ${OSM2ODR_BASENAME}-source ] ; then
|
||||||
|
cd ${CARLA_BUILD_FOLDER}
|
||||||
|
curl --retry 5 --retry-max-time 120 -L -o OSM2ODR.zip https://github.com/carla-simulator/sumo/archive/${CURRENT_OSM2ODR_COMMIT}.zip
|
||||||
|
unzip -qq OSM2ODR.zip
|
||||||
|
rm -f OSM2ODR.zip
|
||||||
|
mv sumo-${CURRENT_OSM2ODR_COMMIT} ${OSM2ODR_BASENAME}-source
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${OSM2ODR_BASENAME}-client-build
|
||||||
|
pushd ${OSM2ODR_BASENAME}-client-build >/dev/null
|
||||||
|
|
||||||
|
cmake ${OSM2ODR_BASENAME}-source \
|
||||||
|
-G "Eclipse CDT4 - Ninja" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${OSM2ODR_BASENAME}-client-install \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE="${CARLA_CLIENT_TOOLCHAIN_FILE}" \
|
||||||
|
-DOSM2ODR_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-client-install/include \
|
||||||
|
-DOSM2ODR_LIBRARY=${CARLA_BUILD_FOLDER}/proj-client-install/lib/libproj.so \
|
||||||
|
-DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-client-install/include \
|
||||||
|
-DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-client-install/lib/libxerces-c.so
|
||||||
|
|
||||||
|
ninja osm2odr
|
||||||
|
ninja install
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
mkdir -p ${OSM2ODR_BASENAME}-server-build
|
||||||
|
pushd ${OSM2ODR_BASENAME}-server-build >/dev/null
|
||||||
|
|
||||||
|
cmake ${OSM2ODR_BASENAME}-source \
|
||||||
|
-G "Eclipse CDT4 - Ninja" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${OSM2ODR_BASENAME}-server-install \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE="${CARLA_SERVER_TOOLCHAIN_FILE}" \
|
||||||
|
-DOSM2ODR_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-server-install/include \
|
||||||
|
-DOSM2ODR_LIBRARY=${CARLA_BUILD_FOLDER}/proj-server-install/lib/libproj.a \
|
||||||
|
-DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-server-install/include \
|
||||||
|
-DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-server-install/lib/libxerces-c.a
|
||||||
|
|
||||||
|
ninja osm2odr
|
||||||
|
ninja install
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
rm -Rf ${OSM2ODR_BASENAME}-server-build ${OSM2ODR_BASENAME}-client-build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ${OSM2ODR_BUILD_FOLDER}
|
cp -p -r ${OSM2ODR_BASENAME}-server-install/include/* ${LIBCARLA_INSTALL_SERVER_FOLDER}/include/
|
||||||
cd ${OSM2ODR_BUILD_FOLDER}
|
cp -p ${OSM2ODR_BASENAME}-server-install/lib/*.a ${LIBCARLA_INSTALL_SERVER_FOLDER}/lib
|
||||||
|
|
||||||
|
cp -p -r ${OSM2ODR_BASENAME}-client-install/include/* ${LIBCARLA_INSTALL_CLIENT_FOLDER}/include/
|
||||||
export CC="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang"
|
cp -p ${OSM2ODR_BASENAME}-client-install/lib/*.a ${LIBCARLA_INSTALL_CLIENT_FOLDER}/lib
|
||||||
export CXX="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang++"
|
|
||||||
export PATH="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin:$PATH"
|
|
||||||
|
|
||||||
cmake ${OSM2ODR_SOURCE_FOLDER} \
|
|
||||||
-G "Eclipse CDT4 - Ninja" \
|
|
||||||
-DCMAKE_CXX_FLAGS="-stdlib=libstdc++" \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_CLIENT_FOLDER} \
|
|
||||||
-DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install/include \
|
|
||||||
-DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install/lib/libproj.a \
|
|
||||||
-DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install/include \
|
|
||||||
-DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install/lib/libxerces-c.a
|
|
||||||
|
|
||||||
ninja osm2odr
|
|
||||||
ninja install
|
|
||||||
|
|
||||||
mkdir -p ${OSM2ODR_SERVER_BUILD_FOLDER}
|
|
||||||
cd ${OSM2ODR_SERVER_BUILD_FOLDER}
|
|
||||||
|
|
||||||
LLVM_BASENAME=llvm-8.0
|
|
||||||
LLVM_INCLUDE="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/include/c++/v1"
|
|
||||||
LLVM_LIBPATH="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/lib/Linux/x86_64-unknown-linux-gnu"
|
|
||||||
|
|
||||||
echo $LLVM_INCLUDE
|
|
||||||
echo $LLVM_LIBPATH
|
|
||||||
|
|
||||||
cmake ${OSM2ODR_SOURCE_FOLDER} \
|
|
||||||
-G "Eclipse CDT4 - Ninja" \
|
|
||||||
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -L${LLVM_LIBPATH}" \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_SERVER_FOLDER} \
|
|
||||||
-DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install-server/include \
|
|
||||||
-DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install-server/lib/libproj.a \
|
|
||||||
-DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/include \
|
|
||||||
-DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/lib/libxerces-c.a
|
|
||||||
|
|
||||||
ninja osm2odr
|
|
||||||
ninja install
|
|
||||||
|
|
||||||
mkdir -p ${OSM2ODR_SERVER_BUILD_FOLDER}
|
|
||||||
cd ${OSM2ODR_SERVER_BUILD_FOLDER}
|
|
||||||
|
|
||||||
LLVM_BASENAME=llvm-8.0
|
|
||||||
LLVM_INCLUDE="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/include/c++/v1"
|
|
||||||
LLVM_LIBPATH="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/lib/Linux/x86_64-unknown-linux-gnu"
|
|
||||||
|
|
||||||
cmake ${OSM2ODR_SOURCE_FOLDER} \
|
|
||||||
-G "Eclipse CDT4 - Ninja" \
|
|
||||||
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -L${LLVM_LIBPATH}" \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_SERVER_FOLDER} \
|
|
||||||
-DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install-server/include \
|
|
||||||
-DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install-server/lib/libproj.a \
|
|
||||||
-DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/include \
|
|
||||||
-DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/lib/libxerces-c.a
|
|
||||||
|
|
||||||
ninja osm2odr
|
|
||||||
ninja install
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ if not exist "%OSM_RENDERER_VSPROJECT_PATH%" mkdir "%OSM_RENDERER_VSPROJECT_PATH
|
||||||
cd "%OSM_RENDERER_VSPROJECT_PATH%"
|
cd "%OSM_RENDERER_VSPROJECT_PATH%"
|
||||||
|
|
||||||
cmake -G "Visual Studio 16 2019" -A x64^
|
cmake -G "Visual Studio 16 2019" -A x64^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/std:c++17 /wd4251 /I%INSTALLATION_DIR:/=\%boost-1.80.0-install\include"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/std:c++20 /wd4251 /I%INSTALLATION_DIR:/=\%boost-1.80.0-install\include"^
|
||||||
"%OSM_RENDERER_SOURCE%"
|
"%OSM_RENDERER_SOURCE%"
|
||||||
|
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
|
@ -68,7 +68,7 @@ echo "Building osm-map-renderer"
|
||||||
mkdir -p ${OSM_RENDERER_BUILD}
|
mkdir -p ${OSM_RENDERER_BUILD}
|
||||||
cd ${OSM_RENDERER_BUILD}
|
cd ${OSM_RENDERER_BUILD}
|
||||||
|
|
||||||
cmake -DCMAKE_CXX_FLAGS="-std=c++17 -g -pthread -I${CARLA_BUILD_FOLDER}/boost-1.80.0-c10-install/include" \
|
cmake -DCMAKE_TOOLCHAIN_FILE="${CARLA_CLIENT_TOOLCHAIN_FILE}" -DCMAKE_CXX_FLAGS="-g -I${CARLA_BUILD_FOLDER}/boost-1.80.0-install/include" \
|
||||||
${OSM_RENDERER_SOURCE}
|
${OSM_RENDERER_SOURCE}
|
||||||
make
|
make
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
UNREAL_SYSROOT="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu"
|
||||||
export CC="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang"
|
export CC="${UNREAL_SYSROOT}/bin/clang"
|
||||||
export CXX="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang++"
|
export CXX="${UNREAL_SYSROOT}/bin/clang++"
|
||||||
export PATH="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin:$PATH"
|
export PATH="${UNREAL_SYSROOT}/bin:$PATH"
|
||||||
|
|
||||||
source $(dirname "$0")/Environment.sh
|
source $(dirname "$0")/Environment.sh
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ if ${REMOVE_INTERMEDIATE} ; then
|
||||||
rm -Rf build dist source/carla.egg-info
|
rm -Rf build dist source/carla.egg-info
|
||||||
|
|
||||||
find source -name "*.so" -delete
|
find source -name "*.so" -delete
|
||||||
find source -name "__pycache__" -type d -exec rm -r "{}" \;
|
find source -name "__pycache__" -type d -exec rm -rf "{}" \;
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ mkdir -p "${FBX2OBJ_BUILD_FOLDER}"
|
||||||
pushd "${FBX2OBJ_BUILD_FOLDER}" >/dev/null
|
pushd "${FBX2OBJ_BUILD_FOLDER}" >/dev/null
|
||||||
|
|
||||||
cmake -G "Ninja" \
|
cmake -G "Ninja" \
|
||||||
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14" \
|
-DCMAKE_CXX_FLAGS="-fPIC -std=c++20" \
|
||||||
..
|
..
|
||||||
|
|
||||||
# copy the shared object 'libfbxsdk.so' to 'dist' folder
|
# copy the shared object 'libfbxsdk.so' to 'dist' folder
|
||||||
|
|
|
@ -7,6 +7,10 @@ launch: LibCarla.server.release osm2odr downloadplugins
|
||||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildUE4Plugins.sh --build $(ARGS)
|
@${CARLA_BUILD_TOOLS_FOLDER}/BuildUE4Plugins.sh --build $(ARGS)
|
||||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --build --launch $(ARGS)
|
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --build --launch $(ARGS)
|
||||||
|
|
||||||
|
launch.debug: LibCarla.server.debug osm2odr downloadplugins
|
||||||
|
@${CARLA_BUILD_TOOLS_FOLDER}/BuildUE4Plugins.sh --build $(ARGS)
|
||||||
|
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --build --debug --launch $(ARGS)
|
||||||
|
|
||||||
launch-only:
|
launch-only:
|
||||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --launch $(ARGS)
|
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --launch $(ARGS)
|
||||||
|
|
||||||
|
@ -138,7 +142,7 @@ LibCarla.client.rss.release: setup ad-rss
|
||||||
plugins:
|
plugins:
|
||||||
@${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS)
|
@${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS)
|
||||||
|
|
||||||
setup downloadplugins:
|
setup: downloadplugins
|
||||||
@${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh $(ARGS)
|
@${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh $(ARGS)
|
||||||
|
|
||||||
ad-rss:
|
ad-rss:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
DOC_STRING="Makes a packaged version of CARLA and other content packages ready for distribution."
|
DOC_STRING="Makes a packaged version of CARLA and other content packages ready for distribution."
|
||||||
|
|
||||||
USAGE_STRING="Usage: $0 [-h|--help] [--config={Debug,Development,Shipping}] [--no-zip] [--clean-intermediate] [--packages=Name1,Name2,...] [--target-archive=] [--archive-sufix=]"
|
USAGE_STRING="Usage: $0 [-h|--help] [--config={Debug,Development,Shipping}] [--no-zip] [--clean-intermediate] [--packages=Name1,Name2,...] [--target-archive=] [--archive-sufix=] [--ros2]"
|
||||||
|
|
||||||
PACKAGES="Carla"
|
PACKAGES="Carla"
|
||||||
DO_TARBALL=true
|
DO_TARBALL=true
|
||||||
|
@ -17,7 +17,10 @@ USE_CARSIM=false
|
||||||
SINGLE_PACKAGE=false
|
SINGLE_PACKAGE=false
|
||||||
ARCHIVE_SUFIX=""
|
ARCHIVE_SUFIX=""
|
||||||
|
|
||||||
OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,carsim,packages:,python-version,target-archive:,archive-sufix:, -n 'parse-options' -- "$@"`
|
EDITOR_ROS2_FLAGS=""
|
||||||
|
|
||||||
|
|
||||||
|
OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,carsim,packages:,python-version,target-archive:,archive-sufix:,ros2 -n 'parse-options' -- "$@"`
|
||||||
|
|
||||||
eval set -- "$OPTS"
|
eval set -- "$OPTS"
|
||||||
|
|
||||||
|
@ -42,6 +45,11 @@ while [[ $# -gt 0 ]]; do
|
||||||
--archive-sufix )
|
--archive-sufix )
|
||||||
ARCHIVE_SUFIX="$2"
|
ARCHIVE_SUFIX="$2"
|
||||||
shift 2 ;;
|
shift 2 ;;
|
||||||
|
--ros2 )
|
||||||
|
# Due to continued segfaults in reallocations of MallocBinned2 enforce using AnsiMalloc calls
|
||||||
|
# (see https://forums.unrealengine.com/t/dealing-with-allocator-mismatches-with-external-libraries/1416830)
|
||||||
|
EDITOR_ROS2_FLAGS="-ansimalloc"
|
||||||
|
shift ;;
|
||||||
--carsim )
|
--carsim )
|
||||||
USE_CARSIM=true;
|
USE_CARSIM=true;
|
||||||
shift ;;
|
shift ;;
|
||||||
|
@ -182,12 +190,14 @@ if ${DO_CARLA_RELEASE} ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib" ] ; then
|
if [ -d "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib" ] ; then
|
||||||
cp -r "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib" "${DESTINATION}/CarlaUE4/Plugins/Carla/CarlaDependencies"
|
cp -r "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib/" "${DESTINATION}/CarlaUE4/Plugins/Carla/CarlaDependencies"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/*.pcd" "${DESTINATION}/HDMaps/"
|
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/*.pcd" "${DESTINATION}/HDMaps/"
|
||||||
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/Readme.md" "${DESTINATION}/HDMaps/README"
|
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/Readme.md" "${DESTINATION}/HDMaps/README"
|
||||||
|
|
||||||
|
sed -i "s/CarlaUE4 /CarlaUE4 ${EDITOR_ROS2_FLAGS} /g" "${DESTINATION}/CarlaUE4.sh"
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -65,7 +65,7 @@ if not "%1"=="" (
|
||||||
|
|
||||||
rem If not defined, use Visual Studio 2019 as tool set
|
rem If not defined, use Visual Studio 2019 as tool set
|
||||||
if "%TOOLSET%" == "" set TOOLSET=msvc-14.2
|
if "%TOOLSET%" == "" set TOOLSET=msvc-14.2
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if "%GENERATOR%" == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
|
||||||
rem If is not set, set the number of parallel jobs to the number of CPU threads
|
rem If is not set, set the number of parallel jobs to the number of CPU threads
|
||||||
if "%NUMBER_OF_ASYNC_JOBS%" == "" set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
|
if "%NUMBER_OF_ASYNC_JOBS%" == "" set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
|
||||||
|
@ -81,14 +81,17 @@ echo %FILE_N% Boost toolset: %TOOLSET%
|
||||||
echo %FILE_N% Generator: %GENERATOR%
|
echo %FILE_N% Generator: %GENERATOR%
|
||||||
echo %FILE_N% Install directory: "%INSTALLATION_DIR%"
|
echo %FILE_N% Install directory: "%INSTALLATION_DIR%"
|
||||||
|
|
||||||
if not exist "%CONTENT_DIR%" (
|
rem creating some folders
|
||||||
echo %FILE_N% Creating "%CONTENT_DIR%" folder...
|
for %%G in (
|
||||||
mkdir "%CONTENT_DIR%"
|
"%CONTENT_DIR%",
|
||||||
)
|
"%INSTALLATION_DIR%",
|
||||||
|
"%CARLA_DEPENDENCIES_FOLDER%\include",
|
||||||
if not exist "%INSTALLATION_DIR%" (
|
"%CARLA_DEPENDENCIES_FOLDER%\lib"
|
||||||
echo %FILE_N% Creating "%INSTALLATION_DIR%" folder...
|
) do (
|
||||||
mkdir "%INSTALLATION_DIR%"
|
if not exist %%G (
|
||||||
|
echo %FILE_N% Creating "%%G" folder...
|
||||||
|
mkdir "%%G"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
@ -141,6 +144,8 @@ if not defined install_rpclib (
|
||||||
echo %FILE_N% Failed while installing rpclib.
|
echo %FILE_N% Failed while installing rpclib.
|
||||||
goto failed
|
goto failed
|
||||||
)
|
)
|
||||||
|
xcopy /Y /S /I %INSTALLATION_DIR%rpclib-install\include\rpc\* %CARLA_DEPENDENCIES_FOLDER%\include\rpc\* > NUL
|
||||||
|
copy %INSTALLATION_DIR%rpclib-install\lib\*.* %CARLA_DEPENDENCIES_FOLDER%\lib\ > NUL
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Download and install Google Test ----------------------------------------
|
rem -- Download and install Google Test ----------------------------------------
|
||||||
|
@ -178,26 +183,6 @@ if not defined install_recast (
|
||||||
set RECAST_INSTALL_DIR=%install_recast:\=/%
|
set RECAST_INSTALL_DIR=%install_recast:\=/%
|
||||||
)
|
)
|
||||||
|
|
||||||
rem ============================================================================
|
|
||||||
rem -- Download and install Fast-DDS (for ROS2)---------------------------------
|
|
||||||
rem ============================================================================
|
|
||||||
|
|
||||||
if %USE_ROS2% == true (
|
|
||||||
echo %FILE_N% Installing "Fast-DDS"...
|
|
||||||
call "%INSTALLERS_DIR%install_fastDDS.bat"^
|
|
||||||
--build-dir "%INSTALLATION_DIR%"
|
|
||||||
|
|
||||||
if %errorlevel% neq 0 goto failed
|
|
||||||
|
|
||||||
if not defined install_dds (
|
|
||||||
|
|
||||||
echo %FILE_N% Failed while installing "Fast-DDS".
|
|
||||||
goto failed
|
|
||||||
) else (
|
|
||||||
set FASTDDS_INSTALL_DIR=%install_dds:\=/%
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Download and install Boost ----------------------------------------------
|
rem -- Download and install Boost ----------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
@ -216,6 +201,27 @@ if not defined install_boost (
|
||||||
goto failed
|
goto failed
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rem ============================================================================
|
||||||
|
rem -- Download and install Fast-DDS (for ROS2)---------------------------------
|
||||||
|
rem ============================================================================
|
||||||
|
|
||||||
|
if %USE_ROS2% == true (
|
||||||
|
echo %FILE_N% Installing "Fast-DDS"...
|
||||||
|
call "%INSTALLERS_DIR%install_fastDDS.bat"^
|
||||||
|
--boost-version %BOOST_VERSION%^
|
||||||
|
--build-dir "%INSTALLATION_DIR%"^
|
||||||
|
--install-dir "%INSTALLATION_DIR%fastDDS-install\"
|
||||||
|
|
||||||
|
if %errorlevel% neq 0 goto failed
|
||||||
|
|
||||||
|
if not defined install_dds (
|
||||||
|
echo %FILE_N% Failed while installing "Fast-DDS".
|
||||||
|
goto failed
|
||||||
|
)
|
||||||
|
copy %INSTALLATION_DIR%fastDDS-install\lib\*.lib %CARLA_DEPENDENCIES_FOLDER%\lib > NUL
|
||||||
|
xcopy /Y /S /I %INSTALLATION_DIR%fastDDS-install\include\* %CARLA_DEPENDENCIES_FOLDER%\include\* > NUL
|
||||||
|
)
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Download and install Xercesc --------------------------------------------
|
rem -- Download and install Xercesc --------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
@ -285,81 +291,6 @@ if %USE_CHRONO% == true (
|
||||||
xcopy /Y /S /I "%INSTALLATION_DIR%eigen-install\include\*" "%CARLA_DEPENDENCIES_FOLDER%include\*" > NUL
|
xcopy /Y /S /I "%INSTALLATION_DIR%eigen-install\include\*" "%CARLA_DEPENDENCIES_FOLDER%include\*" > NUL
|
||||||
)
|
)
|
||||||
|
|
||||||
REM ==============================================================================
|
|
||||||
REM -- Download Fast DDS and dependencies ----------------------------------------
|
|
||||||
REM ==============================================================================
|
|
||||||
|
|
||||||
SET FASTDDS_BASENAME=fast-dds
|
|
||||||
SET FASTDDS_INSTALL_DIR=%CD%\%FASTDDS_BASENAME%-install
|
|
||||||
SET FASTDDS_INCLUDE=%FASTDDS_INSTALL_DIR%\include
|
|
||||||
SET FASTDDS_LIB=%FASTDDS_INSTALL_DIR%\lib
|
|
||||||
IF "%USE_ROS2%"=="true" (
|
|
||||||
|
|
||||||
:build_fastdds_extension
|
|
||||||
SET LIB_SOURCE=%1
|
|
||||||
SET LIB_REPO=%2
|
|
||||||
SET CMAKE_FLAGS=%3
|
|
||||||
|
|
||||||
IF NOT EXIST "%LIB_SOURCE%" (
|
|
||||||
mkdir "%LIB_SOURCE%"
|
|
||||||
echo %LIB_REPO%
|
|
||||||
git clone %LIB_REPO% %LIB_SOURCE%
|
|
||||||
mkdir "%LIB_SOURCE%\build"
|
|
||||||
)
|
|
||||||
|
|
||||||
IF NOT EXIST "%FASTDDS_INSTALL_DIR%" (
|
|
||||||
mkdir "%FASTDDS_INSTALL_DIR%"
|
|
||||||
echo Build foonathan memory vendor
|
|
||||||
SET FOONATHAN_MEMORY_VENDOR_BASENAME=foonathan-memory-vendor
|
|
||||||
SET FOONATHAN_MEMORY_VENDOR_SOURCE_DIR=%CD%\%FOONATHAN_MEMORY_VENDOR_BASENAME%-source
|
|
||||||
SET FOONATHAN_MEMORY_VENDOR_REPO="https://github.com/eProsima/foonathan_memory_vendor.git"
|
|
||||||
SET FOONATHAN_MEMORY_VENDOR_CMAKE_FLAGS=-DBUILD_SHARED_LIBS=ON
|
|
||||||
CALL :build_fastdds_extension "%FOONATHAN_MEMORY_VENDOR_SOURCE_DIR%" "%FOONATHAN_MEMORY_VENDOR_REPO%"
|
|
||||||
pushd "%FOONATHAN_MEMORY_VENDOR_SOURCE_DIR%\build" >nul
|
|
||||||
cmake -G "Ninja" ^
|
|
||||||
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR%" ^
|
|
||||||
-DBUILD_SHARED_LIBS=ON ^
|
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="-D_GLIBCXX_USE_CXX11_ABI=0" ^
|
|
||||||
-DFOONATHAN_MEMORY_FORCE_VENDORED_BUILD=ON ^
|
|
||||||
..
|
|
||||||
ninja
|
|
||||||
ninja install
|
|
||||||
popd >nul
|
|
||||||
rmdir /s /q "%FOONATHAN_MEMORY_VENDOR_SOURCE_DIR%"
|
|
||||||
|
|
||||||
echo Build fast cdr
|
|
||||||
SET FAST_CDR_BASENAME=fast-cdr
|
|
||||||
SET FAST_CDR_SOURCE_DIR=%CD%\%FAST_CDR_BASENAME%-source
|
|
||||||
SET FAST_CDR_REPO="https://github.com/eProsima/Fast-CDR.git"
|
|
||||||
CALL :build_fastdds_extension "%FAST_CDR_SOURCE_DIR%" "%FAST_CDR_REPO%"
|
|
||||||
pushd "%FAST_CDR_SOURCE_DIR%\build" >nul
|
|
||||||
cmake -G "Ninja" ^
|
|
||||||
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR%" ^
|
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="-D_GLIBCXX_USE_CXX11_ABI=0" ^
|
|
||||||
..
|
|
||||||
ninja
|
|
||||||
ninja install
|
|
||||||
popd >nul
|
|
||||||
rmdir /s /q "%FAST_CDR_SOURCE_DIR%"
|
|
||||||
|
|
||||||
echo Build fast dds
|
|
||||||
SET FAST_DDS_LIB_BASENAME=fast-dds-lib
|
|
||||||
SET FAST_DDS_LIB_SOURCE_DIR=%CD%\%FAST_DDS_LIB_BASENAME%-source
|
|
||||||
SET FAST_DDS_LIB_REPO="https://github.com/eProsima/Fast-DDS.git"
|
|
||||||
CALL :build_fastdds_extension "%FAST_DDS_LIB_SOURCE_DIR%" "%FAST_DDS_LIB_REPO%"
|
|
||||||
pushd "%FAST_DDS_LIB_SOURCE_DIR%\build" >nul
|
|
||||||
cmake -G "Ninja" ^
|
|
||||||
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR%" ^
|
|
||||||
-DCMAKE_CXX_FLAGS=-latomic ^
|
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="-D_GLIBCXX_USE_CXX11_ABI=0" ^
|
|
||||||
..
|
|
||||||
ninja
|
|
||||||
ninja install
|
|
||||||
popd >nul
|
|
||||||
rmdir /
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Assets download URL -----------------------------------------------------
|
rem -- Assets download URL -----------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
@ -384,7 +315,7 @@ set CMAKE_CONFIG_FILE=%INSTALLATION_DIR%CMakeLists.txt.in
|
||||||
>"%CMAKE_CONFIG_FILE%" echo # Automatically generated by Setup.bat
|
>"%CMAKE_CONFIG_FILE%" echo # Automatically generated by Setup.bat
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo set(CARLA_VERSION %carla_version%)
|
>>"%CMAKE_CONFIG_FILE%" echo set(CARLA_VERSION %carla_version%)
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo.
|
>>"%CMAKE_CONFIG_FILE%" echo.
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo set(CMAKE_CXX_STANDARD 14)
|
>>"%CMAKE_CONFIG_FILE%" echo set(CMAKE_CXX_STANDARD 20)
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
>>"%CMAKE_CONFIG_FILE%" echo set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo.
|
>>"%CMAKE_CONFIG_FILE%" echo.
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-D_WIN32_WINNT=0x0600)
|
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-D_WIN32_WINNT=0x0600)
|
||||||
|
@ -400,6 +331,11 @@ set CMAKE_CONFIG_FILE=%INSTALLATION_DIR%CMakeLists.txt.in
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include")
|
>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include")
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib")
|
>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib")
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo.
|
>>"%CMAKE_CONFIG_FILE%" echo.
|
||||||
|
>>"%CMAKE_CONFIG_FILE%" echo set(ROS2_MW_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%fastDDS-install/include")
|
||||||
|
>>"%CMAKE_CONFIG_FILE%" echo set(ROS2_MW_LIB_PATH "%CMAKE_INSTALLATION_DIR%fastDDS-install/lib")
|
||||||
|
>>"%CMAKE_CONFIG_FILE%" echo set(ROS2_MW_LINK_LIBRARIES "fastrtps;fastcdr")
|
||||||
|
>>"%CMAKE_CONFIG_FILE%" echo set(ROS2_MW_NAME "fastdds")
|
||||||
|
>>"%CMAKE_CONFIG_FILE%" echo.
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server")
|
>>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server")
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions
|
>>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions
|
||||||
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)
|
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,7 +16,6 @@ CARLA_PYTHONAPI_SOURCE_FOLDER=${CARLA_PYTHONAPI_ROOT_FOLDER}/carla
|
||||||
LIBCARLA_ROOT_FOLDER=${CURDIR}/LibCarla
|
LIBCARLA_ROOT_FOLDER=${CURDIR}/LibCarla
|
||||||
LIBCARLA_BUILD_SERVER_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-server-build
|
LIBCARLA_BUILD_SERVER_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-server-build
|
||||||
LIBCARLA_BUILD_PYTORCH_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-pytorch-build
|
LIBCARLA_BUILD_PYTORCH_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-pytorch-build
|
||||||
LIBCARLA_FASTDDS_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-fastdds-install
|
|
||||||
LIBCARLA_BUILD_CLIENT_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-client-build
|
LIBCARLA_BUILD_CLIENT_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-client-build
|
||||||
LIBCARLA_INSTALL_SERVER_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
LIBCARLA_INSTALL_SERVER_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
||||||
LIBCARLA_INSTALL_CLIENT_FOLDER=${CARLA_PYTHONAPI_SOURCE_FOLDER}/dependencies
|
LIBCARLA_INSTALL_CLIENT_FOLDER=${CARLA_PYTHONAPI_SOURCE_FOLDER}/dependencies
|
||||||
|
@ -27,8 +26,8 @@ OSM2ODR_SOURCE_FOLDER=${CARLA_BUILD_FOLDER}/libosm2dr-source
|
||||||
|
|
||||||
CARLAUE4_PLUGIN_DEPS_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
CARLAUE4_PLUGIN_DEPS_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
||||||
|
|
||||||
LIBSTDCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibStdCppToolChain.cmake
|
CARLA_CLIENT_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/CarlaClientToolChain.cmake
|
||||||
LIBCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibCppToolChain.cmake
|
CARLA_SERVER_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/CarlaServerToolChain.cmake
|
||||||
CMAKE_CONFIG_FILE=${CARLA_BUILD_FOLDER}/CMakeLists.txt.in
|
CMAKE_CONFIG_FILE=${CARLA_BUILD_FOLDER}/CMakeLists.txt.in
|
||||||
|
|
||||||
LIBCARLA_TEST_CONTENT_FOLDER=${CARLA_BUILD_FOLDER}/test-content
|
LIBCARLA_TEST_CONTENT_FOLDER=${CARLA_BUILD_FOLDER}/test-content
|
||||||
|
|
|
@ -62,14 +62,14 @@ PythonAPI: LibCarla osm2odr
|
||||||
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --py3
|
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --py3
|
||||||
|
|
||||||
server: setup
|
server: setup
|
||||||
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --server --generator "$(GENERATOR)"
|
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --server --generator "$(GENERATOR)" $(ARGS)
|
||||||
|
|
||||||
client: setup
|
client: setup
|
||||||
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --client --generator "$(GENERATOR)"
|
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --client --generator "$(GENERATOR)" $(ARGS)
|
||||||
|
|
||||||
.PHONY: LibCarla
|
.PHONY: LibCarla
|
||||||
LibCarla: setup
|
LibCarla: setup
|
||||||
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --server --client --generator "$(GENERATOR)"
|
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --server --client --generator "$(GENERATOR)" $(ARGS)
|
||||||
|
|
||||||
setup: downloadplugin
|
setup: downloadplugin
|
||||||
@"${CARLA_BUILD_TOOLS_FOLDER}/Setup.bat" --boost-toolset msvc-14.2 --generator "$(GENERATOR)" $(ARGS)
|
@"${CARLA_BUILD_TOOLS_FOLDER}/Setup.bat" --boost-toolset msvc-14.2 --generator "$(GENERATOR)" $(ARGS)
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017-2020 Intel Corporation
|
# Copyright (c) 2017-2024 Intel Corporation
|
||||||
#
|
#
|
||||||
# Helper script for code formatting using clang-format-3.9 and autopep
|
# Helper script for code formatting using clang-format-14 and autopep
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import filecmp
|
import filecmp
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sets
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
@ -31,9 +30,10 @@ class CodeFormatter:
|
||||||
|
|
||||||
def verifyFormatterVersion(self):
|
def verifyFormatterVersion(self):
|
||||||
try:
|
try:
|
||||||
versionOutput = subprocess.check_output([self.command, "--version"]).rstrip('\r\n')
|
versionOutputByteString = subprocess.check_output([self.command, "--version"])
|
||||||
|
versionOutput = versionOutputByteString.decode(encoding='UTF-8')
|
||||||
if self.expectedVersion != "":
|
if self.expectedVersion != "":
|
||||||
if versionOutput.startswith(self.expectedVersion):
|
if self.expectedVersion in versionOutput:
|
||||||
print("[OK] Found formatter '" + versionOutput + "'")
|
print("[OK] Found formatter '" + versionOutput + "'")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -41,8 +41,9 @@ class CodeFormatter:
|
||||||
cprint("[NOT OK] Version string does not start with '" + self.expectedVersion + "'", "red")
|
cprint("[NOT OK] Version string does not start with '" + self.expectedVersion + "'", "red")
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
except:
|
except subprocess.CalledProcessError as exc:
|
||||||
cprint("[ERROR] Could not run " + self.command, "red")
|
cprint("[ERROR] Could not run " + self.command, "red")
|
||||||
|
cprint("[ERROR] '" + exc.output + "'", "red")
|
||||||
cprint("[INFO] Please check if correct version is installed or install with '" +
|
cprint("[INFO] Please check if correct version is installed or install with '" +
|
||||||
self.installCommand + "'", "blue")
|
self.installCommand + "'", "blue")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -70,9 +71,9 @@ class CodeFormatter:
|
||||||
try:
|
try:
|
||||||
diffProcess = subprocess.Popen(
|
diffProcess = subprocess.Popen(
|
||||||
["git", "diff", "--color=always", "--exit-code", "--no-index", "--", fileName, "-"],
|
["git", "diff", "--color=always", "--exit-code", "--no-index", "--", fileName, "-"],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
diffOutput, _ = diffProcess.communicate(verifyOutput)
|
diffOutput, _ = diffProcess.communicate(verifyOutput)
|
||||||
if diffProcess.returncode == 0:
|
if diffProcess.returncode == 0:
|
||||||
diffOutput = ""
|
diffOutput = ""
|
||||||
|
@ -99,6 +100,8 @@ class CodeFormatter:
|
||||||
if status:
|
if status:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if not type(diffOutput) is str:
|
||||||
|
diffOutput = diffOutput.decode("utf-8")
|
||||||
if diffOutput != "":
|
if diffOutput != "":
|
||||||
cprint("[NOT OK] " + fileName, "red")
|
cprint("[NOT OK] " + fileName, "red")
|
||||||
if printDiff:
|
if printDiff:
|
||||||
|
@ -108,6 +111,9 @@ class CodeFormatter:
|
||||||
print("[OK] " + fileName)
|
print("[OK] " + fileName)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def setArgs(self, args):
|
||||||
|
self.args = args
|
||||||
|
|
||||||
|
|
||||||
class CodeFormatterClang(CodeFormatter):
|
class CodeFormatterClang(CodeFormatter):
|
||||||
CLANG_FORMAT_FILE = ".clang-format"
|
CLANG_FORMAT_FILE = ".clang-format"
|
||||||
|
@ -116,14 +122,14 @@ class CodeFormatterClang(CodeFormatter):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
CodeFormatter.__init__(self,
|
CodeFormatter.__init__(self,
|
||||||
command="clang-format-3.9",
|
command="clang-format-14",
|
||||||
expectedVersion="clang-format version 3.9",
|
expectedVersion="clang-format version 14",
|
||||||
formatCommandArguments=["-style=file", "-fallback-style=none", "-i"],
|
formatCommandArguments=["-style=file", "-fallback-style=none", "-i"],
|
||||||
verifyCommandArguments=["-style=file", "-fallback-style=none"],
|
verifyCommandArguments=["-style=file", "-fallback-style=none"],
|
||||||
verifyOutputIsDiff=False,
|
verifyOutputIsDiff=False,
|
||||||
fileEndings=["cpp", "hpp", "c", "h", "cc"],
|
fileEndings=["cpp", "hpp", "c", "h", "cc"],
|
||||||
fileDescription="source and header",
|
fileDescription="source and header",
|
||||||
installCommand="sudo apt-get install clang-format-3.9")
|
installCommand="sudo apt-get install clang-format-14")
|
||||||
self.scriptPath = os.path.dirname(os.path.abspath(__file__))
|
self.scriptPath = os.path.dirname(os.path.abspath(__file__))
|
||||||
self.checkedInClangFormatFile = os.path.join(self.scriptPath, CodeFormatterClang.CHECKED_IN_CLANG_FORMAT_FILE)
|
self.checkedInClangFormatFile = os.path.join(self.scriptPath, CodeFormatterClang.CHECKED_IN_CLANG_FORMAT_FILE)
|
||||||
|
|
||||||
|
@ -142,13 +148,13 @@ class CodeFormatterClang(CodeFormatter):
|
||||||
|
|
||||||
def confirmWithUserClangFormatFileCantBeVerified(self):
|
def confirmWithUserClangFormatFileCantBeVerified(self):
|
||||||
if not self.args.yes:
|
if not self.args.yes:
|
||||||
answer = raw_input("Are you sure your .clang-format file is up-to-date and you want to continue? (y/N)")
|
answer = input("Are you sure your .clang-format file is up-to-date and you want to continue? (y/N)")
|
||||||
if answer != "y":
|
if answer != "y":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def verifyClangFormatFileExistsAndMatchesCheckedIn(self):
|
def verifyClangFormatFileExistsAndMatchesCheckedIn(self):
|
||||||
self.verifyCheckedInClangFormatFileExists()
|
self.verifyCheckedInClangFormatFileExists()
|
||||||
foundClangFormatFiles = sets.Set()
|
foundClangFormatFiles = set()
|
||||||
for fileName in self.inputFiles:
|
for fileName in self.inputFiles:
|
||||||
dirName = os.path.dirname(os.path.abspath(fileName))
|
dirName = os.path.dirname(os.path.abspath(fileName))
|
||||||
if not self.findClangFormatFileStartingFrom(dirName, fileName, foundClangFormatFiles):
|
if not self.findClangFormatFileStartingFrom(dirName, fileName, foundClangFormatFiles):
|
||||||
|
@ -219,6 +225,7 @@ class CodeFormat:
|
||||||
|
|
||||||
def addCodeFormatter(self, codeFormatterInstance):
|
def addCodeFormatter(self, codeFormatterInstance):
|
||||||
self.codeFormatterInstances.append(codeFormatterInstance)
|
self.codeFormatterInstances.append(codeFormatterInstance)
|
||||||
|
codeFormatterInstance.setArgs(self.args)
|
||||||
|
|
||||||
def scanForInputFiles(self):
|
def scanForInputFiles(self):
|
||||||
for formatterInstance in self.codeFormatterInstances:
|
for formatterInstance in self.codeFormatterInstances:
|
||||||
|
@ -263,26 +270,26 @@ class CodeFormat:
|
||||||
|
|
||||||
def confirmWithUserFileIsOutsideGit(self, fileName):
|
def confirmWithUserFileIsOutsideGit(self, fileName):
|
||||||
cprint("[WARN] File is not in a Git repo: " + fileName, "yellow")
|
cprint("[WARN] File is not in a Git repo: " + fileName, "yellow")
|
||||||
answer = raw_input("Are you sure to code format it anyway? (y/Q)")
|
answer = input("Are you sure to code format it anyway? (y/Q)")
|
||||||
if answer != "y":
|
if answer != "y":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def confirmWithUserFileIsUntracked(self, fileName):
|
def confirmWithUserFileIsUntracked(self, fileName):
|
||||||
cprint("[WARN] File is untracked in Git: " + fileName, "yellow")
|
cprint("[WARN] File is untracked in Git: " + fileName, "yellow")
|
||||||
answer = raw_input("Are you sure to code format it anyway? (y/Q)")
|
answer = input("Are you sure to code format it anyway? (y/Q)")
|
||||||
if answer != "y":
|
if answer != "y":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def confirmWithUserGitRepoIsNotClean(self, gitRepo):
|
def confirmWithUserGitRepoIsNotClean(self, gitRepo):
|
||||||
cprint("[WARN] Git repo is not clean: " + gitRepo, "yellow")
|
cprint("[WARN] Git repo is not clean: " + gitRepo, "yellow")
|
||||||
answer = raw_input("Are you sure to code format files in it anyway? (y/Q)")
|
answer = input("Are you sure to code format files in it anyway? (y/Q)")
|
||||||
if answer != "y":
|
if answer != "y":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def checkInputFilesAreInCleanGitReposAndAreTracked(self):
|
def checkInputFilesAreInCleanGitReposAndAreTracked(self):
|
||||||
if self.args.verify or self.args.yes:
|
if self.args.verify or self.args.yes:
|
||||||
return
|
return
|
||||||
gitRepos = sets.Set()
|
gitRepos = set()
|
||||||
for formatterInstance in self.codeFormatterInstances:
|
for formatterInstance in self.codeFormatterInstances:
|
||||||
for fileName in formatterInstance.inputFiles:
|
for fileName in formatterInstance.inputFiles:
|
||||||
gitRepo = self.getGitRepoForFile(fileName)
|
gitRepo = self.getGitRepoForFile(fileName)
|
||||||
|
@ -308,7 +315,7 @@ class CodeFormat:
|
||||||
cwd=os.path.dirname(fileName))
|
cwd=os.path.dirname(fileName))
|
||||||
gitOutput, _ = gitProcess.communicate()
|
gitOutput, _ = gitProcess.communicate()
|
||||||
if gitProcess.returncode == 0:
|
if gitProcess.returncode == 0:
|
||||||
return gitOutput.rstrip('\r\n')
|
return gitOutput.decode(encoding='UTF-8').rstrip('\r\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
cprint("[ERROR] Failed to run 'git rev-parse --show-toplevel' for " + fileName, "red")
|
cprint("[ERROR] Failed to run 'git rev-parse --show-toplevel' for " + fileName, "red")
|
||||||
return None
|
return None
|
||||||
|
@ -322,7 +329,7 @@ class CodeFormat:
|
||||||
cwd=os.path.dirname(fileName))
|
cwd=os.path.dirname(fileName))
|
||||||
gitOutput, _ = gitProcess.communicate()
|
gitOutput, _ = gitProcess.communicate()
|
||||||
if gitProcess.returncode == 0:
|
if gitProcess.returncode == 0:
|
||||||
return gitOutput.rstrip('\r\n') == "true"
|
return gitOutput.decode(encoding='UTF-8').rstrip('\r\n') == "true"
|
||||||
except OSError:
|
except OSError:
|
||||||
cprint("[ERROR] Failed to run 'git rev-parse --is-inside-work-tree' for " + fileName, "red")
|
cprint("[ERROR] Failed to run 'git rev-parse --is-inside-work-tree' for " + fileName, "red")
|
||||||
return False
|
return False
|
||||||
|
@ -400,13 +407,19 @@ class CodeFormat:
|
||||||
elif (not self.args.verify) and (not self.args.yes) and self.numberOfInputFiles() > 1:
|
elif (not self.args.verify) and (not self.args.yes) and self.numberOfInputFiles() > 1:
|
||||||
for formatterInstance in self.codeFormatterInstances:
|
for formatterInstance in self.codeFormatterInstances:
|
||||||
formatterInstance.printInputFiles()
|
formatterInstance.printInputFiles()
|
||||||
answer = raw_input("Are you sure to code format " + str(self.numberOfInputFiles()) + " files? (y/N)")
|
answer = input("Are you sure to code format " + str(self.numberOfInputFiles()) + " files? (y/N)")
|
||||||
if answer != "y":
|
if answer != "y":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def checkPythonVersion(self):
|
||||||
|
if sys.version_info.major != 3:
|
||||||
|
cprint("[ERROR] Code Formatter runs in Python3 ", "red")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
codeFormat = CodeFormat()
|
codeFormat = CodeFormat()
|
||||||
|
codeFormat.checkPythonVersion()
|
||||||
codeFormat.parseCommandLine()
|
codeFormat.parseCommandLine()
|
||||||
codeFormat.printMode()
|
codeFormat.printMode()
|
||||||
|
|
||||||
|
@ -425,5 +438,6 @@ def main():
|
||||||
cprint("SUCCESS", "green")
|
cprint("SUCCESS", "green")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -14,6 +14,7 @@ echo %FILE_N% [Batch params]: %*
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Parse arguments ---------------------------------------------------------
|
rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -39,6 +40,11 @@ rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
|
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Get Eigen (Chrono dependency) -------------------------------------------
|
rem -- Get Eigen (Chrono dependency) -------------------------------------------
|
||||||
|
@ -101,12 +107,6 @@ if not exist %CHRONO_INSTALL_DIR% (
|
||||||
|
|
||||||
cd "%CHRONO_BUILD_DIR%"
|
cd "%CHRONO_BUILD_DIR%"
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
echo %FILE_N% Compiling Chrono.
|
echo %FILE_N% Compiling Chrono.
|
||||||
cmake -G %GENERATOR% %PLATFORM%^
|
cmake -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_BUILD_TYPE=Release^
|
-DCMAKE_BUILD_TYPE=Release^
|
||||||
|
|
|
@ -74,8 +74,18 @@ if not exist "%EIGEN_INSTALL_DIR%" (
|
||||||
|
|
||||||
xcopy /q /Y /S /I /d "%EIGEN_SRC_DIR%\Eigen" "%EIGEN_INCLUDE%\Eigen"
|
xcopy /q /Y /S /I /d "%EIGEN_SRC_DIR%\Eigen" "%EIGEN_INCLUDE%\Eigen"
|
||||||
xcopy /q /Y /S /I /d "%EIGEN_SRC_DIR%\unsupported\Eigen" "%EIGEN_INCLUDE%\unsupported\Eigen"
|
xcopy /q /Y /S /I /d "%EIGEN_SRC_DIR%\unsupported\Eigen" "%EIGEN_INCLUDE%\unsupported\Eigen"
|
||||||
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\Macros.h" "%EIGEN_INCLUDE%\Eigen\src\Core\util\Macros.h"
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\Functors.h" "%EIGEN_INCLUDE%\Eigen\src\Core\Functors.h"
|
||||||
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\VectorBlock.h" "%EIGEN_INCLUDE%\Eigen\src\Core\VectorBlock.h"
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\VectorBlock.h" "%EIGEN_INCLUDE%\Eigen\src\Core\VectorBlock.h"
|
||||||
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\PacketMath.h" "%EIGEN_INCLUDE%\Eigen\src\Core\arch\SSE\PacketMath.h"
|
||||||
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\SelfadjointMatrixVector.h" "%EIGEN_INCLUDE%\Eigen\src\Core\products\SelfadjointMatrixVector.h"
|
||||||
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\Macros.h" "%EIGEN_INCLUDE%\Eigen\src\Core\util\Macros.h"
|
||||||
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\ArrayCwiseUnaryOps.h" "%EIGEN_INCLUDE%\Eigen\src\plugins\ArrayCwiseUnaryOps.h"
|
||||||
|
copy "%BUILD_DIR%..\Util\Patches\Eigen3.1.0\MatrixCwiseUnaryOps.h" "%EIGEN_INCLUDE%\Eigen\src\plugins\MatrixCwiseUnaryOps.h"
|
||||||
|
|
||||||
|
cp $CARLA_ROOT_FOLDER/Util/Patches/Eigen${EIGEN_VERSION}/Macros.h "${EIGEN_BASENAME}-source/Eigen/src/Core/util/Macros.h"
|
||||||
|
cp $CARLA_ROOT_FOLDER/Util/Patches/Eigen${EIGEN_VERSION}/ArrayCwiseUnaryOps.h "${EIGEN_BASENAME}-source/Eigen/src/plugins/ArrayCwiseUnaryOps.h"
|
||||||
|
cp $CARLA_ROOT_FOLDER/Util/Patches/Eigen${EIGEN_VERSION}/MatrixCwiseUnaryOps.h "${EIGEN_BASENAME}-source/Eigen/src/plugins/MatrixCwiseUnaryOps.h"
|
||||||
|
|
||||||
|
|
||||||
goto success
|
goto success
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,11 @@ rem ============================================================================
|
||||||
rem -- Parse arguments ---------------------------------------------------------
|
rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
|
|
||||||
set DEL_SRC=false
|
set DEL_SRC=false
|
||||||
|
set BOOST_VERSION="unknown"
|
||||||
|
set FASTDDS_INSTALL_DIR=""
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -27,20 +31,48 @@ if not "%1"=="" (
|
||||||
set DEL_SRC=true
|
set DEL_SRC=true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "%1"=="--boost-version" (
|
||||||
|
set BOOST_VERSION=%2
|
||||||
|
shift
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="--install-dir" (
|
||||||
|
set FASTDDS_INSTALL_DIR=%2
|
||||||
|
shift
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="--generator" (
|
||||||
|
set GENERATOR=%2
|
||||||
|
shift
|
||||||
|
)
|
||||||
|
|
||||||
shift
|
shift
|
||||||
goto :arg-parse
|
goto :arg-parse
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
echo "%GENERATOR%" "%PLATFORM%"
|
||||||
|
|
||||||
rem If not set set the build dir to the current dir
|
rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
|
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
|
||||||
|
|
||||||
set FASTDDS_SRC=fastDDS-src
|
set FASTDDS_SRC=fastDDS-src
|
||||||
set FASTDDS_SRC_DIR=%BUILD_DIR%%FASTDDS_SRC%\
|
set FASTDDS_SRC_DIR=%BUILD_DIR%%FASTDDS_SRC%\
|
||||||
set FASTDDS_INSTALL=fastDDS-install
|
if "%FASTDDS_INSTALL_DIR%" == "" (
|
||||||
set FASTDDS_INSTALL_DIR=%BUILD_DIR%%FASTDDS_INSTALL%\
|
set FASTDDS_INSTALL=fastDDS-install
|
||||||
set FASTDDS_BUILD_DIR=%FASTDDS_SRC_DIR%build\
|
set FASTDDS_INSTALL_DIR=%BUILD_DIR%%FASTDDS_INSTALL%\
|
||||||
|
)
|
||||||
|
set FASTDDS_BUILD_DIR=%FASTDDS_SRC_DIR%build\fastdds
|
||||||
set FASTDDS_BASENAME=%FASTDDS_SRC%
|
set FASTDDS_BASENAME=%FASTDDS_SRC%
|
||||||
|
set FOONATHAN_MEMORY_VENDOR_BASENAME=foonathan-memory-vendor
|
||||||
|
set FOONATHAN_MEMORY_VENDOR_SOURCE_DIR=%FASTDDS_SRC_DIR%\thirdparty\foonathan-memory-vendor
|
||||||
|
set FOONATHAN_MEMORY_VENDOR_BUILD_DIR=%FASTDDS_SRC_DIR%build\foonathan-memory-vendor
|
||||||
|
|
||||||
if exist "%FASTDDS_INSTALL_DIR%" (
|
if exist "%FASTDDS_INSTALL_DIR%" (
|
||||||
goto already_build
|
goto already_build
|
||||||
|
@ -49,86 +81,86 @@ if exist "%FASTDDS_INSTALL_DIR%" (
|
||||||
if not exist "%FASTDDS_SRC_DIR%" (
|
if not exist "%FASTDDS_SRC_DIR%" (
|
||||||
echo %FILE_N% Cloning "Fast-DDS"
|
echo %FILE_N% Cloning "Fast-DDS"
|
||||||
|
|
||||||
call git clone https://github.com/eProsima/Fast-DDS.git "%FASTDDS_SRC_DIR:~0,-1%"
|
git clone --depth 1 --branch 2.11.3 https://github.com/eProsima/Fast-DDS.git "%FASTDDS_SRC_DIR:~0,-1%"
|
||||||
call git submodule init
|
|
||||||
call git submodule update
|
|
||||||
if %errorlevel% neq 0 goto error_git
|
if %errorlevel% neq 0 goto error_git
|
||||||
|
git submodule init
|
||||||
|
if %errorlevel% neq 0 goto error_git
|
||||||
|
git submodule update
|
||||||
|
if %errorlevel% neq 0 goto error_git
|
||||||
|
git clone --depth 1 --branch master https://github.com/eProsima/foonathan_memory_vendor.git "%FOONATHAN_MEMORY_VENDOR_SOURCE_DIR%"
|
||||||
) else (
|
) else (
|
||||||
echo %FILE_N% Not cloning "Fast-DDS" because already exists a folder called "%FASTDDS_SRC%".
|
echo %FILE_N% Not cloning "Fast-DDS" because already exists a folder called "%FASTDDS_SRC%".
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Compiling fastCDR dependency...
|
if not exist "%FOONATHAN_MEMORY_VENDOR_BUILD_DIR%" (
|
||||||
|
echo %FILE_N% Creating "%FOONATHAN_MEMORY_VENDOR_BUILD_DIR%"
|
||||||
if not exist "%FASTDDS_SRC_DIR%/thirdparty/fastcdr/build" (
|
mkdir "%FOONATHAN_MEMORY_VENDOR_BUILD_DIR%"
|
||||||
echo %FILE_N% Creating "%FASTDDS_SRC_DIR%/thirdparty/fastcdr/build"
|
|
||||||
cd "%FASTDDS_SRC_DIR%/thirdparty/fastcdr"
|
|
||||||
mkdir build
|
|
||||||
cd ../../
|
|
||||||
)
|
)
|
||||||
|
cd "%FOONATHAN_MEMORY_VENDOR_BUILD_DIR%"
|
||||||
|
|
||||||
cd "%FASTDDS_SRC_DIR%/thirdparty/fastcdr/build"
|
echo %FILE_N% Generating build: foonathan memory vendor ...
|
||||||
echo %FILE_N% Generating build...
|
cmake -G %GENERATOR% %PLATFORM%^
|
||||||
|
|
||||||
cmake .. -G "Visual Studio 16 2019" -A x64^
|
|
||||||
-DCMAKE_BUILD_TYPE=Release^
|
-DCMAKE_BUILD_TYPE=Release^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR:\=/%"^
|
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR:\=/%"^
|
||||||
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
-DBUILD_STATIC_LIBS=ON^
|
||||||
|
-DBUILD_SHARED_LIBS=OFF^
|
||||||
|
-DCMAKE_CXX_FLAGS="/DBOOST_NO_EXCEPTIONS /DASIO_NO_EXCEPTIONS"^
|
||||||
|
"%FOONATHAN_MEMORY_VENDOR_SOURCE_DIR%"
|
||||||
if %errorlevel% neq 0 goto error_cmake
|
if %errorlevel% neq 0 goto error_cmake
|
||||||
|
|
||||||
echo %FILE_N% Building...
|
echo %FILE_N% Building foonathan memory vendor...
|
||||||
cmake --build . --config Release --target install
|
cmake --build . --config Release --target install
|
||||||
|
|
||||||
if errorlevel neq 0 goto error_install
|
if exist "%FASTDDS_SRC_DIR%\thirdparty\boost\include\boost" (
|
||||||
|
echo %FILE_N% Preparing fastdds boost ...
|
||||||
|
@REM remove their boost includes, but keep their entry point
|
||||||
|
rd /s /q "%FASTDDS_SRC_DIR%\thirdparty\boost\include\boost"
|
||||||
|
@REM ensure the find boost compiles without exceptions
|
||||||
|
sed -i s/"CXX_STANDARD 11"/"CXX_STANDARD 11\n COMPILE_DEFINITIONS \"-DBOOST_NO_EXCEPTIONS\""/ "%FASTDDS_SRC_DIR%\cmake\modules\FindThirdpartyBoost.cmake"
|
||||||
|
sed -i s/"class ThirdpartyBoostCompileTest"/"#ifdef BOOST_NO_EXCEPTIONS\nnamespace boost {void throw_exception(std::exception const \& e) {}}\n#endif\nclass ThirdpartyBoostCompileTest"/ "%FASTDDS_SRC_DIR%\thirdparty\boost\test\ThirdpartyBoostCompile_test.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
cd ../../..
|
if exist "%FASTDDS_SRC_DIR%\src\cpp\utils\StringMatching.cpp" (
|
||||||
|
echo %FILE_N% Patching fastdds ...
|
||||||
@REM echo Compiling asio dependency...
|
sed -i s/"defined(__cplusplus_winrt)"/"(1)"/ "%FASTDDS_SRC_DIR%\src\cpp\utils\StringMatching.cpp"
|
||||||
|
sed -i s/"replace_all(pattern"/"replace_all(path"/ "%FASTDDS_SRC_DIR%\src\cpp\utils\StringMatching.cpp"
|
||||||
@REM if not exist "%FASTDDS_SRC_DIR%/thirdparty/asio/asio/build" (
|
)
|
||||||
@REM echo %FILE_N% Creating "%FASTDDS_SRC_DIR%/thirdparty/asio/asio/build"
|
|
||||||
@REM cd "%FASTDDS_SRC_DIR%/thirdparty/asio/asio"
|
|
||||||
@REM mkdir build
|
|
||||||
@REM cd ../../
|
|
||||||
@REM )
|
|
||||||
|
|
||||||
@REM cd "%FASTDDS_SRC_DIR%/thirdparty/asio/asio/build"
|
|
||||||
@REM echo %FILE_N% Generating build...
|
|
||||||
|
|
||||||
@REM cmake .. -G "Visual Studio 16 2019" -A x64^
|
|
||||||
@REM -DCMAKE_BUILD_TYPE=Release^
|
|
||||||
@REM -DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
|
||||||
@REM -DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR:\=/%"^
|
|
||||||
@REM -DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
|
||||||
@REM if %errorlevel% neq 0 goto error_cmake
|
|
||||||
|
|
||||||
@REM echo %FILE_N% Building...
|
|
||||||
@REM cmake --build . --config Release --target install
|
|
||||||
|
|
||||||
@REM if errorlevel neq 0 goto error_install
|
|
||||||
|
|
||||||
@REM cd ../../../..
|
|
||||||
|
|
||||||
if not exist "%FASTDDS_BUILD_DIR%" (
|
if not exist "%FASTDDS_BUILD_DIR%" (
|
||||||
echo %FILE_N% Creating "%FASTDDS_BUILD_DIR%"
|
echo %FILE_N% Creating "%FASTDDS_BUILD_DIR%"
|
||||||
mkdir "%FASTDDS_BUILD_DIR%"
|
mkdir "%FASTDDS_BUILD_DIR%"
|
||||||
)
|
)
|
||||||
|
|
||||||
cd "%FASTDDS_BUILD_DIR%"
|
cd "%FASTDDS_BUILD_DIR%"
|
||||||
echo %FILE_N% Generating build...
|
echo %FILE_N% Generating build: fastdds ...
|
||||||
|
|
||||||
cmake .. -G "Visual Studio 16 2019" -A x64^
|
cmake -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_BUILD_TYPE=Release^
|
-DCMAKE_BUILD_TYPE=Release^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR:\=/%"^
|
-DCMAKE_INSTALL_PREFIX="%FASTDDS_INSTALL_DIR:\=/%"^
|
||||||
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING^
|
-DCMAKE_MODULE_PATH="%FASTDDS_INSTALL_DIR:\=/%"^
|
||||||
|
-DBUILD_STATIC_LIBS=ON^
|
||||||
|
-DBUILD_SHARED_LIBS=OFF^
|
||||||
|
-DBUILD_TESTING=OFF^
|
||||||
|
-DCOMPILE_EXAMPLES=OFF^
|
||||||
|
-DCOMPILE_TOOLS=OFF^
|
||||||
|
-DTHIRDPARTY_Asio=FORCE^
|
||||||
|
-DTHIRDPARTY_fastcdr=FORCE^
|
||||||
|
-DTHIRDPARTY_TinyXML2=FORCE^
|
||||||
|
-DTHIRDPARTY_BOOST_INCLUDE_DIR="%BUILD_DIR%boost-%BOOST_VERSION%-install\include;%FASTDDS_SRC_DIR%\thirdparty\boost\include"^
|
||||||
|
-DCMAKE_CXX_FLAGS="/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING /DBOOST_NO_EXCEPTIONS /DASIO_NO_EXCEPTIONS"^
|
||||||
"%FASTDDS_SRC_DIR%"
|
"%FASTDDS_SRC_DIR%"
|
||||||
if %errorlevel% neq 0 goto error_cmake
|
if %errorlevel% neq 0 goto error_cmake
|
||||||
|
|
||||||
echo %FILE_N% Building...
|
echo %FILE_N% Building fastdds...
|
||||||
cmake --build . --config Release --target install
|
cmake --build . --config Release --target install
|
||||||
|
|
||||||
if errorlevel neq 0 goto error_install
|
if %errorlevel% neq 0 goto error_install
|
||||||
|
|
||||||
|
rem copy asio header files as they are not copied automatically by the above build, but we need those for handling the asio-exceptions
|
||||||
|
copy %FASTDDS_SRC_DIR%thirdparty\asio\asio\include\asio.hpp %INSTALLATION_DIR%fastDDS-install\include\ > NUL
|
||||||
|
xcopy /Y /S /I %FASTDDS_SRC_DIR%thirdparty\asio\asio\include\asio\* %INSTALLATION_DIR%fastDDS-install\include\asio\* > NUL
|
||||||
|
if %errorlevel% neq 0 goto error_install
|
||||||
|
|
||||||
rem Remove the downloaded Fast-DDS source because is no more needed
|
rem Remove the downloaded Fast-DDS source because is no more needed
|
||||||
if %DEL_SRC% == true (
|
if %DEL_SRC% == true (
|
||||||
|
@ -179,7 +211,7 @@ rem ============================================================================
|
||||||
|
|
||||||
:good_exit
|
:good_exit
|
||||||
echo %FILE_N% Exiting...
|
echo %FILE_N% Exiting...
|
||||||
endlocal & set install_recast=%FASTDDS_INSTALL_DIR%
|
endlocal & set install_dds=%FASTDDS_INSTALL_DIR%
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
:bad_exit
|
:bad_exit
|
||||||
|
|
|
@ -16,6 +16,7 @@ rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
set DEL_SRC=false
|
set DEL_SRC=false
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -36,6 +37,11 @@ if not "%1"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
rem If not set set the build dir to the current dir
|
rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
|
@ -69,12 +75,6 @@ if not exist "%GT_BUILD_DIR%" (
|
||||||
cd "%GT_BUILD_DIR%"
|
cd "%GT_BUILD_DIR%"
|
||||||
echo %FILE_N% Generating build...
|
echo %FILE_N% Generating build...
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
cmake .. -G %GENERATOR% %PLATFORM%^
|
cmake .. -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_BUILD_TYPE=Release^
|
-DCMAKE_BUILD_TYPE=Release^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
|
|
|
@ -15,6 +15,8 @@ rem ============================================================================
|
||||||
rem -- Parse arguments ---------------------------------------------------------
|
rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
if "%1"=="--build-dir" (
|
if "%1"=="--build-dir" (
|
||||||
|
@ -36,6 +38,11 @@ if not "%1"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
rem If not set set the build dir to the current dir
|
rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
|
@ -79,12 +86,6 @@ move %BUILD_DIR%%PROJ_BASE_NAME% %PROJ_SRC_DIR%
|
||||||
mkdir %PROJ_BUILD_DIR%
|
mkdir %PROJ_BUILD_DIR%
|
||||||
cd %PROJ_BUILD_DIR%
|
cd %PROJ_BUILD_DIR%
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
cmake .. -G %GENERATOR% %PLATFORM%^
|
cmake .. -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
-DCMAKE_CXX_FLAGS="/MD /MP"^
|
-DCMAKE_CXX_FLAGS="/MD /MP"^
|
||||||
|
|
|
@ -15,6 +15,7 @@ rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
set DEL_SRC=false
|
set DEL_SRC=false
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -35,6 +36,11 @@ if not "%1"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
rem If not set set the build dir to the current dir
|
rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
|
@ -71,12 +77,6 @@ if not exist "%RECAST_BUILD_DIR%" (
|
||||||
cd "%RECAST_BUILD_DIR%"
|
cd "%RECAST_BUILD_DIR%"
|
||||||
echo %FILE_N% Generating build...
|
echo %FILE_N% Generating build...
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
cmake .. -G %GENERATOR% %PLATFORM%^
|
cmake .. -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_BUILD_TYPE=Release^
|
-DCMAKE_BUILD_TYPE=Release^
|
||||||
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
|
||||||
|
|
|
@ -16,6 +16,7 @@ rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
set DEL_SRC=false
|
set DEL_SRC=false
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
|
|
@ -14,6 +14,7 @@ echo %FILE_N% [Batch params]: %*
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Parse arguments ---------------------------------------------------------
|
rem -- Parse arguments ---------------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
set GENERATOR=""
|
||||||
|
|
||||||
:arg-parse
|
:arg-parse
|
||||||
if not "%1"=="" (
|
if not "%1"=="" (
|
||||||
|
@ -36,6 +37,11 @@ if not "%1"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
if %GENERATOR% == "" set GENERATOR="Visual Studio 16 2019"
|
||||||
|
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
||||||
|
set PLATFORM=-A x64
|
||||||
|
) || (
|
||||||
|
set PLATFORM=
|
||||||
|
)
|
||||||
|
|
||||||
rem If not set set the build dir to the current dir
|
rem If not set set the build dir to the current dir
|
||||||
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
|
||||||
|
@ -121,12 +127,6 @@ if not exist "%XERCESC_INSTALL_DIR%include" (
|
||||||
mkdir "%XERCESC_INSTALL_DIR%include"
|
mkdir "%XERCESC_INSTALL_DIR%include"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && (
|
|
||||||
set PLATFORM=-A x64
|
|
||||||
) || (
|
|
||||||
set PLATFORM=
|
|
||||||
)
|
|
||||||
|
|
||||||
cmake .. -G %GENERATOR% %PLATFORM%^
|
cmake .. -G %GENERATOR% %PLATFORM%^
|
||||||
-DCMAKE_INSTALL_PREFIX="%XERCESC_INSTALL_DIR:\=/%"^
|
-DCMAKE_INSTALL_PREFIX="%XERCESC_INSTALL_DIR:\=/%"^
|
||||||
-DBUILD_SHARED_LIBS=OFF^
|
-DBUILD_SHARED_LIBS=OFF^
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise absolute value of \c *this
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_abs.cpp
|
||||||
|
* Output: \verbinclude Cwise_abs.out
|
||||||
|
*
|
||||||
|
* \sa abs2()
|
||||||
|
*/
|
||||||
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
|
||||||
|
abs() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise squared absolute value of \c *this
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_abs2.cpp
|
||||||
|
* Output: \verbinclude Cwise_abs2.out
|
||||||
|
*
|
||||||
|
* \sa abs(), square()
|
||||||
|
*/
|
||||||
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
|
||||||
|
abs2() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise exponential of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_exp.cpp
|
||||||
|
* Output: \verbinclude Cwise_exp.out
|
||||||
|
*
|
||||||
|
* \sa pow(), log(), sin(), cos()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived>
|
||||||
|
exp() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise logarithm of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_log.cpp
|
||||||
|
* Output: \verbinclude Cwise_log.out
|
||||||
|
*
|
||||||
|
* \sa exp()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived>
|
||||||
|
log() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise square root of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_sqrt.cpp
|
||||||
|
* Output: \verbinclude Cwise_sqrt.out
|
||||||
|
*
|
||||||
|
* \sa pow(), square()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
|
||||||
|
sqrt() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise cosine of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_cos.cpp
|
||||||
|
* Output: \verbinclude Cwise_cos.out
|
||||||
|
*
|
||||||
|
* \sa sin(), acos()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived>
|
||||||
|
cos() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise sine of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_sin.cpp
|
||||||
|
* Output: \verbinclude Cwise_sin.out
|
||||||
|
*
|
||||||
|
* \sa cos(), asin()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived>
|
||||||
|
sin() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise arc cosine of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_acos.cpp
|
||||||
|
* Output: \verbinclude Cwise_acos.out
|
||||||
|
*
|
||||||
|
* \sa cos(), asin()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived>
|
||||||
|
acos() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise arc sine of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_asin.cpp
|
||||||
|
* Output: \verbinclude Cwise_asin.out
|
||||||
|
*
|
||||||
|
* \sa sin(), acos()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived>
|
||||||
|
asin() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise tan of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_tan.cpp
|
||||||
|
* Output: \verbinclude Cwise_tan.out
|
||||||
|
*
|
||||||
|
* \sa cos(), sin()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_tan_op<Scalar>, Derived>
|
||||||
|
tan() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise power of *this to the given exponent.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_pow.cpp
|
||||||
|
* Output: \verbinclude Cwise_pow.out
|
||||||
|
*
|
||||||
|
* \sa exp(), log()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived>
|
||||||
|
pow(const Scalar& exponent) const
|
||||||
|
{
|
||||||
|
return CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived>
|
||||||
|
(derived(), internal::scalar_pow_op<Scalar>(exponent));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise inverse of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_inverse.cpp
|
||||||
|
* Output: \verbinclude Cwise_inverse.out
|
||||||
|
*
|
||||||
|
* \sa operator/(), operator*()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
|
||||||
|
inverse() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise square of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_square.cpp
|
||||||
|
* Output: \verbinclude Cwise_square.out
|
||||||
|
*
|
||||||
|
* \sa operator/(), operator*(), abs2()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived>
|
||||||
|
square() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise cube of *this.
|
||||||
|
*
|
||||||
|
* Example: \include Cwise_cube.cpp
|
||||||
|
* Output: \verbinclude Cwise_cube.out
|
||||||
|
*
|
||||||
|
* \sa square(), pow()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived>
|
||||||
|
cube() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __cplusplus < 201703L
|
||||||
|
|
||||||
|
#define EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(METHOD_NAME,FUNCTOR) \
|
||||||
|
inline const CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \
|
||||||
|
METHOD_NAME(const Scalar& s) const { \
|
||||||
|
return CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \
|
||||||
|
(derived(), std::bind2nd(FUNCTOR<Scalar>(), s)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator==, std::equal_to)
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator!=, std::not_equal_to)
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<, std::less)
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<=, std::less_equal)
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>, std::greater)
|
||||||
|
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>=, std::greater_equal)
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,85 @@
|
||||||
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
|
// for linear algebra.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||||
|
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||||
|
//
|
||||||
|
// Eigen is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 3 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Alternatively, you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License and a copy of the GNU General Public License along with
|
||||||
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// This file is a base class plugin containing matrix specifics coefficient wise functions.
|
||||||
|
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise absolute value of \c *this
|
||||||
|
*
|
||||||
|
* Example: \include MatrixBase_cwiseAbs.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwiseAbs.out
|
||||||
|
*
|
||||||
|
* \sa cwiseAbs2()
|
||||||
|
*/
|
||||||
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
|
||||||
|
cwiseAbs() const { return derived(); }
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise squared absolute value of \c *this
|
||||||
|
*
|
||||||
|
* Example: \include MatrixBase_cwiseAbs2.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwiseAbs2.out
|
||||||
|
*
|
||||||
|
* \sa cwiseAbs()
|
||||||
|
*/
|
||||||
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
|
||||||
|
cwiseAbs2() const { return derived(); }
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise square root of *this.
|
||||||
|
*
|
||||||
|
* Example: \include MatrixBase_cwiseSqrt.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwiseSqrt.out
|
||||||
|
*
|
||||||
|
* \sa cwisePow(), cwiseSquare()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
|
||||||
|
cwiseSqrt() const { return derived(); }
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise inverse of *this.
|
||||||
|
*
|
||||||
|
* Example: \include MatrixBase_cwiseInverse.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwiseInverse.out
|
||||||
|
*
|
||||||
|
* \sa cwiseProduct()
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
|
||||||
|
cwiseInverse() const { return derived(); }
|
||||||
|
|
||||||
|
#if __cplusplus < 201703L
|
||||||
|
/** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s
|
||||||
|
*
|
||||||
|
* \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
|
||||||
|
* In order to check for equality between two vectors or matrices with floating-point coefficients, it is
|
||||||
|
* generally a far better idea to use a fuzzy comparison as provided by isApprox() and
|
||||||
|
* isMuchSmallerThan().
|
||||||
|
*
|
||||||
|
* \sa cwiseEqual(const MatrixBase<OtherDerived> &) const
|
||||||
|
*/
|
||||||
|
inline const CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >, const Derived>
|
||||||
|
cwiseEqual(const Scalar& s) const
|
||||||
|
{
|
||||||
|
return CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >,const Derived>
|
||||||
|
(derived(), std::bind1st(std::equal_to<Scalar>(), s));
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,647 @@
|
||||||
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
|
// for linear algebra.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||||
|
//
|
||||||
|
// Eigen is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 3 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Alternatively, you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License and a copy of the GNU General Public License along with
|
||||||
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef EIGEN_PACKET_MATH_SSE_H
|
||||||
|
#define EIGEN_PACKET_MATH_SSE_H
|
||||||
|
|
||||||
|
namespace Eigen {
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
|
||||||
|
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS
|
||||||
|
#define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS (2*sizeof(void*))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef __m128 Packet4f;
|
||||||
|
typedef __m128i Packet4i;
|
||||||
|
typedef __m128d Packet2d;
|
||||||
|
|
||||||
|
template<> struct is_arithmetic<__m128> { enum { value = true }; };
|
||||||
|
template<> struct is_arithmetic<__m128i> { enum { value = true }; };
|
||||||
|
template<> struct is_arithmetic<__m128d> { enum { value = true }; };
|
||||||
|
|
||||||
|
#define vec4f_swizzle1(v,p,q,r,s) \
|
||||||
|
(_mm_castsi128_ps(_mm_shuffle_epi32( _mm_castps_si128(v), ((s)<<6|(r)<<4|(q)<<2|(p)))))
|
||||||
|
|
||||||
|
#define vec4i_swizzle1(v,p,q,r,s) \
|
||||||
|
(_mm_shuffle_epi32( v, ((s)<<6|(r)<<4|(q)<<2|(p))))
|
||||||
|
|
||||||
|
#define vec2d_swizzle1(v,p,q) \
|
||||||
|
(_mm_castsi128_pd(_mm_shuffle_epi32( _mm_castpd_si128(v), ((q*2+1)<<6|(q*2)<<4|(p*2+1)<<2|(p*2)))))
|
||||||
|
|
||||||
|
#define vec4f_swizzle2(a,b,p,q,r,s) \
|
||||||
|
(_mm_shuffle_ps( (a), (b), ((s)<<6|(r)<<4|(q)<<2|(p))))
|
||||||
|
|
||||||
|
#define vec4i_swizzle2(a,b,p,q,r,s) \
|
||||||
|
(_mm_castps_si128( (_mm_shuffle_ps( _mm_castsi128_ps(a), _mm_castsi128_ps(b), ((s)<<6|(r)<<4|(q)<<2|(p))))))
|
||||||
|
|
||||||
|
#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
|
||||||
|
const Packet4f p4f_##NAME = pset1<Packet4f>(X)
|
||||||
|
|
||||||
|
#define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \
|
||||||
|
const Packet4f p4f_##NAME = _mm_castsi128_ps(pset1<Packet4i>(X))
|
||||||
|
|
||||||
|
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
|
||||||
|
const Packet4i p4i_##NAME = pset1<Packet4i>(X)
|
||||||
|
|
||||||
|
|
||||||
|
template<> struct packet_traits<float> : default_packet_traits
|
||||||
|
{
|
||||||
|
typedef Packet4f type;
|
||||||
|
enum {
|
||||||
|
Vectorizable = 1,
|
||||||
|
AlignedOnScalar = 1,
|
||||||
|
size=4,
|
||||||
|
|
||||||
|
HasDiv = 1,
|
||||||
|
HasSin = EIGEN_FAST_MATH,
|
||||||
|
HasCos = EIGEN_FAST_MATH,
|
||||||
|
HasLog = 1,
|
||||||
|
HasExp = 1,
|
||||||
|
HasSqrt = 1
|
||||||
|
};
|
||||||
|
};
|
||||||
|
template<> struct packet_traits<double> : default_packet_traits
|
||||||
|
{
|
||||||
|
typedef Packet2d type;
|
||||||
|
enum {
|
||||||
|
Vectorizable = 1,
|
||||||
|
AlignedOnScalar = 1,
|
||||||
|
size=2,
|
||||||
|
|
||||||
|
HasDiv = 1
|
||||||
|
};
|
||||||
|
};
|
||||||
|
template<> struct packet_traits<int> : default_packet_traits
|
||||||
|
{
|
||||||
|
typedef Packet4i type;
|
||||||
|
enum {
|
||||||
|
// FIXME check the Has*
|
||||||
|
Vectorizable = 1,
|
||||||
|
AlignedOnScalar = 1,
|
||||||
|
size=4
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
|
||||||
|
template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2}; };
|
||||||
|
template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER==1500)
|
||||||
|
// Workaround MSVC 9 internal compiler error.
|
||||||
|
// TODO: It has been detected with win64 builds (amd64), so let's check whether it also happens in 32bits+SSE mode
|
||||||
|
// TODO: let's check whether there does not exist a better fix, like adding a pset0() function. (it crashed on pset1(0)).
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set_ps(from,from,from,from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set_pd(from,from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set_epi32(from,from,from,from); }
|
||||||
|
#else
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set1_ps(from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set1_epi32(from); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a) { return _mm_add_ps(pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d plset<double>(const double& a) { return _mm_add_pd(pset1<Packet2d>(a),_mm_set_pd(1,0)); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i plset<int>(const int& a) { return _mm_add_epi32(pset1<Packet4i>(a),_mm_set_epi32(3,2,1,0)); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_add_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_add_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_add_epi32(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_sub_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_sub_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_sub_epi32(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a)
|
||||||
|
{
|
||||||
|
const Packet4f mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x80000000,0x80000000,0x80000000));
|
||||||
|
return _mm_xor_ps(a,mask);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pnegate(const Packet2d& a)
|
||||||
|
{
|
||||||
|
const Packet2d mask = _mm_castsi128_pd(_mm_setr_epi32(0x0,0x80000000,0x0,0x80000000));
|
||||||
|
return _mm_xor_pd(a,mask);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a)
|
||||||
|
{
|
||||||
|
return psub(_mm_setr_epi32(0,0,0,0), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_mul_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pmul<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_mul_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(const Packet4i& a, const Packet4i& b)
|
||||||
|
{
|
||||||
|
#ifdef EIGEN_VECTORIZE_SSE4_1
|
||||||
|
return _mm_mullo_epi32(a,b);
|
||||||
|
#else
|
||||||
|
// this version is slightly faster than 4 scalar products
|
||||||
|
return vec4i_swizzle1(
|
||||||
|
vec4i_swizzle2(
|
||||||
|
_mm_mul_epu32(a,b),
|
||||||
|
_mm_mul_epu32(vec4i_swizzle1(a,1,0,3,2),
|
||||||
|
vec4i_swizzle1(b,1,0,3,2)),
|
||||||
|
0,2,0,2),
|
||||||
|
0,2,1,3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_div_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pdiv<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_div_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
|
||||||
|
{ eigen_assert(false && "packet integer division are not supported by SSE");
|
||||||
|
return pset1<Packet4i>(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for some weird raisons, it has to be overloaded for packet of integers
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd(pmul(a,b), c); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_min_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_min_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b)
|
||||||
|
{
|
||||||
|
// after some bench, this version *is* faster than a scalar implementation
|
||||||
|
Packet4i mask = _mm_cmplt_epi32(a,b);
|
||||||
|
return _mm_or_si128(_mm_and_si128(mask,a),_mm_andnot_si128(mask,b));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_max_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_max_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b)
|
||||||
|
{
|
||||||
|
// after some bench, this version *is* faster than a scalar implementation
|
||||||
|
Packet4i mask = _mm_cmpgt_epi32(a,b);
|
||||||
|
return _mm_or_si128(_mm_and_si128(mask,a),_mm_andnot_si128(mask,b));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_and_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pand<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_and_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_and_si128(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_or_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d por<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_or_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_or_si128(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_xor_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_xor_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_xor_si128(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_andnot_ps(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pandnot<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_andnot_pd(a,b); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_andnot_si128(a,b); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_ps(from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_pd(from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_si128(reinterpret_cast<const Packet4i*>(from)); }
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from) {
|
||||||
|
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||||
|
#if (_MSC_VER==1600)
|
||||||
|
// NOTE Some version of MSVC10 generates bad code when using _mm_loadu_ps
|
||||||
|
// (i.e., it does not generate an unaligned load!!
|
||||||
|
// TODO On most architectures this version should also be faster than a single _mm_loadu_ps
|
||||||
|
// so we could also enable it for MSVC08 but first we have to make this later does not generate crap when doing so...
|
||||||
|
__m128 res = _mm_loadl_pi(_mm_set1_ps(0.0f), (const __m64*)(from));
|
||||||
|
res = _mm_loadh_pi(res, (const __m64*)(from+2));
|
||||||
|
return res;
|
||||||
|
#else
|
||||||
|
return _mm_loadu_ps(from);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_pd(from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_si128(reinterpret_cast<const Packet4i*>(from)); }
|
||||||
|
#else
|
||||||
|
// Fast unaligned loads. Note that here we cannot directly use intrinsics: this would
|
||||||
|
// require pointer casting to incompatible pointer types and leads to invalid code
|
||||||
|
// because of the strict aliasing rule. The "dummy" stuff are required to enforce
|
||||||
|
// a correct instruction dependency.
|
||||||
|
// TODO: do the same for MSVC (ICC is compatible)
|
||||||
|
// NOTE: with the code below, MSVC's compiler crashes!
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(__i386__)
|
||||||
|
// bug 195: gcc/i386 emits weird x87 fldl/fstpl instructions for _mm_load_sd
|
||||||
|
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 1
|
||||||
|
#elif defined(__clang__)
|
||||||
|
// bug 201: Segfaults in __mm_loadh_pd with clang 2.8
|
||||||
|
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 1
|
||||||
|
#else
|
||||||
|
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from)
|
||||||
|
{
|
||||||
|
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||||
|
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||||
|
return _mm_loadu_ps(from);
|
||||||
|
#else
|
||||||
|
__m128d res;
|
||||||
|
res = _mm_load_sd((const double*)(from)) ;
|
||||||
|
res = _mm_loadh_pd(res, (const double*)(from+2)) ;
|
||||||
|
return _mm_castpd_ps(res);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from)
|
||||||
|
{
|
||||||
|
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||||
|
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||||
|
return _mm_loadu_pd(from);
|
||||||
|
#else
|
||||||
|
__m128d res;
|
||||||
|
res = _mm_load_sd(from) ;
|
||||||
|
res = _mm_loadh_pd(res,from+1);
|
||||||
|
return res;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
|
||||||
|
{
|
||||||
|
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||||
|
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||||
|
return _mm_loadu_si128(reinterpret_cast<const Packet4i*>(from));
|
||||||
|
#else
|
||||||
|
__m128d res;
|
||||||
|
res = _mm_load_sd((const double*)(from)) ;
|
||||||
|
res = _mm_loadh_pd(res, (const double*)(from+2)) ;
|
||||||
|
return _mm_castpd_si128(res);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)
|
||||||
|
{
|
||||||
|
return vec4f_swizzle1(_mm_castpd_ps(_mm_load_sd(reinterpret_cast<const double*>(from))), 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from)
|
||||||
|
{ return pset1<Packet2d>(from[0]); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int* from)
|
||||||
|
{
|
||||||
|
Packet4i tmp;
|
||||||
|
tmp = _mm_loadl_epi64(reinterpret_cast<const Packet4i*>(from));
|
||||||
|
return vec4i_swizzle1(tmp, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_ps(to, from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_pd(to, from); }
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_si128(reinterpret_cast<Packet4i*>(to), from); }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d& from) {
|
||||||
|
EIGEN_DEBUG_UNALIGNED_STORE
|
||||||
|
_mm_storel_pd((to), from);
|
||||||
|
_mm_storeh_pd((to+1), from);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), _mm_castps_pd(from)); }
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), _mm_castsi128_pd(from)); }
|
||||||
|
|
||||||
|
// some compilers might be tempted to perform multiple moves instead of using a vector path.
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstore1<Packet4f>(float* to, const float& a)
|
||||||
|
{
|
||||||
|
Packet4f pa = _mm_set_ss(a);
|
||||||
|
pstore(to, vec4f_swizzle1(pa,0,0,0,0));
|
||||||
|
}
|
||||||
|
// some compilers might be tempted to perform multiple moves instead of using a vector path.
|
||||||
|
template<> EIGEN_STRONG_INLINE void pstore1<Packet2d>(double* to, const double& a)
|
||||||
|
{
|
||||||
|
Packet2d pa = _mm_set_sd(a);
|
||||||
|
pstore(to, vec2d_swizzle1(pa,0,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||||
|
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||||
|
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
|
||||||
|
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
|
||||||
|
// Direct of the struct members fixed bug #62.
|
||||||
|
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }
|
||||||
|
template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { return a.m128d_f64[0]; }
|
||||||
|
template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
|
||||||
|
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||||
|
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
|
||||||
|
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float x = _mm_cvtss_f32(a); return x; }
|
||||||
|
template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { double x = _mm_cvtsd_f64(a); return x; }
|
||||||
|
template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
|
||||||
|
#else
|
||||||
|
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return _mm_cvtss_f32(a); }
|
||||||
|
template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { return _mm_cvtsd_f64(a); }
|
||||||
|
template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { return _mm_cvtsi128_si32(a); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)
|
||||||
|
{ return _mm_shuffle_ps(a,a,0x1B); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d preverse(const Packet2d& a)
|
||||||
|
{ return _mm_shuffle_pd(a,a,0x1); }
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a)
|
||||||
|
{ return _mm_shuffle_epi32(a,0x1B); }
|
||||||
|
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f& a)
|
||||||
|
{
|
||||||
|
const Packet4f mask = _mm_castsi128_ps(_mm_setr_epi32(0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF));
|
||||||
|
return _mm_and_ps(a,mask);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d pabs(const Packet2d& a)
|
||||||
|
{
|
||||||
|
const Packet2d mask = _mm_castsi128_pd(_mm_setr_epi32(0xFFFFFFFF,0x7FFFFFFF,0xFFFFFFFF,0x7FFFFFFF));
|
||||||
|
return _mm_and_pd(a,mask);
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i pabs(const Packet4i& a)
|
||||||
|
{
|
||||||
|
#ifdef EIGEN_VECTORIZE_SSSE3
|
||||||
|
return _mm_abs_epi32(a);
|
||||||
|
#else
|
||||||
|
Packet4i aux = _mm_srai_epi32(a,31);
|
||||||
|
return _mm_sub_epi32(_mm_xor_si128(a,aux),aux);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_STRONG_INLINE void punpackp(Packet4f* vecs)
|
||||||
|
{
|
||||||
|
vecs[1] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0x55));
|
||||||
|
vecs[2] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0xAA));
|
||||||
|
vecs[3] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0xFF));
|
||||||
|
vecs[0] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0x00));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef EIGEN_VECTORIZE_SSE3
|
||||||
|
// TODO implement SSE2 versions as well as integer versions
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
|
||||||
|
{
|
||||||
|
return _mm_hadd_ps(_mm_hadd_ps(vecs[0], vecs[1]),_mm_hadd_ps(vecs[2], vecs[3]));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(const Packet2d* vecs)
|
||||||
|
{
|
||||||
|
return _mm_hadd_pd(vecs[0], vecs[1]);
|
||||||
|
}
|
||||||
|
// SSSE3 version:
|
||||||
|
// EIGEN_STRONG_INLINE Packet4i preduxp(const Packet4i* vecs)
|
||||||
|
// {
|
||||||
|
// return _mm_hadd_epi32(_mm_hadd_epi32(vecs[0], vecs[1]),_mm_hadd_epi32(vecs[2], vecs[3]));
|
||||||
|
// }
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
|
||||||
|
{
|
||||||
|
Packet4f tmp0 = _mm_hadd_ps(a,a);
|
||||||
|
return pfirst(_mm_hadd_ps(tmp0, tmp0));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a) { return pfirst(_mm_hadd_pd(a, a)); }
|
||||||
|
|
||||||
|
// SSSE3 version:
|
||||||
|
// EIGEN_STRONG_INLINE float predux(const Packet4i& a)
|
||||||
|
// {
|
||||||
|
// Packet4i tmp0 = _mm_hadd_epi32(a,a);
|
||||||
|
// return pfirst(_mm_hadd_epi32(tmp0, tmp0));
|
||||||
|
// }
|
||||||
|
#else
|
||||||
|
// SSE2 versions
|
||||||
|
template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
|
||||||
|
{
|
||||||
|
Packet4f tmp = _mm_add_ps(a, _mm_movehl_ps(a,a));
|
||||||
|
return pfirst(_mm_add_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a)
|
||||||
|
{
|
||||||
|
return pfirst(_mm_add_sd(a, _mm_unpackhi_pd(a,a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
|
||||||
|
{
|
||||||
|
Packet4f tmp0, tmp1, tmp2;
|
||||||
|
tmp0 = _mm_unpacklo_ps(vecs[0], vecs[1]);
|
||||||
|
tmp1 = _mm_unpackhi_ps(vecs[0], vecs[1]);
|
||||||
|
tmp2 = _mm_unpackhi_ps(vecs[2], vecs[3]);
|
||||||
|
tmp0 = _mm_add_ps(tmp0, tmp1);
|
||||||
|
tmp1 = _mm_unpacklo_ps(vecs[2], vecs[3]);
|
||||||
|
tmp1 = _mm_add_ps(tmp1, tmp2);
|
||||||
|
tmp2 = _mm_movehl_ps(tmp1, tmp0);
|
||||||
|
tmp0 = _mm_movelh_ps(tmp0, tmp1);
|
||||||
|
return _mm_add_ps(tmp0, tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(const Packet2d* vecs)
|
||||||
|
{
|
||||||
|
return _mm_add_pd(_mm_unpacklo_pd(vecs[0], vecs[1]), _mm_unpackhi_pd(vecs[0], vecs[1]));
|
||||||
|
}
|
||||||
|
#endif // SSE3
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a)
|
||||||
|
{
|
||||||
|
Packet4i tmp = _mm_add_epi32(a, _mm_unpackhi_epi64(a,a));
|
||||||
|
return pfirst(tmp) + pfirst(_mm_shuffle_epi32(tmp, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(const Packet4i* vecs)
|
||||||
|
{
|
||||||
|
Packet4i tmp0, tmp1, tmp2;
|
||||||
|
tmp0 = _mm_unpacklo_epi32(vecs[0], vecs[1]);
|
||||||
|
tmp1 = _mm_unpackhi_epi32(vecs[0], vecs[1]);
|
||||||
|
tmp2 = _mm_unpackhi_epi32(vecs[2], vecs[3]);
|
||||||
|
tmp0 = _mm_add_epi32(tmp0, tmp1);
|
||||||
|
tmp1 = _mm_unpacklo_epi32(vecs[2], vecs[3]);
|
||||||
|
tmp1 = _mm_add_epi32(tmp1, tmp2);
|
||||||
|
tmp2 = _mm_unpacklo_epi64(tmp0, tmp1);
|
||||||
|
tmp0 = _mm_unpackhi_epi64(tmp0, tmp1);
|
||||||
|
return _mm_add_epi32(tmp0, tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other reduction functions:
|
||||||
|
|
||||||
|
// mul
|
||||||
|
template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)
|
||||||
|
{
|
||||||
|
Packet4f tmp = _mm_mul_ps(a, _mm_movehl_ps(a,a));
|
||||||
|
return pfirst(_mm_mul_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a)
|
||||||
|
{
|
||||||
|
return pfirst(_mm_mul_sd(a, _mm_unpackhi_pd(a,a)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)
|
||||||
|
{
|
||||||
|
// after some experiments, it is seems this is the fastest way to implement it
|
||||||
|
// for GCC (eg., reusing pmul is very slow !)
|
||||||
|
// TODO try to call _mm_mul_epu32 directly
|
||||||
|
EIGEN_ALIGN16 int aux[4];
|
||||||
|
pstore(aux, a);
|
||||||
|
return (aux[0] * aux[1]) * (aux[2] * aux[3]);;
|
||||||
|
}
|
||||||
|
|
||||||
|
// min
|
||||||
|
template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)
|
||||||
|
{
|
||||||
|
Packet4f tmp = _mm_min_ps(a, _mm_movehl_ps(a,a));
|
||||||
|
return pfirst(_mm_min_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE double predux_min<Packet2d>(const Packet2d& a)
|
||||||
|
{
|
||||||
|
return pfirst(_mm_min_sd(a, _mm_unpackhi_pd(a,a)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a)
|
||||||
|
{
|
||||||
|
// after some experiments, it is seems this is the fastest way to implement it
|
||||||
|
// for GCC (eg., it does not like using std::min after the pstore !!)
|
||||||
|
EIGEN_ALIGN16 int aux[4];
|
||||||
|
pstore(aux, a);
|
||||||
|
int aux0 = aux[0]<aux[1] ? aux[0] : aux[1];
|
||||||
|
int aux2 = aux[2]<aux[3] ? aux[2] : aux[3];
|
||||||
|
return aux0<aux2 ? aux0 : aux2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// max
|
||||||
|
template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)
|
||||||
|
{
|
||||||
|
Packet4f tmp = _mm_max_ps(a, _mm_movehl_ps(a,a));
|
||||||
|
return pfirst(_mm_max_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE double predux_max<Packet2d>(const Packet2d& a)
|
||||||
|
{
|
||||||
|
return pfirst(_mm_max_sd(a, _mm_unpackhi_pd(a,a)));
|
||||||
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
|
||||||
|
{
|
||||||
|
// after some experiments, it is seems this is the fastest way to implement it
|
||||||
|
// for GCC (eg., it does not like using std::min after the pstore !!)
|
||||||
|
EIGEN_ALIGN16 int aux[4];
|
||||||
|
pstore(aux, a);
|
||||||
|
int aux0 = aux[0]>aux[1] ? aux[0] : aux[1];
|
||||||
|
int aux2 = aux[2]>aux[3] ? aux[2] : aux[3];
|
||||||
|
return aux0>aux2 ? aux0 : aux2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (defined __GNUC__)
|
||||||
|
// template <> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c)
|
||||||
|
// {
|
||||||
|
// Packet4f res = b;
|
||||||
|
// asm("mulps %[a], %[b] \n\taddps %[c], %[b]" : [b] "+x" (res) : [a] "x" (a), [c] "x" (c));
|
||||||
|
// return res;
|
||||||
|
// }
|
||||||
|
// EIGEN_STRONG_INLINE Packet4i _mm_alignr_epi8(const Packet4i& a, const Packet4i& b, const int i)
|
||||||
|
// {
|
||||||
|
// Packet4i res = a;
|
||||||
|
// asm("palignr %[i], %[a], %[b] " : [b] "+x" (res) : [a] "x" (a), [i] "i" (i));
|
||||||
|
// return res;
|
||||||
|
// }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EIGEN_VECTORIZE_SSSE3
|
||||||
|
// SSSE3 versions
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet4f>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)
|
||||||
|
{
|
||||||
|
if (Offset!=0)
|
||||||
|
first = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(second), _mm_castps_si128(first), Offset*4));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet4i>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet4i& first, const Packet4i& second)
|
||||||
|
{
|
||||||
|
if (Offset!=0)
|
||||||
|
first = _mm_alignr_epi8(second,first, Offset*4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet2d>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet2d& first, const Packet2d& second)
|
||||||
|
{
|
||||||
|
if (Offset==1)
|
||||||
|
first = _mm_castsi128_pd(_mm_alignr_epi8(_mm_castpd_si128(second), _mm_castpd_si128(first), 8));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
// SSE2 versions
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet4f>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)
|
||||||
|
{
|
||||||
|
if (Offset==1)
|
||||||
|
{
|
||||||
|
first = _mm_move_ss(first,second);
|
||||||
|
first = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(first),0x39));
|
||||||
|
}
|
||||||
|
else if (Offset==2)
|
||||||
|
{
|
||||||
|
first = _mm_movehl_ps(first,first);
|
||||||
|
first = _mm_movelh_ps(first,second);
|
||||||
|
}
|
||||||
|
else if (Offset==3)
|
||||||
|
{
|
||||||
|
first = _mm_move_ss(first,second);
|
||||||
|
first = _mm_shuffle_ps(first,second,0x93);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet4i>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet4i& first, const Packet4i& second)
|
||||||
|
{
|
||||||
|
if (Offset==1)
|
||||||
|
{
|
||||||
|
first = _mm_castps_si128(_mm_move_ss(_mm_castsi128_ps(first),_mm_castsi128_ps(second)));
|
||||||
|
first = _mm_shuffle_epi32(first,0x39);
|
||||||
|
}
|
||||||
|
else if (Offset==2)
|
||||||
|
{
|
||||||
|
first = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(first),_mm_castsi128_ps(first)));
|
||||||
|
first = _mm_castps_si128(_mm_movelh_ps(_mm_castsi128_ps(first),_mm_castsi128_ps(second)));
|
||||||
|
}
|
||||||
|
else if (Offset==3)
|
||||||
|
{
|
||||||
|
first = _mm_castps_si128(_mm_move_ss(_mm_castsi128_ps(first),_mm_castsi128_ps(second)));
|
||||||
|
first = _mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps(first),_mm_castsi128_ps(second),0x93));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int Offset>
|
||||||
|
struct palign_impl<Offset,Packet2d>
|
||||||
|
{
|
||||||
|
static EIGEN_STRONG_INLINE void run(Packet2d& first, const Packet2d& second)
|
||||||
|
{
|
||||||
|
if (Offset==1)
|
||||||
|
{
|
||||||
|
first = _mm_castps_pd(_mm_movehl_ps(_mm_castpd_ps(first),_mm_castpd_ps(first)));
|
||||||
|
first = _mm_castps_pd(_mm_movelh_ps(_mm_castpd_ps(first),_mm_castpd_ps(second)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // end namespace internal
|
||||||
|
|
||||||
|
} // end namespace Eigen
|
||||||
|
|
||||||
|
#endif // EIGEN_PACKET_MATH_SSE_H
|
|
@ -0,0 +1,289 @@
|
||||||
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
|
// for linear algebra.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||||
|
//
|
||||||
|
// Eigen is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 3 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Alternatively, you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License and a copy of the GNU General Public License along with
|
||||||
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_H
|
||||||
|
#define EIGEN_SELFADJOINT_MATRIX_VECTOR_H
|
||||||
|
|
||||||
|
namespace Eigen {
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
/* Optimized selfadjoint matrix * vector product:
|
||||||
|
* This algorithm processes 2 columns at onces that allows to both reduce
|
||||||
|
* the number of load/stores of the result by a factor 2 and to reduce
|
||||||
|
* the instruction dependency.
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs, int Version=Specialized>
|
||||||
|
struct selfadjoint_matrix_vector_product;
|
||||||
|
|
||||||
|
template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs, int Version>
|
||||||
|
struct selfadjoint_matrix_vector_product
|
||||||
|
|
||||||
|
{
|
||||||
|
static EIGEN_DONT_INLINE void run(
|
||||||
|
Index size,
|
||||||
|
const Scalar* lhs, Index lhsStride,
|
||||||
|
const Scalar* _rhs, Index rhsIncr,
|
||||||
|
Scalar* res,
|
||||||
|
Scalar alpha)
|
||||||
|
{
|
||||||
|
typedef typename packet_traits<Scalar>::type Packet;
|
||||||
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
|
const Index PacketSize = sizeof(Packet)/sizeof(Scalar);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
IsRowMajor = StorageOrder==RowMajor ? 1 : 0,
|
||||||
|
IsLower = UpLo == Lower ? 1 : 0,
|
||||||
|
FirstTriangular = IsRowMajor == IsLower
|
||||||
|
};
|
||||||
|
|
||||||
|
conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> cj0;
|
||||||
|
conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> cj1;
|
||||||
|
conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex, ConjugateRhs> cjd;
|
||||||
|
|
||||||
|
conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> pcj0;
|
||||||
|
conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> pcj1;
|
||||||
|
|
||||||
|
Scalar cjAlpha = ConjugateRhs ? conj(alpha) : alpha;
|
||||||
|
|
||||||
|
// FIXME this copy is now handled outside product_selfadjoint_vector, so it could probably be removed.
|
||||||
|
// if the rhs is not sequentially stored in memory we copy it to a temporary buffer,
|
||||||
|
// this is because we need to extract packets
|
||||||
|
ei_declare_aligned_stack_constructed_variable(Scalar,rhs,size,rhsIncr==1 ? const_cast<Scalar*>(_rhs) : 0);
|
||||||
|
if (rhsIncr!=1)
|
||||||
|
{
|
||||||
|
const Scalar* it = _rhs;
|
||||||
|
for (Index i=0; i<size; ++i, it+=rhsIncr)
|
||||||
|
rhs[i] = *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
Index bound = (std::max)(Index(0),size-8) & 0xfffffffe;
|
||||||
|
if (FirstTriangular)
|
||||||
|
bound = size - bound;
|
||||||
|
|
||||||
|
for (Index j=FirstTriangular ? bound : 0;
|
||||||
|
j<(FirstTriangular ? size : bound);j+=2)
|
||||||
|
{
|
||||||
|
const Scalar* EIGEN_RESTRICT A0 = lhs + j*lhsStride;
|
||||||
|
const Scalar* EIGEN_RESTRICT A1 = lhs + (j+1)*lhsStride;
|
||||||
|
|
||||||
|
Scalar t0 = cjAlpha * rhs[j];
|
||||||
|
Packet ptmp0 = pset1<Packet>(t0);
|
||||||
|
Scalar t1 = cjAlpha * rhs[j+1];
|
||||||
|
Packet ptmp1 = pset1<Packet>(t1);
|
||||||
|
|
||||||
|
Scalar t2(0);
|
||||||
|
Packet ptmp2 = pset1<Packet>(t2);
|
||||||
|
Scalar t3(0);
|
||||||
|
Packet ptmp3 = pset1<Packet>(t3);
|
||||||
|
|
||||||
|
size_t starti = FirstTriangular ? 0 : j+2;
|
||||||
|
size_t endi = FirstTriangular ? j : size;
|
||||||
|
size_t alignedStart = (starti) + internal::first_aligned(&res[starti], endi-starti);
|
||||||
|
size_t alignedEnd = alignedStart + ((endi-alignedStart)/(PacketSize))*(PacketSize);
|
||||||
|
|
||||||
|
// TODO make sure this product is a real * complex and that the rhs is properly conjugated if needed
|
||||||
|
res[j] += cjd.pmul(internal::real(A0[j]), t0);
|
||||||
|
res[j+1] += cjd.pmul(internal::real(A1[j+1]), t1);
|
||||||
|
if(FirstTriangular)
|
||||||
|
{
|
||||||
|
res[j] += cj0.pmul(A1[j], t1);
|
||||||
|
t3 += cj1.pmul(A1[j], rhs[j]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res[j+1] += cj0.pmul(A0[j+1],t0);
|
||||||
|
t2 += cj1.pmul(A0[j+1], rhs[j+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i=starti; i<alignedStart; ++i)
|
||||||
|
{
|
||||||
|
res[i] += t0 * A0[i] + t1 * A1[i];
|
||||||
|
t2 += conj(A0[i]) * rhs[i];
|
||||||
|
t3 += conj(A1[i]) * rhs[i];
|
||||||
|
}
|
||||||
|
// Yes this an optimization for gcc 4.3 and 4.4 (=> huge speed up)
|
||||||
|
// gcc 4.2 does this optimization automatically.
|
||||||
|
const Scalar* EIGEN_RESTRICT a0It = A0 + alignedStart;
|
||||||
|
const Scalar* EIGEN_RESTRICT a1It = A1 + alignedStart;
|
||||||
|
const Scalar* EIGEN_RESTRICT rhsIt = rhs + alignedStart;
|
||||||
|
Scalar* EIGEN_RESTRICT resIt = res + alignedStart;
|
||||||
|
for (size_t i=alignedStart; i<alignedEnd; i+=PacketSize)
|
||||||
|
{
|
||||||
|
Packet A0i = ploadu<Packet>(a0It); a0It += PacketSize;
|
||||||
|
Packet A1i = ploadu<Packet>(a1It); a1It += PacketSize;
|
||||||
|
Packet Bi = ploadu<Packet>(rhsIt); rhsIt += PacketSize; // FIXME should be aligned in most cases
|
||||||
|
Packet Xi = pload <Packet>(resIt);
|
||||||
|
|
||||||
|
Xi = pcj0.pmadd(A0i,ptmp0, pcj0.pmadd(A1i,ptmp1,Xi));
|
||||||
|
ptmp2 = pcj1.pmadd(A0i, Bi, ptmp2);
|
||||||
|
ptmp3 = pcj1.pmadd(A1i, Bi, ptmp3);
|
||||||
|
pstore(resIt,Xi); resIt += PacketSize;
|
||||||
|
}
|
||||||
|
for (size_t i=alignedEnd; i<endi; i++)
|
||||||
|
{
|
||||||
|
res[i] += cj0.pmul(A0[i], t0) + cj0.pmul(A1[i],t1);
|
||||||
|
t2 += cj1.pmul(A0[i], rhs[i]);
|
||||||
|
t3 += cj1.pmul(A1[i], rhs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
res[j] += alpha * (t2 + predux(ptmp2));
|
||||||
|
res[j+1] += alpha * (t3 + predux(ptmp3));
|
||||||
|
}
|
||||||
|
for (Index j=FirstTriangular ? 0 : bound;j<(FirstTriangular ? bound : size);j++)
|
||||||
|
{
|
||||||
|
const Scalar* EIGEN_RESTRICT A0 = lhs + j*lhsStride;
|
||||||
|
|
||||||
|
Scalar t1 = cjAlpha * rhs[j];
|
||||||
|
Scalar t2(0);
|
||||||
|
// TODO make sure this product is a real * complex and that the rhs is properly conjugated if needed
|
||||||
|
res[j] += cjd.pmul(internal::real(A0[j]), t1);
|
||||||
|
for (Index i=FirstTriangular ? 0 : j+1; i<(FirstTriangular ? j : size); i++)
|
||||||
|
{
|
||||||
|
res[i] += cj0.pmul(A0[i], t1);
|
||||||
|
t2 += cj1.pmul(A0[i], rhs[i]);
|
||||||
|
}
|
||||||
|
res[j] += alpha * t2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace internal
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Wrapper to product_selfadjoint_vector
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
template<typename Lhs, int LhsMode, typename Rhs>
|
||||||
|
struct traits<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true> >
|
||||||
|
: traits<ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>, Lhs, Rhs> >
|
||||||
|
{};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Lhs, int LhsMode, typename Rhs>
|
||||||
|
struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
|
||||||
|
: public ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>, Lhs, Rhs >
|
||||||
|
{
|
||||||
|
EIGEN_PRODUCT_PUBLIC_INTERFACE(SelfadjointProductMatrix)
|
||||||
|
|
||||||
|
enum {
|
||||||
|
LhsUpLo = LhsMode&(Upper|Lower)
|
||||||
|
};
|
||||||
|
|
||||||
|
SelfadjointProductMatrix(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {}
|
||||||
|
|
||||||
|
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
|
||||||
|
{
|
||||||
|
typedef typename Dest::Scalar ResScalar;
|
||||||
|
typedef typename Base::RhsScalar RhsScalar;
|
||||||
|
typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
|
||||||
|
|
||||||
|
eigen_assert(dest.rows()==m_lhs.rows() && dest.cols()==m_rhs.cols());
|
||||||
|
|
||||||
|
typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
|
||||||
|
typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
|
||||||
|
|
||||||
|
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
|
||||||
|
* RhsBlasTraits::extractScalarFactor(m_rhs);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
EvalToDest = (Dest::InnerStrideAtCompileTime==1),
|
||||||
|
UseRhs = (_ActualRhsType::InnerStrideAtCompileTime==1)
|
||||||
|
};
|
||||||
|
|
||||||
|
internal::gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,!EvalToDest> static_dest;
|
||||||
|
internal::gemv_static_vector_if<RhsScalar,_ActualRhsType::SizeAtCompileTime,_ActualRhsType::MaxSizeAtCompileTime,!UseRhs> static_rhs;
|
||||||
|
|
||||||
|
ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
|
||||||
|
EvalToDest ? dest.data() : static_dest.data());
|
||||||
|
|
||||||
|
ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,rhs.size(),
|
||||||
|
UseRhs ? const_cast<RhsScalar*>(rhs.data()) : static_rhs.data());
|
||||||
|
|
||||||
|
if(!EvalToDest)
|
||||||
|
{
|
||||||
|
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
|
int size = dest.size();
|
||||||
|
EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
|
#endif
|
||||||
|
MappedDest(actualDestPtr, dest.size()) = dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!UseRhs)
|
||||||
|
{
|
||||||
|
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
|
int size = rhs.size();
|
||||||
|
EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
|
#endif
|
||||||
|
Map<typename _ActualRhsType::PlainObject>(actualRhsPtr, rhs.size()) = rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal::selfadjoint_matrix_vector_product<Scalar, Index, (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, int(LhsUpLo), bool(LhsBlasTraits::NeedToConjugate), bool(RhsBlasTraits::NeedToConjugate)>::run
|
||||||
|
(
|
||||||
|
lhs.rows(), // size
|
||||||
|
&lhs.coeffRef(0,0), lhs.outerStride(), // lhs info
|
||||||
|
actualRhsPtr, 1, // rhs info
|
||||||
|
actualDestPtr, // result info
|
||||||
|
actualAlpha // scale factor
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!EvalToDest)
|
||||||
|
dest = MappedDest(actualDestPtr, dest.size());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
template<typename Lhs, typename Rhs, int RhsMode>
|
||||||
|
struct traits<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false> >
|
||||||
|
: traits<ProductBase<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>, Lhs, Rhs> >
|
||||||
|
{};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Lhs, typename Rhs, int RhsMode>
|
||||||
|
struct SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>
|
||||||
|
: public ProductBase<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>, Lhs, Rhs >
|
||||||
|
{
|
||||||
|
EIGEN_PRODUCT_PUBLIC_INTERFACE(SelfadjointProductMatrix)
|
||||||
|
|
||||||
|
enum {
|
||||||
|
RhsUpLo = RhsMode&(Upper|Lower)
|
||||||
|
};
|
||||||
|
|
||||||
|
SelfadjointProductMatrix(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {}
|
||||||
|
|
||||||
|
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
|
||||||
|
{
|
||||||
|
// let's simply transpose the product
|
||||||
|
Transpose<Dest> destT(dest);
|
||||||
|
SelfadjointProductMatrix<Transpose<const Rhs>, int(RhsUpLo)==Upper ? Lower : Upper, false,
|
||||||
|
Transpose<const Lhs>, 0, true>(m_rhs.transpose(), m_lhs.transpose()).scaleAndAddTo(destT, alpha);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace Eigen
|
||||||
|
|
||||||
|
#endif // EIGEN_SELFADJOINT_MATRIX_VECTOR_H
|
Loading…
Reference in New Issue