Skip to content

Commit

Permalink
add c-code for CPM
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbusch committed Jun 17, 2024
1 parent 293428d commit a551ea9
Show file tree
Hide file tree
Showing 854 changed files with 76,518 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@
"justMyCode": true
},

{
"name": "CPM asn1ToC",
"type": "python",
"request": "launch",
"program": "utils/codegen/asn1ToC.py",
"args": [
"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/raw/cpm_ts103324/asn/cdd/ETSI-ITS-CDD.asn",
"-o", "etsi_its_coding/etsi_its_cpm_coding"
],
"console": "integratedTerminal",
"justMyCode": true
},

{
"name": "CAM asn1ToRosMsg",
"type": "python",
Expand Down
69 changes: 69 additions & 0 deletions etsi_its_coding/etsi_its_cpm_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_cpm_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,84 @@
/*-
* 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_cpm_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_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_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 */
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29-DF (http://lionet.info/asn1c)
* From ASN.1 module "ETSI-ITS-CDD"
* found in "/input/ETSI-ITS-CDD.asn"
* `asn1c -fcompound-names -no-gen-example -gen-UPER`
*/


/* Including external dependencies */
#include "etsi_its_cpm_coding/AccelerationPolarWithZ.h"
#include "etsi_its_cpm_coding/AccelerationCartesian.h"
#include <etsi_its_cpm_coding/constr_CHOICE.h>
#ifndef _Acceleration3dWithConfidence_H_
#define _Acceleration3dWithConfidence_H_


#include <etsi_its_cpm_coding/asn_application.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Dependencies */
typedef enum Acceleration3dWithConfidence_PR {
Acceleration3dWithConfidence_PR_NOTHING, /* No components present */
Acceleration3dWithConfidence_PR_polarAcceleration,
Acceleration3dWithConfidence_PR_cartesianAcceleration
} Acceleration3dWithConfidence_PR;

/* Acceleration3dWithConfidence */
typedef struct Acceleration3dWithConfidence {
Acceleration3dWithConfidence_PR present;
union Acceleration3dWithConfidence_u {
AccelerationPolarWithZ_t polarAcceleration;
AccelerationCartesian_t cartesianAcceleration;
} choice;

/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Acceleration3dWithConfidence_t;

/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Acceleration3dWithConfidence;
extern asn_CHOICE_specifics_t asn_SPC_Acceleration3dWithConfidence_specs_1;
extern asn_TYPE_member_t asn_MBR_Acceleration3dWithConfidence_1[2];
extern asn_per_constraints_t asn_PER_type_Acceleration3dWithConfidence_constr_1;

#ifdef __cplusplus
}
#endif

#endif /* _Acceleration3dWithConfidence_H_ */
#include <etsi_its_cpm_coding/asn_internal.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29-DF (http://lionet.info/asn1c)
* From ASN.1 module "ETSI-ITS-CDD"
* found in "/input/ETSI-ITS-CDD.asn"
* `asn1c -fcompound-names -no-gen-example -gen-UPER`
*/


/* Including external dependencies */
#include "etsi_its_cpm_coding/AccelerationComponent.h"
#include <etsi_its_cpm_coding/constr_SEQUENCE.h>
#ifndef _AccelerationCartesian_H_
#define _AccelerationCartesian_H_


#include <etsi_its_cpm_coding/asn_application.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Forward declarations */
struct AccelerationComponent;

/* AccelerationCartesian */
typedef struct AccelerationCartesian {
AccelerationComponent_t xAcceleration;
AccelerationComponent_t yAcceleration;
struct AccelerationComponent *zAcceleration; /* OPTIONAL */

/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} AccelerationCartesian_t;

/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_AccelerationCartesian;
extern asn_SEQUENCE_specifics_t asn_SPC_AccelerationCartesian_specs_1;
extern asn_TYPE_member_t asn_MBR_AccelerationCartesian_1[3];

#ifdef __cplusplus
}
#endif

/* Referred external types */
#include "etsi_its_cpm_coding/AccelerationComponent.h"

#endif /* _AccelerationCartesian_H_ */
#include <etsi_its_cpm_coding/asn_internal.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Generated by asn1c-0.9.29-DF (http://lionet.info/asn1c)
* From ASN.1 module "ETSI-ITS-CDD"
* found in "/input/ETSI-ITS-CDD.asn"
* `asn1c -fcompound-names -no-gen-example -gen-UPER`
*/


/* Including external dependencies */
#include <etsi_its_cpm_coding/NativeEnumerated.h>
#ifndef _AccelerationChange_H_
#define _AccelerationChange_H_


#include <etsi_its_cpm_coding/asn_application.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Dependencies */
typedef enum AccelerationChange {
AccelerationChange_accelerate = 0,
AccelerationChange_decelerate = 1
} e_AccelerationChange;

/* AccelerationChange */
typedef long AccelerationChange_t;

/* Implementation */
extern asn_per_constraints_t asn_PER_type_AccelerationChange_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_AccelerationChange;
extern const asn_INTEGER_specifics_t asn_SPC_AccelerationChange_specs_1;
asn_struct_free_f AccelerationChange_free;
asn_struct_print_f AccelerationChange_print;
asn_constr_check_f AccelerationChange_constraint;
ber_type_decoder_f AccelerationChange_decode_ber;
der_type_encoder_f AccelerationChange_encode_der;
xer_type_decoder_f AccelerationChange_decode_xer;
xer_type_encoder_f AccelerationChange_encode_xer;
jer_type_encoder_f AccelerationChange_encode_jer;
oer_type_decoder_f AccelerationChange_decode_oer;
oer_type_encoder_f AccelerationChange_encode_oer;
per_type_decoder_f AccelerationChange_decode_uper;
per_type_encoder_f AccelerationChange_encode_uper;
per_type_decoder_f AccelerationChange_decode_aper;
per_type_encoder_f AccelerationChange_encode_aper;

#ifdef __cplusplus
}
#endif

#endif /* _AccelerationChange_H_ */
#include <etsi_its_cpm_coding/asn_internal.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Generated by asn1c-0.9.29-DF (http://lionet.info/asn1c)
* From ASN.1 module "ETSI-ITS-CDD"
* found in "/input/ETSI-ITS-CDD.asn"
* `asn1c -fcompound-names -no-gen-example -gen-UPER`
*/


/* Including external dependencies */
#include "etsi_its_cpm_coding/AccelerationChange.h"
#include "etsi_its_cpm_coding/DeltaTimeTenthOfSecond.h"
#include <etsi_its_cpm_coding/constr_SEQUENCE.h>
#ifndef _AccelerationChangeIndication_H_
#define _AccelerationChangeIndication_H_


#include <etsi_its_cpm_coding/asn_application.h>

#ifdef __cplusplus
extern "C" {
#endif

/* AccelerationChangeIndication */
typedef struct AccelerationChangeIndication {
AccelerationChange_t accelOrDecel;
DeltaTimeTenthOfSecond_t actionDeltaTime;
/*
* This type is extensible,
* possible extensions are below.
*/

/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} AccelerationChangeIndication_t;

/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_AccelerationChangeIndication;

#ifdef __cplusplus
}
#endif

#endif /* _AccelerationChangeIndication_H_ */
#include <etsi_its_cpm_coding/asn_internal.h>
Loading

0 comments on commit a551ea9

Please sign in to comment.