Skip to content

Commit

Permalink
[initial]
Browse files Browse the repository at this point in the history
- imported from internal Virtual Vehicle Research GmbH repository
  • Loading branch information
MrMushroom committed Jan 31, 2023
0 parents commit 7c45bac
Show file tree
Hide file tree
Showing 6,486 changed files with 479,134 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake-build-debug/
.idea
/cmake-build-debug/
87 changes: 87 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.5.1)
project(v2x_gw)

# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

# compile options
# - activation will lead to a shitload of warnings of unused variables in autogenerated vcits lib
#if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# add_compile_options(-Wall -Wextra -Wpedantic)
#endif()

# ZeroMQ configuration
# - activate relative paths for libraries (use that for deployment; WARNING: don't use with --symlink-install -> lib won't be found by file)
# - set lib location for building and linking
# - copy the lib files
#set(CMAKE_INSTALL_RPATH "$ORIGIN")
#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(ZEROMQ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/include")
set(ZEROMQ_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so")
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so"
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so.5"
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so.5.2.4"
DESTINATION lib/${PROJECT_NAME}/
)

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(eigen3_cmake_module)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(std_msgs REQUIRED)
find_package(dbw_ford_msgs REQUIRED)
find_package(v2x_msgs REQUIRED)

#pkg_check_modules(vcits REQUIRED)
add_subdirectory(vcits)

# add executable and sources
ament_auto_add_executable(v2x_gw src/V2XGateway.cpp
src/server/V2XServer.cpp
src/server/V2XZMQServer.cpp
src/handler/V2XMHandler.cpp
src/handler/CAMHandler.cpp
src/handler/CPMHandler.cpp
src/handler/DENMHandler.cpp
src/handler/ExampleMHandler.cpp
)

# reference headers
target_include_directories(v2x_gw PUBLIC ${CMAKE_INSTALL_PREFIX}/include/
include
include/server
include/handler
${ZEROMQ_INCLUDE_DIR}
vcits/asn1c
.
)

# link libraries
ament_target_dependencies(v2x_gw rclcpp std_msgs geometry_msgs nav_msgs visualization_msgs diagnostic_msgs dbw_ford_msgs v2x_msgs tf2 tf2_ros)

target_link_libraries(v2x_gw
${ZEROMQ_LIBRARIES}
vcits)

# install ros package dependencies
ament_auto_package(
INSTALL_TO_SHARE
launch
config
)
36 changes: 36 additions & 0 deletions FindZeroMQ.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ZeroMQ.cmake from http://lists.gforge.inria.fr/pipermail/simgrid-devel/2012-July/001513.html

SET (ZEROMQ_FIND_QUIETLY TRUE)
SET (ZEROMQ_FIND_REQUIRED FALSE)

IF (NOT ZEROMQ_FOUND)
# Search user environment for headers, then default paths
FIND_PATH (ZEROMQ_INCLUDE_DIR zmq.hpp
PATHS ${ZEROMQROOT}/include $ENV{ZEROMQROOT}/include /usr/local/include
NO_DEFAULT_PATH)
FIND_PATH (ZEROMQ_INCLUDE_DIR zmq.hpp)
GET_FILENAME_COMPONENT (ZEROMQROOT ${ZEROMQ_INCLUDE_DIR} PATH)

# Search user environment for libraries, then default paths
FIND_LIBRARY (ZEROMQ_LIBRARIES zmq
PATHS ${ZEROMQROOT}/lib $ENV{ZEROMQROOT}/lib /usr/local/lib
NO_DEFAULT_PATH)
FIND_LIBRARY (ZEROMQ_LIBRARIES zmq)

# Set ZEROMQ_FOUND and error out if zmq is not found
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (ZEROMQ
DEFAULT_MSG ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIR)

IF (ZEROMQ_FOUND)
MESSAGE (STATUS "ZeroMQ found: zmq library and zmq.hpp ")
MESSAGE (STATUS " * includes: ${ZEROMQ_INCLUDE_DIR}")
MESSAGE (STATUS " * libs: ${ZEROMQ_LIBRARIES}")
ELSE (ZEROMQ_FOUND)
IF(${ZEROMQ_LIBRARIES} STREQUAL "ZEROMQ_LIBRARIES-NOTFOUND")
MESSAGE (STATUS "ZeroMQ library does not exist")
ELSEIF(${ZEROMQ_INCLUDE_DIR} STREQUAL "ZEROMQ_INCLUDE_DIR-NOTFOUND")
MESSAGE (STATUS "ZeroMQ has a problem: zmq.hpp does not exist, try to download it from https://github.com/zeromq/cppzmq/blob/master/zmq.hpp")
ENDIF()
ENDIF (ZEROMQ_FOUND)
ENDIF (NOT ZEROMQ_FOUND)
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2022, Virtual Vehicle
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# V2X Gateway
The *v2x_gw* is part of the [vehicleCAPTAIN](https://github.com/virtual-vehicle/vehicle_captain) toolbox.

The *v2x_gw* is a central ROS2 node that (i) connects to the vehicleCAPTAIN routing core (ii) converts V2X messages to ROS messages (iii) converts ROS messages to V2X messages.

The vehicleCAPTAIN routing core may be replaced by your implementation for rx/tx of V2X messages.

Version Support:
* v1.x
* v2x_msgs v1.1.0
* vcits 1.0

## Copyright
Please cite the [vehicleCAPTAIN paper](https://TODO_link_to_paper_when_it_is_published) if you used any part of this library for your work.

## Contribution Guidelines
Feel free to add fixes and new features!

## Authors
Main Author: [Christoph Pilz](https://github.com/MrMushroom)

## Acknowledgement
The majority of this work is part of my ([Christoph Pilz](https://www.researchgate.net/profile/Christoph-Pilz)) PhD studies at [Graz University of Technology](https://www.tugraz.at/home) in cooperation with the [Virtual Vehicle Research GmbH](https://www.v2c2.at/).

Features are also integrated across various funded projects (see [vehicleCAPTAIN](https://github.com/virtual-vehicle/vehicle_captain)).
55 changes: 55 additions & 0 deletions USAGE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Usage Guide
Check out the Requirements below!

Afterwards simply check out the repo and integrate it into your ROS2 environment.

## Requirements
This node requires the [v2x_msgs](https://github.com/virtual-vehicle/v2x_msgs) library from the [vehicleCAPTAIN](https://github.com/virtual-vehicle/vehicle_captain) toolbox.

This node is designed for the [v2x_routing_core](https://github.com/virtual-vehicle/vehicle_captain_routing_core) from the [vehicleCAPTAIN](https://github.com/virtual-vehicle/vehicle_captain) toolbox.
However, you may introduce your own V2XServer connection.

Also, check out the ROS2 dependencies (package.xml)!

## In case you want to install ZMQ locally

You may use zmq_setup.sh for setup

In top level "CMakeLists.txt" replace setting of ZMQ libs with "FindZeroMQ.cmake"

### LibZMQ v4.3.4
```shell
cd /opt
git clone https://github.com/zeromq/libzmq.git
cd /opt/libzmq
git checkout v4.3.4

apt-get update -qq
apt-get install -qq --yes --no-install-recommends \
libkrb5-dev \
libsodium23

./autogen.sh
./configure --prefix=/usr/local --with-libgssapi_krb5
make
make check
make install

ldconfig && ldconfig -p | grep libzmq
```

### CPPZMQ v4.8.0
WARNING: v4.8.0 recommended, but Ubuntu 18.04 has wrong cmake version!
WARNING: also for that reason, the -DCPPZMQ_BUILD_TESTS=OFF is required
```shell
cd /opt
git clone https://github.com/zeromq/cppzmq.git
cd /opt/cppzmq
git checkout v4.7.1

mkdir build
cd /opt/cppzmq/build

cmake -DCPPZMQ_BUILD_TESTS=OFF ..
make install
```
32 changes: 32 additions & 0 deletions config/v2x_gw.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# config/v2x_gw.param.yaml
---

# Node-specific parameters
/**:
ros__parameters:
server:
type: "zmq" # type of the V2X server (supported: "zmq")
address: "vcaptain001.local" # hostname or ipv4 of the vehicleCAPTAIN routing core
receive_port: 5556 # 5556 is default for receiving from the vehicleCAPTAIN routing core
send_port: 5555 # 5555 is default for sending to the vehicleCAPTAIN routing core
topic_filter: "v2x." # supported: "v2x." ... get v2x messages (see vehicleCAPTAIN routing core docs)
cycle_time_ms: 1 # cycle time leads to communication update interval

header:
station_id: 1337 # this value is pseudonymized and should be unique in a GN communication

cam:
active: true # activate processing of CAM module
handler_debug_msg_throttle_ms: 5000 # throttle for debug msgs in milliseconds (throttles <=WARN)

cpm:
active: true # activate processing of CPM module
handler_debug_msg_throttle_ms: 5000 # throttle for debug msgs in milliseconds (throttles <=WARN)

denm:
active: true # activate processing of DENM module
handler_debug_msg_throttle_ms: 5000 # throttle for debug msgs in milliseconds (throttles <=WARN)

examplem:
active: false # activate processing of ExampleM module
handler_debug_msg_throttle_ms: 5000 # throttle for debug msgs in milliseconds (throttles <=WARN)
1 change: 1 addition & 0 deletions docs/v2x_gw_node_ros.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2022-02-09T08:57:03.421Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="Zjf9qel-bqP_ra-4kzGx" version="16.5.1" type="device" pages="2"><diagram id="icEgXLWXjd7jY7iUPej3" name="HLA">7VrZcqM6EP0aV819mJRBQJxHL1lmKluZ1CyPAmSsiYxcIGI7X38lkABb2HFdL8S+4zwEtYSQzulWt1pqgf5kfhvD6fiBBoi0zHYwb4FByzQNYLf5PyFZ5JLOZScXhDEOZKNS4OJ3JIXyvTDFAUqWGjJKCcPTZaFPowj5bEkG45jOlpuNKFn+6hSGSBO4PiS69CcO2DiXmgA4ZcUdwuFYfdqxrbxmAlVrOZVkDAM6q4jAdQv0Y0pZ/jSZ9xER6Clg8vdu1tQWI4tRxLZ5YXBjPty8Mdd9fjHd7/7L0Ex+fJW9vEGSyhn/MH9xwS1kaAYX/OmRc8r/fRk+uf/IibCFgofPaSoeBa4oboHeiEbMlfUGLzP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