Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add DENM TS #64

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .github/workflows/codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
script: utils/codegen/asn1ToC/asn1ToC.py asn1/raw/cam_ts103900/CAM-PDU-Descriptions.asn asn1/patched/cam_ts103900/cdd/ETSI-ITS-CDD.asn -t cam_ts -o etsi_its_coding/etsi_its_cam_ts_coding -di asn1c:ci
- message: denm
script: utils/codegen/asn1ToC/asn1ToC.py asn1/raw/denm_en302637_3/DENM-PDU-Descriptions.asn asn1/raw/denm_en302637_3/cdd/ITS-Container.asn -t denm -o etsi_its_coding/etsi_its_denm_coding -di asn1c:ci
- message: denm_ts
script: utils/codegen/asn1ToC/asn1ToC.py asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn -t denm_ts -o etsi_its_coding/etsi_its_denm_ts_coding -di asn1c:ci
- message: cpm_ts
script: utils/codegen/asn1ToC/asn1ToC.py asn1/raw/cpm_ts103324/asn/CPM-PDU-Descriptions.asn asn1/raw/cpm_ts103324/asn/CPM-OriginatingStationContainers.asn asn1/raw/cpm_ts103324/asn/CPM-PerceivedObjectContainer.asn asn1/raw/cpm_ts103324/asn/CPM-PerceptionRegionContainer.asn asn1/raw/cpm_ts103324/asn/CPM-SensorInformationContainer.asn asn1/patched/cpm_ts103324/asn/cdd/ETSI-ITS-CDD.asn -t cpm_ts -o etsi_its_coding/etsi_its_cpm_ts_coding -di asn1c:ci
- message: mapem_ts
Expand Down Expand Up @@ -123,6 +125,8 @@ jobs:
script: utils/codegen/codegen-py/asn1ToRosMsg.py asn1/raw/cam_ts103900/CAM-PDU-Descriptions.asn asn1/patched/cam_ts103900/cdd/ETSI-ITS-CDD.asn -t cam_ts -o etsi_its_msgs/etsi_its_cam_ts_msgs/msg
- message: denm
script: utils/codegen/codegen-py/asn1ToRosMsg.py asn1/raw/denm_en302637_3/DENM-PDU-Descriptions.asn asn1/raw/denm_en302637_3/cdd/ITS-Container.asn -t denm -o etsi_its_msgs/etsi_its_denm_msgs/msg
- message: denm_ts
script: utils/codegen/codegen-py/asn1ToRosMsg.py asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn -t denm_ts -o etsi_its_msgs/etsi_its_denm_ts_msgs/msg
- message: cpm_ts
script: utils/codegen/codegen-py/asn1ToRosMsg.py asn1/raw/cpm_ts103324/asn/CPM-PDU-Descriptions.asn asn1/raw/cpm_ts103324/asn/CPM-OriginatingStationContainers.asn asn1/raw/cpm_ts103324/asn/CPM-PerceivedObjectContainer.asn asn1/raw/cpm_ts103324/asn/CPM-PerceptionRegionContainer.asn asn1/raw/cpm_ts103324/asn/CPM-SensorInformationContainer.asn asn1/patched/cpm_ts103324/asn/cdd/ETSI-ITS-CDD.asn -t cpm_ts -o etsi_its_msgs/etsi_its_cpm_ts_msgs/msg
- message: mapem_ts
Expand Down Expand Up @@ -168,6 +172,8 @@ jobs:
script: utils/codegen/codegen-py/asn1ToConversionHeader.py asn1/raw/cam_ts103900/CAM-PDU-Descriptions.asn asn1/patched/cam_ts103900/cdd/ETSI-ITS-CDD.asn -t cam_ts -o etsi_its_conversion/etsi_its_cam_ts_conversion/include/etsi_its_cam_ts_conversion
- message: denm
script: utils/codegen/codegen-py/asn1ToConversionHeader.py asn1/raw/denm_en302637_3/DENM-PDU-Descriptions.asn asn1/raw/denm_en302637_3/cdd/ITS-Container.asn -t denm -o etsi_its_conversion/etsi_its_denm_conversion/include/etsi_its_denm_conversion
- message: denm_ts
script: utils/codegen/codegen-py/asn1ToConversionHeader.py asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn -t denm_ts -o etsi_its_conversion/etsi_its_denm_ts_conversion/include/etsi_its_denm_ts_conversion
- message: cpm_ts
script: utils/codegen/codegen-py/asn1ToConversionHeader.py asn1/raw/cpm_ts103324/asn/CPM-PDU-Descriptions.asn asn1/raw/cpm_ts103324/asn/CPM-OriginatingStationContainers.asn asn1/raw/cpm_ts103324/asn/CPM-PerceivedObjectContainer.asn asn1/raw/cpm_ts103324/asn/CPM-PerceptionRegionContainer.asn asn1/raw/cpm_ts103324/asn/CPM-SensorInformationContainer.asn asn1/patched/cpm_ts103324/asn/cdd/ETSI-ITS-CDD.asn -t cpm_ts -o etsi_its_conversion/etsi_its_cpm_ts_conversion/include/etsi_its_cpm_ts_conversion
- message: mapem_ts
Expand Down
37 changes: 37 additions & 0 deletions .gitlab-ci.codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ etsi_its_denm_coding:
- rm -rf /builds/$CI_PROJECT_PATH/tmp
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_denm_ts_coding:
stage: asn1c
needs: ["asn1c-docker"]
script:
- >
utils/codegen/asn1ToC/asn1ToC.py
asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn
asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn
-t denm_ts
-o etsi_its_coding/etsi_its_denm_ts_coding
-td /builds/$CI_PROJECT_PATH/tmp
-di ${_ASN1C_CI_IMAGE}
- rm -rf /builds/$CI_PROJECT_PATH/tmp
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_cpm_ts_coding:
stage: asn1c
needs: ["asn1c-docker"]
Expand Down Expand Up @@ -201,6 +216,17 @@ etsi_its_denm_msgs:
-o etsi_its_msgs/etsi_its_denm_msgs/msg
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_denm_ts_msgs:
stage: ROS Messages
script:
- >
utils/codegen/codegen-py/asn1ToRosMsg.py
asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn
asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn
-t denm_ts
-o etsi_its_msgs/etsi_its_denm_ts_msgs/msg
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_cpm_ts_msgs:
stage: ROS Messages
script:
Expand Down Expand Up @@ -288,6 +314,17 @@ etsi_its_denm_conversion:
-o etsi_its_conversion/etsi_its_denm_conversion/include/etsi_its_denm_conversion
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_denm_ts_conversion:
stage: Conversion Headers
script:
- >
utils/codegen/codegen-py/asn1ToConversionHeader.py
asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn
asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn
-t denm_ts
-o etsi_its_conversion/etsi_its_denm_ts_conversion/include/etsi_its_denm_ts_conversion
- if [[ ! -z "$(git status --porcelain)" ]]; then echo "Code generation script resulted in changes to the repository" && git diff; exit 1; fi

etsi_its_cpm_ts_conversion:
stage: Conversion Headers
script:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
[submodule "denm_en302637_3"]
path = asn1/raw/denm_en302637_3
url = https://forge.etsi.org/rep/ITS/asn1/denm_en302637_3.git
[submodule "asn1/raw/denm_ts103831"]
path = asn1/raw/denm_ts103831
url = https://forge.etsi.org/rep/ITS/asn1/denm_ts103831.git
[submodule "asn1/raw/vam-ts103300_3"]
path = asn1/raw/vam-ts103300_3
url = https://forge.etsi.org/rep/ITS/asn1/vam-ts103300_3.git
Expand Down
57 changes: 54 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"compounds": [
{
"name": "All (coding)",
"configurations": ["CAM (coding)", "CAM TS (coding)", "DENM (coding)", "CPM TS (coding)", "VAM TS (coding)", "MAPEM TS (coding)", "SPATEM TS (coding)"],
"configurations": ["CAM (coding)", "CAM TS (coding)", "DENM (coding)", "DENM TS (coding)", "CPM TS (coding)", "VAM TS (coding)", "MAPEM TS (coding)", "SPATEM TS (coding)"],
"stopAll": false
},
{
"name": "All (msgs)",
"configurations": ["CAM (msgs)", "CAM TS (msgs)", "DENM (msgs)", "CPM TS (msgs)", "VAM TS (msgs)", "MAPEM TS (msgs)", "SPATEM TS (msgs)"],
"configurations": ["CAM (msgs)", "CAM TS (msgs)", "DENM (msgs)", "DENM TS (msgs)", "CPM TS (msgs)", "VAM TS (msgs)", "MAPEM TS (msgs)", "SPATEM TS (msgs)"],
"stopAll": false
},
{
"name": "All (conversion)",
"configurations": ["CAM (conversion)", "CAM TS (conversion)", "DENM (conversion)", "CPM TS (conversion)", "VAM TS (conversion)", "MAPEM TS (conversion)", "SPATEM TS (conversion)"],
"configurations": ["CAM (conversion)", "CAM TS (conversion)", "DENM (conversion)", "DENM TS (msgs)", "CPM TS (conversion)", "VAM TS (conversion)", "MAPEM TS (conversion)", "SPATEM TS (conversion)"],
"stopAll": false
}
],
Expand Down Expand Up @@ -171,6 +171,57 @@
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "DENM TS (coding)",
"preLaunchTask": "Patch ASN.1 files",
"type": "debugpy",
"request": "launch",
"program": "utils/codegen/asn1ToC/asn1ToC.py",
"args": [
"asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn",
"asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn",
"-t",
"denm_ts",
"-o",
"etsi_its_coding/etsi_its_denm_ts_coding"
],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "DENM TS (msgs)",
"preLaunchTask": "Patch ASN.1 files",
"type": "debugpy",
"request": "launch",
"program": "utils/codegen/codegen-py/asn1ToRosMsg.py",
"args": [
"asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn",
"asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn",
"-t",
"denm_ts",
"-o",
"etsi_its_msgs/etsi_its_denm_ts_msgs/msg"
],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "DENM TS (conversion)",
"preLaunchTask": "Patch ASN.1 files",
"type": "debugpy",
"request": "launch",
"program": "utils/codegen/codegen-py/asn1ToConversionHeader.py",
"args": [
"asn1/raw/denm_ts103831/DENM-PDU-Descriptions.asn",
"asn1/patched/denm_ts103831/cdd/ETSI-ITS-CDD.asn",
"-t",
"denm_ts",
"-o",
"etsi_its_conversion/etsi_its_denm_ts_conversion/include/etsi_its_denm_ts_conversion"
],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "CPM TS (coding)",
"preLaunchTask": "Patch ASN.1 files",
Expand Down
46 changes: 46 additions & 0 deletions asn1/patches/denm_ts103831/cdd/ETSI-ITS-CDD.asn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/ETSI-ITS-CDD.asn b/ETSI-ITS-CDD.asn
index 66e391d..ea18b5e 100755
--- a/ETSI-ITS-CDD.asn
+++ b/ETSI-ITS-CDD.asn
@@ -3339,16 +3339,6 @@ StationaryVehicleSubCauseCode ::= INTEGER {
*/
StationId ::= INTEGER(0..4294967295)

-/**
- * This DE represents the identifier of an ITS-S.
- * The ITS-S ID may be a pseudonym. It may change over space and/or over time.
- *
- * @note: this DE is kept for backwards compatibility reasons only. It is recommended to use the @ref StationId instead.
- * @category: Basic information
- * @revision: V1.3.1
- */
-StationID ::= INTEGER(0..4294967295)
-
/**
* This DE represents the type of technical context the ITS-S is integrated in.
* The station type depends on the integration environment of ITS-S into vehicle, mobile devices or at infrastructure.
@@ -4479,24 +4469,6 @@ ActionId ::= SEQUENCE {
sequenceNumber SequenceNumber
}

-/**
- * This DF represents an identifier used to describe a protocol action taken by an ITS-S.
- *
- * It shall include the following components:
- *
- * @field originatingStationId: Id of the ITS-S that takes the action.
- *
- * @field sequenceNumber: a sequence number.
- *
- * @note: this DF is kept for backwards compatibility reasons only. It is recommended to use the @ref ActionId instead.
- * @category: Communication information
- * @revision: V1.3.1
- */
-ActionID ::= SEQUENCE {
- originatingStationId StationID,
- sequenceNumber SequenceNumber
-}
-
/**
* This DF shall contain a list of @ref ActionId.

1 change: 1 addition & 0 deletions asn1/raw/denm_ts103831
Submodule denm_ts103831 added at 0bf7b9
1 change: 1 addition & 0 deletions etsi_its_coding/etsi_its_coding/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<depend>etsi_its_cam_ts_coding</depend>
<depend>etsi_its_cpm_ts_coding</depend>
<depend>etsi_its_denm_coding</depend>
<depend>etsi_its_denm_ts_coding</depend>
<depend>etsi_its_mapem_ts_coding</depend>
<depend>etsi_its_spatem_ts_coding</depend>
<depend>etsi_its_vam_ts_coding</depend>
Expand Down
69 changes: 69 additions & 0 deletions etsi_its_coding/etsi_its_denm_ts_coding/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.5)
project(etsi_its_denm_ts_coding)

find_package(ros_environment REQUIRED QUIET)
set(ROS_VERSION $ENV{ROS_VERSION})

AUX_SOURCE_DIRECTORY(src SRC_FILES)

# === ROS 2 (AMENT) ============================================================
if(${ROS_VERSION} EQUAL 2)

find_package(ament_cmake REQUIRED)

add_library(${PROJECT_NAME} SHARED
${SRC_FILES}
)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)

install(DIRECTORY include/
DESTINATION include
)

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
INCLUDES DESTINATION include
)

ament_package()

# === ROS (CATKIN) =============================================================
elseif(${ROS_VERSION} EQUAL 1)

find_package(catkin REQUIRED)

catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
)

include_directories(
include
${catkin_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME} SHARED
${SRC_FILES}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)

endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*-
* Copyright (c) 2004-2017 Lev Walkin <[email protected]>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN_TYPE_ANY_H
#define ASN_TYPE_ANY_H

#include <etsi_its_denm_ts_coding/OCTET_STRING.h> /* Implemented via OCTET STRING type */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ANY {
uint8_t *buf; /* BER-encoded ANY contents */
int size; /* Size of the above buffer */

asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} ANY_t;

extern asn_TYPE_descriptor_t asn_DEF_ANY;
extern asn_TYPE_operation_t asn_OP_ANY;
extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;

#define ANY_free OCTET_STRING_free

#if !defined(ASN_DISABLE_PRINT_SUPPORT)
#define ANY_print OCTET_STRING_print
#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */

#define ANY_compare OCTET_STRING_compare
#define ANY_copy OCTET_STRING_copy

#define ANY_constraint asn_generic_no_constraint

#if !defined(ASN_DISABLE_BER_SUPPORT)
#define ANY_decode_ber OCTET_STRING_decode_ber
#define ANY_encode_der OCTET_STRING_encode_der
#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */

#if !defined(ASN_DISABLE_XER_SUPPORT)
#define ANY_decode_xer OCTET_STRING_decode_xer_hex
xer_type_encoder_f ANY_encode_xer;
#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */

#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_decoder_f ANY_decode_jer;
jer_type_encoder_f ANY_encode_jer;
#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */

#if !defined(ASN_DISABLE_UPER_SUPPORT)
per_type_decoder_f ANY_decode_uper;
per_type_encoder_f ANY_encode_uper;
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
#if !defined(ASN_DISABLE_APER_SUPPORT)
per_type_decoder_f ANY_decode_aper;
per_type_encoder_f ANY_encode_aper;
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

/******************************
* Handy conversion routines. *
******************************/

/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

/* Convert the contents of the ANY type into the specified type. */
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
&asn_DEF_ANY, (buf), (size))

#ifdef __cplusplus
}
#endif

#endif /* ASN_TYPE_ANY_H */
Loading
Loading