diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8e0ce6ea1308fed0725456553d0f1a61630c4537..0000000000000000000000000000000000000000 --- a/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2022, -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* 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. - -* 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. \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 7d65bfd2fb1d5965a25742ec49d6b78d88e7e43f..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,38 +0,0 @@ -# local_sensor_data_sender - -#### Description -传感器本地数据仿真 -支持在MDC环境下,读取pcd文件,视频文件,并以cm的消息将其转发出来 -支持在X86环境下,读取pcd文件,视频文件,并以cm的消息将其转发出来 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 702861805e774604303805da4c5cc426176f9c85..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# local_sensor_data_sender - -#### 介绍 -传感器本地数据仿真 -支持在MDC环境下,读取pcd文件,视频文件,并以cm的消息将其转发出来 -支持在X86环境下,读取pcd文件,视频文件,并以cm的消息将其转发出来 - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/local_sensor_data_sender_mdc/CMakeLists.txt b/local_sensor_data_sender_mdc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b030dab2f18ba756c7d094f567a8733f5197e9d8 --- /dev/null +++ b/local_sensor_data_sender_mdc/CMakeLists.txt @@ -0,0 +1,102 @@ +cmake_minimum_required(VERSION 3.10.2) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +SET (CMAKE_C_COMPILER_WORKS 1) +SET (CMAKE_CXX_COMPILER_WORKS 1) +ADD_DEFINITIONS(-DMDC_PRODUCTION_CORE) + +set(APP_NAME "local_sensor_simulation") + +set(CMAKE_C_FLAGS_DEBUG "") +set(CMAKE_C_FLAGS_RELEASE "") +set(CMAKE_CXX_FLAGS_DEBUG "") +set(CMAKE_CXX_FLAGS_RELEASE "") + +IF (CMAKE_BUILD_TYPE MATCHES Debug) + set(DEFAULT_COMPILE -std=c++14 -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -fPIE -pie -fstack-protector-all -Wtrampolines) +ELSEIF (CMAKE_BUILD_TYPE MATCHES Release) + set(DEFAULT_COMPILE -std=c++14 -O3 -Wall -c -fmessage-length=0 -fPIC -fPIE -pie -fstack-protector-all -Wtrampolines) +ENDIF() + +add_compile_options(${DEFAULT_COMPILE}) + +set(MDC_ADSFI_SDK ${MDC_SDK}/sysroot/usr/include/adsfi) +set(MDC_ACLLIB_SDK ${MDC_SDK}/sysroot/usr/local/Ascend/runtime) +set(GODEL_LINK_LIBS "-lara_core -lara_com -ldl -lara_exec -lddscore -lddscpp -lJsonParser -lKeyValueStorage -llogging -lsomeip -lvcc_ddsdriver -lvcc_someipdriver -lvrtf_vcc") +set(OPENCV_LINK_LIBS "-lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml") + +list_sub_dir(GENERATED_DIRS +${CMAKE_SOURCE_DIR}/generated "${filters}") + +include_directories( + ${GENERATED_DIRS} + ${MDC_SDK}/sysroot/usr/include + ${MDC_SDK}/sysroot/usr/include/adsfi/adb/include + ${MDC_SDK}/sysroot/usr/include/adsfi/adsf/include + ${MDC_SDK}/sysroot/usr/include/adsfi/arxml_include + ${MDC_SDK}/sysroot/usr/include/yaml-cpp + ${MDC_ACLLIB_SDK}/include + ${MDC_ACLLIB_SDK}/include/acl + ${MDC_ACLLIB_SDK}/include/acl/ops + ${MDC_ACLLIB_SDK}/include/acl/dvpp + ${THIRD_LIB_PATH}/usr/include/opencv4 + ${MDC_SDK}/sysroot/usr/include/opencv4 + ${MDC_DRIVER_SDK}/include/dvpp + ${MDC_SDK}/sysroot/usr/include/driver + ${MDC_SDK}/sysroot/usr/include/pcl-1.11 +) + +link_directories( + ${MDC_SDK}/sysroot/lib + ${MDC_SDK}/sysroot/usr/lib + ${MDC_SDK}/sysroot/lib/mdc_vector + ${MDC_SDK}/sysroot/usr/lib/mdc/base-plat + ${MDC_ACLLIB_SDK}/lib64/stub + ${THIRD_LIB_PATH}/usr/lib64 +) + +AUX_SOURCE_DIRECTORY(. IMAGE_SENDER_SRC) + + +set(${APP_NAME}_SOURCES + ${IMAGE_SENDER_SRC} +) +#把目录下的c和c++所有源文件分别保存在变量中 +file(GLOB_RECURSE CM_APP_FILES + ${CMAKE_SOURCE_DIR}/generated/*.cpp) + +add_executable(${APP_NAME} ${${APP_NAME}_SOURCES} ${CM_APP_FILES}) +target_link_libraries(${APP_NAME} ${GODEL_LINK_LIBS} ${OPENCV_LINK_LIBS} rm securec log yaml-cpp ascend_hal) + +target_link_libraries(${APP_NAME} + ${OPENCV_LINK_LIBS} + ${GODEL_LINK_LIBS} + securec + ascend_hal + yaml-cpp + log + rm + pthread + acl_dvpp_mpi + ascendcl + stdc++ + pcl_io + pcl_common) + +install( + TARGETS ${APP_NAME} RUNTIME + DESTINATION ${PROJECT_SOURCE_DIR}/bin) + + + + + + + + diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.json new file mode 100644 index 0000000000000000000000000000000000000000..5a69ec1d7c38f95b3755e1134b0129fca92054e1 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.json @@ -0,0 +1,821 @@ +{ + "applicationName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveSwComponent/CameraReceiveSwComponent/CameraReceiveProcess", + "services": [ + { + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraDecodedMbufServiceInterface", + "serviceId": 2434, + "events": [ + { + "event": "cameraDecodedMbufEvent", + "id": 3920, + "isDpRawData": true, + "dataType": "/HuaweiMDC/PlatformServiceInterface/CameraMsgDataType/CameraDecodedMbufStruct", + "topicName": "CameraDecodedDdsEvent" + } + ], + "fields": [], + "methods": [], + "instances": [ + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_21", + "instance": "21", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_22", + "instance": "22", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_23", + "instance": "23", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_24", + "instance": "24", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_25", + "instance": "25", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_26", + "instance": "26", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_27", + "instance": "27", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_28", + "instance": "28", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_29", + "instance": "29", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_30", + "instance": "30", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_31", + "instance": "31", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_32", + "instance": "32", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_33", + "instance": "33", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_34", + "instance": "34", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_decoded_mbuf_35", + "instance": "35", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 3920, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + } + ] + }, + { + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraEncodedMbufServiceInterface", + "serviceId": 2438, + "events": [ + { + "event": "cameraEncodedMbufEvent", + "id": 27111, + "isDpRawData": true, + "dataType": "/HuaweiMDC/PlatformServiceInterface/CameraMsgDataType/CameraEncodedMbufStruct", + "topicName": "CameraEncodedDdsEvent" + } + ], + "fields": [], + "methods": [], + "instances": [ + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_71", + "instance": "71", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_72", + "instance": "72", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_73", + "instance": "73", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_74", + "instance": "74", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_75", + "instance": "75", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_76", + "instance": "76", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_77", + "instance": "77", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_78", + "instance": "78", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_79", + "instance": "79", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_80", + "instance": "80", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_81", + "instance": "81", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_82", + "instance": "82", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_83", + "instance": "83", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_84", + "instance": "84", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_encoded_mbuf_85", + "instance": "85", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 27111, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + } + ] + }, + { + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraImageMbufServiceInterface", + "serviceId": 2439, + "events": [ + { + "event": "cameraImageMbufEvent", + "id": 36410, + "isDpRawData": true, + "dataType": "/HuaweiMDC/PlatformServiceInterface/CameraMsgDataType/CameraPublishImageDataStruct", + "topicName": "CameraImageDdsEvent" + } + ], + "fields": [], + "methods": [], + "instances": [ + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1021", + "instance": "1021", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1022", + "instance": "1022", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1023", + "instance": "1023", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1024", + "instance": "1024", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1025", + "instance": "1025", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1026", + "instance": "1026", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1027", + "instance": "1027", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1028", + "instance": "1028", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1029", + "instance": "1029", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1030", + "instance": "1030", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1031", + "instance": "1031", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1032", + "instance": "1032", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1033", + "instance": "1033", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1034", + "instance": "1034", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + }, + { + "shortName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveService/CameraServiceRequirer/camera_receive_image_mbuf_1035", + "instance": "1035", + "domainId": 1, + "network": "192.168.10.6", + "isClient": true, + "qosProfile": "/var/domainqos.xml", + "events": [ + { + "id": 36410, + "qosProfile": "/var/eventsqos.xml", + "dataIds": [] + } + ], + "fields": [], + "methods": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.xml b/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.xml new file mode 100644 index 0000000000000000000000000000000000000000..2afc50b4aa6ec05103743eb5f9b767fa9bce4ce6 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/dds.xml @@ -0,0 +1,12 @@ + + any + + true + + + INFO + rt_dds_debug.log + rt_dds.log + true + + \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/default_qos.xml b/local_sensor_data_sender_mdc/CameraReceiveProcess/default_qos.xml new file mode 100644 index 0000000000000000000000000000000000000000..c71fe6d4f499ba447a0bc9b666a3e227f564dad8 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/default_qos.xml @@ -0,0 +1,1004 @@ + + + + + TRANSPORT_UDP + + + + 192.168.10.6 + + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/e2e.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/e2e.json new file mode 100644 index 0000000000000000000000000000000000000000..2187833ae0efc60b3ea743c934d5514fc8c4f014 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/e2e.json @@ -0,0 +1,3 @@ +{ + "e2eProfileConfigs": [] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/large_buffer_qos.xml b/local_sensor_data_sender_mdc/CameraReceiveProcess/large_buffer_qos.xml new file mode 100644 index 0000000000000000000000000000000000000000..c71fe6d4f499ba447a0bc9b666a3e227f564dad8 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/large_buffer_qos.xml @@ -0,0 +1,1004 @@ + + + + + TRANSPORT_UDP + + + + 192.168.10.6 + + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/network_binding.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/network_binding.json new file mode 100644 index 0000000000000000000000000000000000000000..206fd55747239c9ead6b07aee737dd08fbe5b82e --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/network_binding.json @@ -0,0 +1,202 @@ +{ + "instanceSpecifiers": [ + { + "instanceSpecifier": "camera_a_cm_receive/CameraReceiveRootSwComponent/CameraDecodedMbufReceiveRPort", + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraDecodedMbufServiceInterface", + "instanceIdentifiers": [ + { + "protocol": "DDS", + "instanceIdentifier": "21" + }, + { + "protocol": "DDS", + "instanceIdentifier": "22" + }, + { + "protocol": "DDS", + "instanceIdentifier": "23" + }, + { + "protocol": "DDS", + "instanceIdentifier": "24" + }, + { + "protocol": "DDS", + "instanceIdentifier": "25" + }, + { + "protocol": "DDS", + "instanceIdentifier": "26" + }, + { + "protocol": "DDS", + "instanceIdentifier": "27" + }, + { + "protocol": "DDS", + "instanceIdentifier": "28" + }, + { + "protocol": "DDS", + "instanceIdentifier": "29" + }, + { + "protocol": "DDS", + "instanceIdentifier": "30" + }, + { + "protocol": "DDS", + "instanceIdentifier": "31" + }, + { + "protocol": "DDS", + "instanceIdentifier": "32" + }, + { + "protocol": "DDS", + "instanceIdentifier": "33" + }, + { + "protocol": "DDS", + "instanceIdentifier": "34" + }, + { + "protocol": "DDS", + "instanceIdentifier": "35" + } + ] + }, + { + "instanceSpecifier": "camera_a_cm_receive/CameraReceiveRootSwComponent/CameraEncodedMbufReceiveRPort", + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraEncodedMbufServiceInterface", + "instanceIdentifiers": [ + { + "protocol": "DDS", + "instanceIdentifier": "71" + }, + { + "protocol": "DDS", + "instanceIdentifier": "72" + }, + { + "protocol": "DDS", + "instanceIdentifier": "73" + }, + { + "protocol": "DDS", + "instanceIdentifier": "74" + }, + { + "protocol": "DDS", + "instanceIdentifier": "75" + }, + { + "protocol": "DDS", + "instanceIdentifier": "76" + }, + { + "protocol": "DDS", + "instanceIdentifier": "77" + }, + { + "protocol": "DDS", + "instanceIdentifier": "78" + }, + { + "protocol": "DDS", + "instanceIdentifier": "79" + }, + { + "protocol": "DDS", + "instanceIdentifier": "80" + }, + { + "protocol": "DDS", + "instanceIdentifier": "81" + }, + { + "protocol": "DDS", + "instanceIdentifier": "82" + }, + { + "protocol": "DDS", + "instanceIdentifier": "83" + }, + { + "protocol": "DDS", + "instanceIdentifier": "84" + }, + { + "protocol": "DDS", + "instanceIdentifier": "85" + } + ] + }, + { + "instanceSpecifier": "camera_a_cm_receive/CameraReceiveRootSwComponent/CameraImageMbufReceiveRPort", + "service": "/HuaweiMDC/PlatformServiceInterface/CameraServiceInterfacePkg/CameraImageMbufServiceInterface", + "instanceIdentifiers": [ + { + "protocol": "DDS", + "instanceIdentifier": "1021" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1022" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1023" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1024" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1025" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1026" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1027" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1028" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1029" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1030" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1031" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1032" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1033" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1034" + }, + { + "protocol": "DDS", + "instanceIdentifier": "1035" + } + ] + } + ] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/proloc.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/proloc.json new file mode 100644 index 0000000000000000000000000000000000000000..9f4ec23971845effcb565853ea1c1a44d14b37ea --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/proloc.json @@ -0,0 +1,4 @@ +{ + "applicationName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveSwComponent/CameraReceiveSwComponent/CameraReceiveProcess", + "services": [] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/s2s.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/s2s.json new file mode 100644 index 0000000000000000000000000000000000000000..739f6f9feda00037c28df5798c62b8f75839ec3c --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/s2s.json @@ -0,0 +1,3 @@ +{ + "pdus": [] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/secoc.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/secoc.json new file mode 100644 index 0000000000000000000000000000000000000000..f45ae9e591b5d209763fc8e951043ff73be60a7d --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/secoc.json @@ -0,0 +1,4 @@ +{ + "secocSecureComProps": [], + "secocSecureCommunicationProps": [] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/small_buffer_qos.xml b/local_sensor_data_sender_mdc/CameraReceiveProcess/small_buffer_qos.xml new file mode 100644 index 0000000000000000000000000000000000000000..c71fe6d4f499ba447a0bc9b666a3e227f564dad8 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/small_buffer_qos.xml @@ -0,0 +1,1004 @@ + + + + + TRANSPORT_UDP + + + + 192.168.10.6 + + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + VOLATILE_DURABILITY_QOS + + + BEST_EFFORT_RELIABILITY_QOS + + + BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS + + + KEEP_LAST_HISTORY_QOS + 1 + + + TRANS_CHANNEL_DSHM + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip.json new file mode 100644 index 0000000000000000000000000000000000000000..9a5c45b3490d43f9c12b5e7d47f4c7597edbd584 --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip.json @@ -0,0 +1,28 @@ +{ + "logging": { + "level": "info", + "console": "false", + "syslog": { + "enable": "true" + } + }, + "routing": "someipd", + "network": "InnerEthernetCommConnector", + "unicast": "192.168.10.6", + "netmask": "255.255.255.0", + "applications": [ + { + "name": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveSwComponent/CameraReceiveSwComponent/CameraReceiveProcess", + "id": "28350", + "threads": "2" + } + ], + "services": [], + "clients": [], + "service-discovery": { + "enable": "true", + "multicast": "239.192.255.123", + "port": "30491", + "protocol": "udp" + } +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip_cm.json b/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip_cm.json new file mode 100644 index 0000000000000000000000000000000000000000..9f4ec23971845effcb565853ea1c1a44d14b37ea --- /dev/null +++ b/local_sensor_data_sender_mdc/CameraReceiveProcess/vsomeip_cm.json @@ -0,0 +1,4 @@ +{ + "applicationName": "/HuaweiMDC/PlatformApplication/CameraReceiveApplication/CameraReceiveSwComponent/CameraReceiveSwComponent/CameraReceiveProcess", + "services": [] +} \ No newline at end of file diff --git a/local_sensor_data_sender_mdc/ara/lidar/impl_type_header.h b/local_sensor_data_sender_mdc/ara/lidar/impl_type_header.h new file mode 100644 index 0000000000000000000000000000000000000000..270d6b5828470fc5b29965f518aa6ce283755332 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/impl_type_header.h @@ -0,0 +1,48 @@ +#ifndef ARA_LIDAR_IMPL_TYPE_HEADER_H +#define ARA_LIDAR_IMPL_TYPE_HEADER_H +#include +#include + +#include "impl_type_time.h" +#include "impl_type_uint32.h" +#include "impl_type_string.h" + +namespace ara { + namespace lidar { + struct Header { + ::UINT32 seq; + ::ara::lidar::Time stamp; + ::String frameId; + + static bool IsPlane() + { + return false; + } + + using IsEnumerableTag = void; + template + void enumerate(F& fun) + { + fun(seq); + fun(stamp); + fun(frameId); + } + + template + void enumerate(F& fun) const + { + fun(seq); + fun(stamp); + fun(frameId); + } + + bool operator == (const::ara::lidar::Header& t) const + { + return (seq == t.seq) && (stamp == t.stamp) && (frameId == t.frameId); + } + }; + } +} + + +#endif diff --git a/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointcloud.h b/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointcloud.h new file mode 100644 index 0000000000000000000000000000000000000000..aa471fb3635e36d6519581ecdc12e75c0f1a9b33 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointcloud.h @@ -0,0 +1,64 @@ +#ifndef ARA_LIDAR_IMPL_TYPE_LIDARPOINTCLOUD_H +#define ARA_LIDAR_IMPL_TYPE_LIDARPOINTCLOUD_H +#include +#include + +#include "impl_type_header.h" +#include "impl_type_lidarpointfield.h" +#include "impl_type_uint32.h" + +namespace ara { +namespace lidar { +struct LidarPointCloud { + ::ara::lidar::Header header; + ::UInt32 isBigEndian; + ::UInt32 height; + ::UInt32 width; + ::UInt32 pointStep; + ::UInt32 rowStep; + ::UInt32 isDense; + ::ara::lidar::LidarPointField data; + + static bool IsPlane() + { + return false; + } + + using IsEnumerableTag = void; + template + void enumerate(F& fun) + { + fun(header); + fun(isBigEndian); + fun(height); + fun(width); + fun(pointStep); + fun(rowStep); + fun(isDense); + fun(data); + } + + template + void enumerate(F& fun) const + { + fun(header); + fun(isBigEndian); + fun(height); + fun(width); + fun(pointStep); + fun(rowStep); + fun(isDense); + fun(data); + } + + bool operator == (const ::ara::lidar::LidarPointCloud& t) const + { + return (header == t.header) && (isBigEndian == t.isBigEndian) &&(height == t.height) + && (width == t.width) && (pointStep == t.pointStep) && (rowStep == t.rowStep) + && (isDense == t.isDense) && (data == t.data); + } +}; +} // namespace lidar +} // namespace ara + +#endif diff --git a/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointfield.h b/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointfield.h new file mode 100644 index 0000000000000000000000000000000000000000..99e13f35fdfd2e0cfce99eb75db62628df1d61f7 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/impl_type_lidarpointfield.h @@ -0,0 +1,12 @@ +#ifndef ARA_LIDAR_IMPL_TYPE_LIDARPOINTFIELD_H +#define ARA_LIDAR_IMPL_TYPE_LIDARPOINTFIELD_H +#include "ara/core/vector.h" +#include "impl_type_uint8.h" + +namespace ara { +namespace lidar { +using LidarPointField = ara::core::Vector; +} // namespace lidar +} // namespace ara + +#endif // ARA_LIDAR_IMPL_TYPE_LIDARPOINTFIELD_H diff --git a/local_sensor_data_sender_mdc/ara/lidar/impl_type_time.h b/local_sensor_data_sender_mdc/ara/lidar/impl_type_time.h new file mode 100644 index 0000000000000000000000000000000000000000..d3b49b9f605478d40b732299cf200e94da67f5a0 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/impl_type_time.h @@ -0,0 +1,41 @@ +#ifndef ARA_LIDAR_IMPL_TYPE_TIME_H +#define ARA_LIDAR_IMPL_TYPE_TIME_H +#include +#include +#include "impl_type_uint32.h" + +namespace ara { +namespace lidar { +struct Time { + ::UInt32 sec; + ::UInt32 nsec; + + static bool IsPlane() + { + return true; + } + + using IsEnumerableTag = void; + template + void enumerate(F& fun) + { + fun(sec); + fun(nsec); + } + + template + void enumerate(F& fun) const + { + fun(sec); + fun(nsec); + } + + bool operator == (const ::ara::lidar::Time& t) const + { + return (sec == t.sec) && (nsec == t.nsec); + } +}; +} // namespace lidar +} // namespace ara + +#endif // ARA_LIDAR_IMPL_TYPE_TIME_H diff --git a/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_common.h b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_common.h new file mode 100644 index 0000000000000000000000000000000000000000..8801a192c69c76c2a3af9e2701e3ea0c3d9bcfb3 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_common.h @@ -0,0 +1,21 @@ +#ifndef ARA_LIDAR_LIDARSERVICEINTERFACE_COMMON_H +#define ARA_LIDAR_LIDARSERVICEINTERFACE_COMMON_H + +#include +#include +#include "impl_type_lidarpointcloud.h" +#include "ara/com/types.h" + +namespace ara { +namespace lidar { + +class LidarServiceInterface { +public: + constexpr LidarServiceInterface() = default; + constexpr static ara::com::ServiceIdentifierType ServiceIdentifier = ara::com::ServiceIdentifierType("/HuaweiMDC/PlatformServiceInterface/LidarServiceInterface/LidarServiceInterface"); + constexpr static ara::com::ServiceVersionType ServiceVersion = ara::com::ServiceVersionType("1.1"); +}; +} // namespace lidar +} // namespace ara + +#endif // ARA_LIDAR_LIDARSERVICEINTERFACE_COMMON_H diff --git a/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_proxy.h b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..db578c88e7d8dd6b38bc26da2400ea153dc1bced --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_proxy.h @@ -0,0 +1,152 @@ +#ifndef ARA_LIDAR_LIDARSERVICEINTERFACE_PROXY_H +#define ARA_LIDAR_LIDARSERVICEINTERFACE_PROXY_H + +#include +#include "ara/com/internal/proxy/proxy_adapter.h" +#include "ara/com/internal/proxy/event_adapter.h" +#include "ara/com/internal/proxy/field_adapter.h" +#include "ara/com/internal/proxy/method_adapter.h" +#include "ara/com/crc_verification.h" +#include "lidarserviceinterface_common.h" + +namespace ara { +namespace lidar { +namespace proxy { +namespace events { + using mdcEvent = ara::com::internal::proxy::event::EventAdapter<::ara::lidar::LidarPointCloud>; + static constexpr ara::com::internal::EntityId LidarServiceInterfacemdcEventId = 10488; // mdcEvent_event_hash +} + +namespace fields { +} + +namespace methods { +} + +class LidarServiceInterfaceProxy { +private: + std::unique_ptr proxyAdapter; +public: + using HandleType = vrtf::vcc::api::types::HandleType; + class ConstructionToken { + public: + ConstructionToken(std::unique_ptr proxy):ptr(std::move(proxy)) {} + ConstructionToken(ConstructionToken&& other) : ptr(std::move(other.ptr)) {} + ConstructionToken& operator = (ConstructionToken && other) + { + if (&other != this) { + ptr = std::move(other.ptr); + } + return *this; + } + ConstructionToken(const ConstructionToken&) = delete; + ConstructionToken& operator = (const ConstructionToken&) = delete; + std::unique_ptr GetProxyAdapter() + { + return std::move(ptr); + } + private: + std::unique_ptr ptr; + }; + + virtual ~LidarServiceInterfaceProxy() + { + mdcEvent.UnsetReceiveHandler(); + mdcEvent.Unsubscribe(); + } + + explicit LidarServiceInterfaceProxy(const vrtf::vcc::api::types::HandleType &handle) + :proxyAdapter(std::make_unique(::ara::lidar::LidarServiceInterface:: + ServiceIdentifier, handle)), mdcEvent(proxyAdapter->GetProxy(), events::LidarServiceInterfacemdcEventId, + proxyAdapter->GetHandle(), ::ara::lidar::LidarServiceInterface::ServiceIdentifier) { + } + + void ThrowError(ara::core::Result& result) + { + if (!(result.HasValue())) { +#ifndef NOT_SUPPORT_EXCEPTIONS + ara::core::ErrorCode errorcode(result.Error()); + throw ara::com::ComException(std::move(errorcode)); +#else + std::cerr << "Error:Not support exception,create proxy failed!" << std::endl; +#endif + } + } + + LidarServiceInterfaceProxy(const LidarServiceInterfaceProxy&) = delete; + LidarServiceInterfaceProxy& operator = (const LidarServiceInterfaceProxy&) = delete; + + LidarServiceInterfaceProxy(LidarServiceInterfaceProxy&& other) = default; + + LidarServiceInterfaceProxy& operator = (LidarServiceInterfaceProxy&& other) = default; + + + LidarServiceInterfaceProxy(ConstructionToken&& token) noexcept + :proxyAdapter(token.GetProxyAdapter()), mdcEvent(proxyAdapter->GetProxy(), events::LidarServiceInterfacemdcEventId, + proxyAdapter->GetHandle(), ::ara::lidar::LidarServiceInterface::ServiceIdentifier) { + } + + static ara::core::Result Preconstruct( + const vrtf::vcc::api::types::HandleType & handle) + { + std::unique_ptr preProxyAdapter = + std::make_unique( + ::ara::lidar::LidarServiceInterface::ServiceIdentifier, handle); + bool result = true; + ara::core::Result initResult; + do { + } while (false); + + if (result == true) { + ConstructionToken token(std::move(preProxyAdapter)); + return ara::core::Result(std::move(token)); + } else { + ConstructionToken token(std::move(preProxyAdapter)); + ara::core::Result preResult(std::move(token)); + ara::core::ErrorCode errorcode(initResult.Error()); + preResult.EmplaceError(errorcode); + return preResult; + } + } + + static ara::com::FindServiceHandle StartFindService( + ara::com::FindServiceHandler handler, + ara::com::InstanceIdentifier instance) + { + return ara::com::internal::proxy::ProxyAdapter::StartFindService(handler, ::ara::lidar::LidarServiceInterface::ServiceIdentifier, instance); + } + + static ara::com::FindServiceHandle StartFindService( + ara::com::FindServiceHandler handler, + ara::core::InstanceSpecifier specifier) + { + return ara::com::internal::proxy::ProxyAdapter::StartFindService(handler, ::ara::lidar::LidarServiceInterface::ServiceIdentifier, specifier); + } + + static ara::com::ServiceHandleContainer FindService( + ara::com::InstanceIdentifier instance) + { + return ara::com::internal:: proxy::ProxyAdapter::FindService(::ara::lidar::LidarServiceInterface:: ServiceIdentifier, instance); + } + + static ara::com::ServiceHandleContainer FindService( + ara::core::InstanceSpecifier specifier) + { + return ara::com::internal:: proxy::ProxyAdapter::FindService(::ara::lidar::LidarServiceInterface::ServiceIdentifier,specifier); + } + + static void StopFindService(const ara::com::FindServiceHandle& handle) + { + ara::com::internal::proxy::ProxyAdapter::StopFindService(handle); + } + + HandleType GetHandle() const + { + return proxyAdapter->GetHandle(); + } + events::mdcEvent mdcEvent; + }; + } + } +} +#endif diff --git a/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_skeleton.h b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_skeleton.h new file mode 100644 index 0000000000000000000000000000000000000000..2ef344b79e62bc82430f7122b1903e8a44ed2565 --- /dev/null +++ b/local_sensor_data_sender_mdc/ara/lidar/lidarserviceinterface_skeleton.h @@ -0,0 +1,201 @@ +#ifndef ARA_LIDAR_LIDARSERVICEINTERFACE_SKELETON_H +#define ARA_LIDAR_LIDARSERVICEINTERFACE_SKELETON_H + +#include +#include "ara/com/internal/skeleton/skeleton_adapter.h" +#include "ara/com/internal/skeleton/event_adapter.h" +#include "ara/com/internal/skeleton/field_adapter.h" +#include "ara/com/internal/skeleton/method_adapter.h" +#include "ara/com/crc_verification.h" +#include "lidarserviceinterface_common.h" + +namespace ara { + namespace lidar { + namespace skeleton { + namespace events { + using mdcEvent = ara::com::internal::skeleton::event::EventAdapter<::ara::lidar::LidarPointCloud>; + static constexpr ara::com::internal::EntityId LidarServiceInterfacemdcEventId = 10488; + } + namespace methods { + } + + namespace fields { + } + + class LidarServiceInterfaceSkeleton { + private: + std::unique_ptr skeletonAdapter; + void ConstructSkeleton(ara::com::MethodCallProcessingMode mode) + { + if (mode == ara::com::MethodCallProcessingMode::kEvent) { + if (!(skeletonAdapter->SetMethodThreadNumber(skeletonAdapter->GetMethodThreadNumber(0), 1024))); { + #ifndef NOT_SUPPORT_EXCEPTIONS + ara::core::ErrorCode errorcode(ara::com::ComErrc::kNetworkBindingFailure); + throw ara::com::ComException(std::move(errorcode)); + #else + std::cerr << "Error: Not support exception,create skeleton failed" << std::endl; + #endif + } + } + ara::core::Result resultmdcEvent = skeletonAdapter->InitializeEvent(mdcEvent); + ThrowError(resultmdcEvent); + } + + void ThrowError(ara::core::Result &result) + { + if (!(result.HasValue())) { + #ifndef NOT_SUPPORT_EXCEPTIONS + ara::core::ErrorCode errorcode(result.Error()); + throw ara::com::ComException(std::move(errorcode)); + #else + std::cerr << "Error: Not support exception,create skeleton failed" << std::endl; + #endif + } + } + public: + class ConstructionToken { + public: + ConstructionToken(std::unique_ptr skeleton) + :ptr(std::move(skeleton)) {} + ConstructionToken(ConstructionToken&& other) : ptr(std::move(other.ptr)) {} + ConstructionToken& operator = (ConstructionToken && other) + { + if ( &other != this) { + ptr = std::move(other.ptr); + } + return *this; + } + ConstructionToken(const ConstructionToken&) = delete; + ConstructionToken& operator = (const ConstructionToken&) = delete; + std::unique_ptr GetSkeletonAdapter() + { + return std::move(ptr); + } + private: + std::unique_ptr ptr; + }; + explicit LidarServiceInterfaceSkeleton(ara::com::InstanceIdentifier instanceId, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + :skeletonAdapter(std::make_unique(::ara::lidar::LidarServiceInterface::ServiceIdentifier,instanceId,mode)), + mdcEvent(skeletonAdapter->GetSkeleton(),events::LidarServiceInterfacemdcEventId) { + ConstructSkeleton(mode); + } + + explicit LidarServiceInterfaceSkeleton(ara::core::InstanceSpecifier instanceSpec, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + :skeletonAdapter(std::make_unique(::ara::lidar::LidarServiceInterface::ServiceIdentifier, instanceSpec,mode)), + mdcEvent(skeletonAdapter->GetSkeleton(), events::LidarServiceInterfacemdcEventId) { + ConstructSkeleton(mode); + } + + explicit LidarServiceInterfaceSkeleton(ara::com::InstanceIdentifierContainer instanceContainer, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + :skeletonAdapter(std::make_unique(::ara::lidar::LidarServiceInterface::ServiceIdentifier, instanceContainer, mode)), + mdcEvent(skeletonAdapter->GetSkeleton(), events::LidarServiceInterfacemdcEventId) { + ConstructSkeleton(mode); + } + + LidarServiceInterfaceSkeleton(const LidarServiceInterfaceSkeleton&) = delete; + LidarServiceInterfaceSkeleton& operator = (const LidarServiceInterfaceSkeleton&) = delete; + + LidarServiceInterfaceSkeleton(LidarServiceInterfaceSkeleton&& other) = default; + LidarServiceInterfaceSkeleton& operator = (LidarServiceInterfaceSkeleton&& other) = default; + LidarServiceInterfaceSkeleton(ConstructionToken&& token) noexcept + : skeletonAdapter(token.GetSkeletonAdapter()), + mdcEvent(skeletonAdapter->GetSkeleton(), events::LidarServiceInterfacemdcEventId) { + } + + static ara::core::Result Preconstruct( + ara::com::InstanceIdentifier instanceId, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + { + std::unique_ptr preSkeletonAdapter = + std::make_unique( + ::ara::lidar::LidarServiceInterface::ServiceIdentifier, instanceId, mode); + return PreConstructResult(preSkeletonAdapter, mode); + } + + static ara::core::Result Preconstruct( + ara::core::InstanceSpecifier instanceSpec, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + { + std::unique_ptr preSkeletonAdapter = + std::make_unique( + ::ara::lidar::LidarServiceInterface::ServiceIdentifier, instanceSpec, mode); + return PreConstructResult(preSkeletonAdapter, mode); + } + + static ara::core::Result Preconstruct( + ara::com::InstanceIdentifierContainer instanceIdContainer, + ara::com::MethodCallProcessingMode mode = ara::com::MethodCallProcessingMode::kEvent) + { + std::unique_ptr preSkeletonAdapter = + std::make_unique( + ::ara::lidar::LidarServiceInterface::ServiceIdentifier, instanceIdContainer, mode); + return PreConstructResult(preSkeletonAdapter, mode); + } + + static ara::core::Result PreConstructResult( + std::unique_ptr& preSkeletonAdapter, ara::com::MethodCallProcessingMode mode) + { + bool result = true; + ara::core::Result initResult; + do { + if (mode == ara::com::MethodCallProcessingMode::kEvent) { + if (!preSkeletonAdapter->SetMethodThreadNumber(preSkeletonAdapter->GetMethodThreadNumber(0), 1024)) { + result = false; + ara::core::ErrorCode errorcode(ara::com::ComErrc::kNetworkBindingFailure); + initResult.EmplaceError(errorcode); + break; + } + } + events::mdcEvent mdcEvent(preSkeletonAdapter->GetSkeleton(),events::LidarServiceInterfacemdcEventId); + initResult= preSkeletonAdapter->InitializeEvent(mdcEvent); + if (!initResult.HasValue()) { + result = false; + break; + } + } while (false); + + if (result == true) { + ConstructionToken token(std::move(preSkeletonAdapter)); + return ara::core::Result(std::move(token)); + } else { + ConstructionToken token(std::move(preSkeletonAdapter)); + ara::core::Result preResult(std::move(token)); + ara::core::ErrorCode errorcode(initResult.Error()); + preResult.EmplaceError(errorcode); + return preResult; + } + } + + virtual ~LidarServiceInterfaceSkeleton() + { + StopOfferService(); + } + + void OfferService() + { + skeletonAdapter->RegisterE2EErrorHandler(&LidarServiceInterfaceSkeleton::E2EErrorHandler, *this); + skeletonAdapter->OfferService(); + } + void StopOfferService() + { + skeletonAdapter->StopOfferService(); + } + ara::core::Future ProcessNextMethodCall() + { + return skeletonAdapter->ProcessNextMethodCall(); + } + bool SetMethodThreadNumber(const std::uint16_t& number, const std::uint16_t& queueSize) + { + return skeletonAdapter->SetMethodThreadNumber(number, queueSize); + } + virtual void E2EErrorHandler(ara::com::e2e::E2EErrorCode errorcode, ara::com::e2e::DataID dataID, ara::com::e2e::MessageCounter) {} + + events::mdcEvent mdcEvent; + }; + } + } +} +#endif diff --git a/local_sensor_data_sender_mdc/bin/local_sensor_simulation b/local_sensor_data_sender_mdc/bin/local_sensor_simulation new file mode 100755 index 0000000000000000000000000000000000000000..45ef4c96fd9b6b28622a01827fe61b2472e3b8a6 Binary files /dev/null and b/local_sensor_data_sender_mdc/bin/local_sensor_simulation differ diff --git a/local_sensor_data_sender_mdc/config.yaml b/local_sensor_data_sender_mdc/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4328113c0ddbd9b63056ab2c9cc6ea6cfcb2fe99 --- /dev/null +++ b/local_sensor_data_sender_mdc/config.yaml @@ -0,0 +1,14 @@ +- dir: "image" + instancedId: 21 + width: 1920 + height: 1080 +- dir: "image1" + instancedId: 22 + width: 1920 + height: 1080 +- dir: "video" + instancedId: 23 + width: 480 + height: 270 + + diff --git a/local_sensor_data_sender_mdc/image_sender_base.h b/local_sensor_data_sender_mdc/image_sender_base.h new file mode 100644 index 0000000000000000000000000000000000000000..40af13b80c15eb5c929642ea8d42510ba536a8ca --- /dev/null +++ b/local_sensor_data_sender_mdc/image_sender_base.h @@ -0,0 +1,64 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: image_sender_base head file +*/ +#ifndef _image_sender_base_h +#define _image_sender_base_h +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mdc/cam/camera/cameradecodedserviceinterface_skeleton.h" +#include "mdc/cam/camera/cameradecodedmbufserviceinterface_skeleton.h" + +static struct CommandPara{ + std::string fileType{""}; + std::string configFile{""}; + std::string transMode{""}; + std::string frequency{""}; + bool loop{false}; + std::string time{""}; +} comPara; + +template +class ImageSenderBase { +public: + ImageSenderBase() = default; + virtual ~ImageSenderBase() = default; + ImageSenderBase(uint32_t id, cv::Size s, std::string dir) : instanceId(id), imgSize(s), dir(dir) + { + frameID += std::to_string(id); + } + bool RegisterSender() + { + using ara::com::InstanceIdentifier; + using ara::com::MethodCallProcessingMode; + std::string idStr = std::to_string(instanceId); + std::cout << "Begin to Register to publish instance id: " << idStr << std::endl; + ara::core::StringView id(idStr.c_str()); + dataSkeleton = std::make_unique(InstanceIdentifier(id), MethodCallProcessingMode::kPoll); + if (dataSkeleton == nullptr) { + std::cerr << "Publish to instance id: " << idStr << "failed!" << std::endl; + return false; + } + dataSkeleton->OfferService(); + std::cerr << "Publish to instance id: " << idStr << " succeed!" << std::endl; + return true; + } + virtual void FillImageAndSend(std::string imgPath, uint32_t seq, void *flag) = 0; + +protected: + uint32_t instanceId{ 21 }; + std::string frameID{"sender_"}; + std::shared_ptr dataSkeleton{}; + std::string dir{""}; +public: + cv::Size imgSize{1920, 1080}; +}; + +#endif diff --git a/local_sensor_data_sender_mdc/main.cpp b/local_sensor_data_sender_mdc/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..702fa7485e999378be9fbe826c3a22dfbbc5798d --- /dev/null +++ b/local_sensor_data_sender_mdc/main.cpp @@ -0,0 +1,247 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: main file +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mbuf_image_sender.h" +#include "mbuf_video_sender.h" +#include "mbuf_yuv_sender.h" +#include "pcd_sender.h" +#include "ara/rm/rm.h" +#include "util.h" + +using namespace std; +using namespace cv; + +int32_t g_stopFlag = 0; + +void INTSigHandler(int32_t num) +{ + g_stopFlag = num; + std::cout << "=======\nSignal Interactive attention received.\n " << std::endl; +} + +void SetEnv() +{ + if(comPara.fileType == "pcd") { + setenv("CM_CONFIG_FILE_PATH", "/opt/platform/mdc_platform/manual_service/lidar_a_cm/etc/LidarCmProcess", 1); + } else { + setenv("CM_CONFIG_FILE_PATH", "/opt/platform/mdc_platform/manual_service/camera_a_cm/etc/CameraProcess", 1); + } +} + +inline bool FileExist(const std::string& name) { + struct stat buffer; + return (stat (name.c_str(), &buffer) == 0); +} + +inline bool IsInstanceIdAvialable(std::string fileType, int32_t id) +{ + bool idIsAvailable = false; + if (fileType == "pcd") { + // 3为lidar的InstanceId最小值 7为lidar的InstanceId最大值 + if (id >= 3 && id <= 7) { + idIsAvailable = true; + return idIsAvailable; + } + std::cout << "current " <= 21 && id <= 35) { + idIsAvailable = true; + return idIsAvailable; + } + std::cout << "current "<< fileType << " instanceId is "<< id << ",instanceId error, available value is [21,35]" << std::endl; + return idIsAvailable; +} + +int main(int32_t argc, char* argv[]) +{ + int32_t ch; + while((ch = getopt(argc,argv,"c:f:hlm:r:t:")) != -1) { + switch(ch) { + case 'c': + comPara.configFile = optarg; + break; + case 'f': + comPara.fileType = optarg; + break; + case 'h': + printf("--usage: \n"); + printf("./local_sensor_simulation -f [fileType] -c [configFile] -m [transMode] \n"); + printf("for example: ./local_sensor_simulation -f jpg -c image_config.yaml -m decoded -r 30 \n"); + printf("\n"); + printf("--option: \n"); + printf(" -f : [jpg/jpeg/yuv/h264/h265/pcd], requirement \n"); + printf(" -c : [configFile], requirement \n"); + printf(" -m : [decoded/image/simple/standard], option \n"); + printf(" -t : [yyyy-MM-dd HH:mm:ss], option \n"); + printf(" -r : [hz], option \n"); + printf(" -l , for loop, option \n"); + printf(" -h , for help, option \n"); + return 0; + case 'l': + comPara.loop = true; + break; + case 'm': + comPara.transMode = optarg; + break; + case 'r': + comPara.frequency = optarg; + break; + case 't': + comPara.time = optarg; + break; + case '?': + printf("miss para!\n"); + break; + case ':': + printf("invalid para! please input '-h' for help\n"); + break; + } + } + + if(comPara.fileType == "") { + std::cout << "'-f File type' can not be empty!" << std::endl; + return 1; + } else { + if(comPara.fileType != "jpg" && comPara.fileType != "jpeg" && comPara.fileType != "yuv" && + comPara.fileType != "h264" && comPara.fileType != "h265" && comPara.fileType != "pcd") { + std::cout << "-f File type is error: "<< comPara.fileType << std::endl; + return 1; + } + } + + if(comPara.configFile == "") { + std::cout << "'-c Config file' can not be empty!" << std::endl; + return 1; + } + // 配置文件不存在则退出 + if (!FileExist(comPara.configFile)) { + std::cout << comPara.configFile << " file is not exist!" << std::endl; + return 1; + } + + if(comPara.frequency != "") { + int32_t frequency = atoi(comPara.frequency.c_str()); + if(frequency <= 0 || frequency > 100) { + std::cout << "-r frequency must be (0 < frequency <= 100)" << std::endl; + return 1; + } + } + if(comPara.transMode != "") { + if(comPara.transMode != "decoded" && comPara.transMode != "image" && comPara.transMode != "standard" && comPara.transMode != "simple") { + std::cout << "-m transfer mode is error:" << comPara.transMode << std::endl; + } + } + + ConfigMangage configManage{comPara.configFile}; + configManage.Parse(); + cout << "parse finished. [main]" << endl; + configManage.Show(); + if(!configManage.CheckConfig()) { + cerr << "Config check failed." << endl; + return 1; + } + auto configs = configManage.GetConfig(); + + if(!ara::rm::RegisterHisiResource()) { + std::cerr << "Register process to RM failed! Check if RM has been started." << std::endl; + return -1; + } + + vector> mbufSenders; + vector> mbufVideoSenders; + vector> mbufYuvSenders; + vector> pcdSenders; + for(auto& conf : configs) { + std::vector files; + int32_t fileCnt = getFilesBySort(conf.dir, files, comPara.fileType); + if(fileCnt == 0) { + std::cout << "dir : " << conf.dir << " has no " << comPara.fileType << " file" << std::endl; + continue; + } + // 校验instanceId + if (!IsInstanceIdAvialable(comPara.fileType, conf.instanceId)){ + continue; + } + if(comPara.fileType == "jpg" || comPara.fileType == "jpeg") { + mbufSenders.push_back(make_shared(conf.instanceId, Size{conf.width, conf.height}, conf.dir)); + } + if(comPara.fileType == "h264" || comPara.fileType == "h265") { + mbufVideoSenders.push_back(make_shared(conf.instanceId, Size{conf.width, conf.height}, conf.dir)); + } + if(comPara.fileType == "yuv") { + mbufYuvSenders.push_back(make_shared(conf.instanceId, Size{conf.width, conf.height}, conf.dir)); + } + if(comPara.fileType == "pcd") { + pcdSenders.push_back(make_shared(conf.instanceId, Size{conf.width, conf.height}, conf.dir)); + } + } + + SetEnv(); + for(auto& send : mbufSenders) { + send->RegisterSender(); + if(send->BufCreatePool(2880 * 1856 * 3, 20) == 0) { + std::cout << "INFO: send->BufCreatePool succeed one!" << std::endl; + } else { + std::cout << "ERROR: send->BufCreatePool failed!" << std::endl; + return -1; + } + } + for(auto& videoSend : mbufVideoSenders) { + videoSend->RegisterSender(); + if(videoSend->BufCreatePool(2880 * 1856 * 3, 20) == 0) { + std::cout << "INFO: send->BufCreatePool succeed one!" << std::endl; + } else { + std::cout << "ERROR: send->BufCreatePool failed!" << std::endl; + return -1; + } + } + for(auto& yuvSend : mbufYuvSenders) { + yuvSend->RegisterSender(); + if(yuvSend->BufCreatePool(2880 * 1856 * 3, 20) == 0) { + std::cout << "INFO: send->BufCreatePool succeed one!" << std::endl; + } else { + std::cout << "ERROR: send->BufCreatePool failed!" << std::endl; + return -1; + } + } + for(auto& pcdSend : pcdSenders) { + pcdSend->RegisterSender(); + } + usleep(1000000); + vector pool; + + for(auto& send: mbufSenders) { + pool.push_back(thread(&MbufImageSender::FillImageAndSend, send, "", 0, &g_stopFlag)); + } + + for(auto& videoSend : mbufVideoSenders) { + videoSend->VdecDecoded(); + } + for(auto& yuvSend : mbufYuvSenders) { + pool.push_back(thread(&MbufYuvSender::FillImageAndSend, yuvSend, "", 0, &g_stopFlag)); + } + for(auto& pcdSend : pcdSenders) { + pool.push_back(thread(&PcdSender::FillImageAndSend, pcdSend, "", 0, &g_stopFlag)); + } + + for(auto& t : pool) { + if(t.joinable()) { + t.join(); + } + } + return 0; +} + diff --git a/local_sensor_data_sender_mdc/mbuf_image_sender.h b/local_sensor_data_sender_mdc/mbuf_image_sender.h new file mode 100644 index 0000000000000000000000000000000000000000..6435b8ac1507d92b23758364319a7480660f6c83 --- /dev/null +++ b/local_sensor_data_sender_mdc/mbuf_image_sender.h @@ -0,0 +1,185 @@ +#pragma once + +#include "image_sender_base.h" +#include "mdc/cam/camera/cameradecodedmbufserviceinterface_skeleton.h" +#include "util.h" +#include "core/types.h" +#include "driver/ascend_hal.h" +#include "securec.h" + +using namespace std; +using namespace cv; + +using MbufSkeleton = mdc::cam::camera::skeleton::CameraDecodedMbufServiceInterfaceSkeleton; +class MbufImageSender : public ImageSenderBase { +private: + poolHandle handle; + float lastTime = 0.0F; + std::string sourceYuvPath; + FILE *fp_yuv; + chrono::high_resolution_clock::time_point sec;//-t used +public: + MbufImageSender() = default; + MbufImageSender(uint32_t id, cv::Size s, std::string dir) : ImageSenderBase(id, s, dir) + { + sourceYuvPath = dir; + if (dir.back() != '/') { + sourceYuvPath += string("/") + "imageSource.yuv"; + } else { + sourceYuvPath += "imageSource.yuv"; + } + fp_yuv=fopen(sourceYuvPath.c_str(), "wb+"); + sec = chrono::high_resolution_clock::now(); + } + ~MbufImageSender() + { + if(dataSkeleton != nullptr) { + dataSkeleton->StopOfferService(); + dataSkeleton = nullptr; + } + if(handle != nullptr) { + halBuffDeletePool(handle); + } + }; + + bool RegisterSender() + { + std::cout << "Begin register MBUF image sender." << endl; + auto result = ImageSenderBase::RegisterSender(); + std::cout << "Finished to register MBUF image sender." << endl; + return result; + } + + int32_t BufCreatePool(const uint32_t blkSize, const uint32_t blkNum) + { + constexpr uint32_t alignSize = 32U; + mpAttr attr; + attr.devid = 0; + attr.mGroupId = 0; + attr.blkSize = ((blkSize + alignSize) - 1U) & (~(alignSize - 1)); + attr.blkNum = blkNum; + attr.align = alignSize; + attr.hugePageFlag = 1U; + const int32_t ret = halBuffCreatePool(&attr, &handle); + if (ret != DRV_ERROR_NONE) { + std::cout << "halBuffCreatePool error: " << ret << std::endl; + return -1; + } + return 0; + } + + int32_t CopyToMbuf(uintptr_t& mbuf, const uint8_t* src, const uint32_t len) const + { + Mbuf * pMbuf = nullptr; + int32_t ret = halMbufAllocByPool(handle, &pMbuf); + if(ret != DRV_ERROR_NONE) { + std::cout << "halMbufAllocByPool error: " << ret << std::endl; + return -1; + } + if(pMbuf == nullptr) { + std::cout << "halMbufAllocByPool mbuf null" << std::endl; + return -1; + } + void* dst = nullptr; + uint64_t bufSize = 0U; + ret = halMbufGetDataPtr(pMbuf, &dst, &bufSize); + if(ret != 0 || dst == nullptr) { + std::cout << "MbufGetDataPtr error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + if(len > bufSize) { + std::cout << "ERROR: Src data length[" << len << "] > mbuf size[" << bufSize << "]" << std::endl; + halBuffFree(pMbuf); + return -1; + } + if(memcpy_s(reinterpret_cast(dst), static_cast(bufSize),src,static_cast(len)) != 0) { + std::cout << "ERROR: Copy src date to mbuf error!" << std::endl; + halBuffFree(pMbuf); + return -1; + } + ret = halMbufSetDataLen(pMbuf, len); + if(ret != DRV_ERROR_NONE) { + std::cout << "halMbufSetDataLen error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + mbuf = reinterpret_cast(pMbuf); + return 0; + } + + void FillImageAndSend(std::string imgPath, uint32_t seq, void *g_stopFlag) override + { + std::string path = dir; + std::string postfix = comPara.fileType; + bool isLoop = comPara.loop; + cout<< "dir : " << dir << "\t" << "postfix :" << postfix << endl; + std::vector files; + int32_t fileCnt = getFilesBySort(path, files, comPara.fileType); + if (fileCnt == 0) { + cout << "PATH:" << path << " has no files!" << endl; + return; + } + (void)g_stopFlag; + do { + for (auto& file:files) { + if (file.empty()) { + std::cerr << "File not exist,or corrupt.path:" << file << std::endl; + return; + } + cv::Mat BGR = imread(file, IMREAD_COLOR); + if (imgSize.width != BGR.cols || imgSize.height != BGR.rows) { + cv::resize(BGR, BGR, imgSize); + } + seq = 0; + Mat YUV; + cvtColor(BGR, YUV, cv::COLOR_BGR2YUV_I420); + Mat YUV420NV12 = YUV.clone(); + yuv420p2nv12(YUV, YUV420NV12, BGR.cols, BGR.rows); + + size_t sizeInBytes = YUV420NV12.total() * YUV420NV12.elemSize(); + auto imagePub = dataSkeleton->cameraDecodedMbufEvent.Allocate(); + + imagePub->CameraHeader.Seq = seq; + imagePub->FrameType = static_castFrameType)>( + Adsfi::HAF_IMAGE_YUV420SP_NV12_UINT8); + imagePub->Width = BGR.cols; + imagePub->Height = BGR.rows; + imagePub->DataSize = sizeInBytes; + imagePub->CameraHeader.FrameId = file; + uintptr_t imgdata{}; + (void)CopyToMbuf(imgdata, YUV420NV12.data, sizeInBytes); + if(imgdata == reinterpret_cast(nullptr)) { + std::cout << "ERROR: CopyToMbuf failed!" << std::endl; + return; + } + + imagePub->RawData = reinterpret_cast(imgdata); + fwrite(YUV420NV12.data, 1, sizeInBytes, fp_yuv); + if (comPara.time.empty()) { + timeval now; + gettimeofday(&now, NULL); + imagePub->CameraHeader.Stamp.Sec = now.tv_sec; + imagePub->CameraHeader.Stamp.Nsec = now.tv_usec * 1000U; + } else { + time_t timeStamp = convertTimeStr2TimeStamp(comPara.time); + auto t1= chrono::high_resolution_clock::now(); + int64_t duration = (t1 - sec).count()/1000000000.0; + imagePub->CameraHeader.Stamp.Sec = timeStamp + duration; + printf("timeStamp=%ld\n", timeStamp + duration); + } + + dataSkeleton->cameraDecodedMbufEvent.Send(move(imagePub)); + cout << "Begin send image. seq:" << seq << " frameID:"<< frameID <<" path:" << file << endl; + if (comPara.frequency != "") { + int32_t freq = atoi(comPara.frequency.c_str()); + int32_t sleepTime = 1000000 / freq; + usleep(sleepTime); + } else { + usleep(1000000 / 30); // 30hz + } + } + } while (isLoop); + fclose(fp_yuv); + } +}; diff --git a/local_sensor_data_sender_mdc/mbuf_video_sender.cpp b/local_sensor_data_sender_mdc/mbuf_video_sender.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b693295ab8dfea438617f70bf0dbfe79e4b43fe9 --- /dev/null +++ b/local_sensor_data_sender_mdc/mbuf_video_sender.cpp @@ -0,0 +1,1239 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: mbuf_video_sender.cpp source file +*/ +#include "mbuf_video_sender.h" + +#define buffGrpName "DEFAULT_MEM_GROUP" + +int32_t MbufVideoSender::InitGrp(void) +{ + GroupShareAttr Mattr = {0}; + GroupCfg grpcfg = {0}; + BuffCfg buffcfg = {0}; + int devId = 0; + + int ret; + + grpcfg.maxMemSize = 1024 * 1024 * 32; + Mattr.admin = 1; + Mattr.alloc = 1; + Mattr.write = 1; + Mattr.read = 1; + + ret = halGrpAttach(buffGrpName, 0); + if(ret != HI_SUCCESS) { + printf("manager halGrpAttach failed! ret(%d)\n", ret); + return HI_FAILURE; + } + + ret = halBuffInit(&buffcfg); + if(ret != HI_SUCCESS) { + printf("manager halBuffInit failed! ret(%d)\n", ret); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +void MbufVideoSender::get_current_time_us(uint64_t& timeUs) +{ + struct timeval curTime; + gettimeofday(&curTime, NULL); + timeUs = (uint64_t)curTime.tv_sec * 1000000 + curTime.tv_usec; +} + +void MbufVideoSender::FillYuvAndSend(uint8_t* ptr, int32_t w, int32_t h) +{ + auto imagePub = dataSkeleton->cameraDecodedMbufEvent.Allocate(); + imagePub->CameraHeader.FrameId = frameID; + imagePub->CameraHeader.Seq = 0; + imagePub->FrameType = static_castFrameType)>(Adsfi::HAF_IMAGE_YUV420SP_NV12_UINT8); + imagePub->Width = w; + imagePub->Height = h; + size_t sizeInBytes = w * h * 3 / 2; + imagePub->DataSize = sizeInBytes; + uintptr_t imgdata{}; + Mat YUV420NV12; + (void)CopyToMbuf(imgdata, ptr, sizeInBytes); + if(imgdata == reinterpret_cast(nullptr)) { + std::cout << "ERROR: CopyToMbuf failed!" << std::endl; + return; + } + imagePub->RawData = reinterpret_cast(imgdata); + + auto t1 = std::chrono::steady_clock::now(); + lastTime = std::chrono::duration(t1.time_since_epoch()).count(); + std::stringstream ss3; + ss3 << std::fixed << lastTime; + + if (comPara.time.empty()) { + timeval now; + gettimeofday(&now, NULL); + imagePub->CameraHeader.Stamp.Sec = now.tv_sec; + imagePub->CameraHeader.Stamp.Nsec = now.tv_usec * 1000U; + } else { + time_t timeStamp = convertTimeStr2TimeStamp(comPara.time); + auto t1 = chrono::high_resolution_clock::now(); + int64_t duration = (t1 - sec).count() / 1000000000.0; + imagePub->CameraHeader.Stamp.Sec = timeStamp + duration; + printf("timeStamp = %ld\n", timeStamp + duration); + } + + dataSkeleton->cameraDecodedMbufEvent.Send(move(imagePub)); + cout << "Begin send image. seq: " << 0 << ", frameID: " << frameID << "stamp(ms): " << ss3.str() << endl; + + if(comPara.frequency != "") { + int32_t freq = atoi(comPara.frequency.c_str()); + int32_t sleepTime = 1000000/freq; + usleep(sleepTime); + }else{ + usleep(1000000/30); //30hz + } +} + +void MbufVideoSender::save_yuv_file(FILE* const fd, hi_video_frame frame, uint32_t chanId) +{ + uint8_t* addr = (uint8_t*)frame.virt_addr[0]; + uint32_t imageSize = frame.width * frame.height * 3 / 2; + int32_t ret = HI_SUCCESS; + uint8_t* outImageBuf = nullptr; + uint32_t outWidthStride = frame.width_stride[0]; + uint32_t outHeightStride = frame.height_stride[0]; + + printf("[%s][%d] Chn %u, addr = %lx \n", __FUNCTION__, __LINE__, chanId, (uint64_t)(uintptr_t)frame.virt_addr[0]); + printf("[%s][%d] Chn %u, Width = %u \n", __FUNCTION__, __LINE__, chanId, frame.width); + printf("[%s][%d] Chn %u, Height = %u \n", __FUNCTION__, __LINE__, chanId, frame.height); + printf("[%s][%d] Chn %u, PixelFormat = %d \n", __FUNCTION__, __LINE__, chanId, frame.pixel_format); + printf("[%s][%d] Chn %u, OutWidthStride = %u \n", __FUNCTION__, __LINE__, chanId, frame.width_stride[0]); + printf("[%s][%d] Chn %u, OutHeightStride = %u \n", __FUNCTION__, __LINE__, chanId, frame.height_stride[1]); + printf("[%s][%d] Chn %u, fileName = %s \n", __FUNCTION__, __LINE__, chanId, g_input_file_name); + + if(g_run_mode == ACL_HOST) { + // malloc host memory + ret = aclrtMallocHost((void**)&outImageBuf, imageSize); + if(ret != ACL_SUCCESS) { + printf("[%s][%d] Chn %u malloc host memory %u failed, error code = %d \n", __FUNCTION__, __LINE__, chanId, imageSize, ret); + return; + } + } + + if((frame.width == outWidthStride) && (frame.height == outHeightStride)) { + if(g_run_mode == ACL_HOST) { + ret = aclrtMemcpy(outImageBuf, imageSize, addr, imageSize, ACL_MEMCPY_DEVICE_TO_HOST); + if(ret != ACL_SUCCESS) { + printf("[%s][%d] Chn %u Copy aclrtMemcpy %u from device to host failed, error code = %d \n", __FUNCTION__, __LINE__, chanId, imageSize, ret); + return; + } + FillYuvAndSend(outImageBuf,frame.width,frame.height); + fwrite(outImageBuf, 1, imageSize, fd); + aclrtFreeHost(outImageBuf); + } else { + FillYuvAndSend(addr, frame.width, frame.height); + fwrite(addr, imageSize, 1, fd); + } + } else { + if(g_run_mode == ACL_HOST) { + if(outImageBuf == NULL) { + return; + } + for(uint32_t i=0; i= 5000000) { + vdec_reset_chn(i); + break; + } + } + } + usleep(1000000); + + for(uint32_t i=g_start_chn_num; i(arg); + uint32_t sendFrameFailCnt = 0; + prctl(PR_SET_NAME, "VdecSendStream", 0,0,0); + + uint32_t chanId = 0; + aclError aclRet = aclrtSetCurrentContext(thiz->g_context); + if(aclRet != ACL_SUCCESS) { + printf("[%s][%d] Chn %u set current context failed, error code = %d \n", __FUNCTION__, __LINE__, chanId, aclRet); + return (void*)(HI_FAILURE); + } + + FILE* fpInputFile = NULL; + fpInputFile = fopen(thiz->g_input_file_name, "rb"); + if(fpInputFile == NULL) { + printf("[%s][%d] Chn %u Can not open file %s \n", __FUNCTION__, __LINE__, chanId, thiz->g_input_file_name); + return (void*)(HI_FAILURE); + } + + uint32_t fileSize = 0; + fseek(fpInputFile, 0L, SEEK_END); + fileSize = ftell(fpInputFile); + fseek(fpInputFile, 0L, SEEK_SET); + + uint8_t* inputFileBuf = NULL; + inputFileBuf = (uint8_t*)malloc(fileSize); + if(inputFileBuf == NULL) { + fclose(fpInputFile); + printf("[%s][%d] Chn %u Malloc InputFile Buffer Fail \n", __FUNCTION__, __LINE__, chanId); + return (void*)(HI_FAILURE); + } + + uint32_t readLen = 0; + readLen = fread(inputFileBuf, 1, fileSize, fpInputFile); + if(readLen != fileSize) { + fclose(fpInputFile); + free(inputFileBuf); + printf("[%s][%d] Chn %u Read InputFile Fail \n", __FUNCTION__, __LINE__, chanId); + return (void*)(HI_FAILURE); + } + + uint8_t* dataDev = HI_NULL; + int32_t ret = HI_SUCCESS; + + if(thiz->g_run_mode == ACL_HOST) { + ret = hi_mpi_dvpp_malloc(0, (void**)&dataDev, fileSize); + if(ret != 0) { + fclose(fpInputFile); + free(inputFileBuf); + printf("[%s][%d] Chn %u Malloc device memory %u failed \n", __FUNCTION__, __LINE__, chanId, fileSize); + return (hi_void*)(HI_FAILURE); + } + + ret = aclrtMemcpy(dataDev, fileSize, inputFileBuf, fileSize,ACL_MEMCPY_HOST_TO_DEVICE); + if(ret != ACL_SUCCESS) { + fclose(fpInputFile); + free(inputFileBuf); + hi_mpi_dvpp_free(dataDev); + printf("[%s][%d] Chn %u Copy host memcpy to device failed, error code = %d. \n", __FUNCTION__, __LINE__, chanId, ret); + return (hi_void*)(HI_FAILURE); + } + } + uint32_t frameCount = 0; + hi_payload_type type = (thiz->g_in_format == 0) ? HI_PT_H264 : HI_PT_H265; + thiz->get_every_frame(chanId, inputFileBuf, &frameCount, fileSize, type, dataDev); + + void* outBuffer = NULL; + uint32_t outBufferSize = 0; + if((thiz->g_out_format == 0) || (thiz->g_out_format == 1)) { + outBufferSize = thiz->g_out_width_stride * thiz->g_out_height_stride * 3/2; + } else if((thiz->g_out_format == 2) || (thiz->g_out_format == 3)) { + outBufferSize = thiz->g_out_width_stride * thiz->g_out_height_stride; + } + + for(uint32_t i=0; ig_alloc_num; i++) { + ret = hi_mpi_dvpp_malloc(0, &outBuffer, outBufferSize); + if(ret != HI_SUCCESS) { + fclose(fpInputFile); + free(inputFileBuf); + if(thiz->g_run_mode == ACL_HOST) { + hi_mpi_dvpp_free(dataDev); + } + printf("[%s][%d] Chn %u hi_mpi_dvpp_malloc failed.\n", __FUNCTION__, __LINE__, chanId); + return (void*)(HI_FAILURE); + } + thiz->g_out_buffer_pool[chanId].push_back(outBuffer); + } + thiz->delay_exec(thiz->g_start_time, thiz->g_delay_time); + thiz->get_current_time_us(thiz->g_vdec_start_time[chanId]); + + hi_vdec_stream stream; + hi_vdec_pic_info outPicInfo; + uint32_t readCount = 0; + hi_pixel_format outFormat = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + uint64_t currentSendTime = 0; + uint64_t lastSendTime = 0; + uint32_t circleTimes = 0; + switch(thiz->g_out_format) { + case 0: + outFormat = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + break; + case 1: + outFormat = HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420; + break; + case 2: + outFormat = HI_PIXEL_FORMAT_RGB_888; + break; + case 3: + outFormat = HI_PIXEL_FORMAT_BGR_888; + break; + default: + break; + } + int32_t timeOut = 1000; + thiz->get_current_time_us(currentSendTime); + while(1) { + if(thiz->g_send_exit_state[chanId] == 1) { + break; + } + stream.pts = currentSendTime + thiz->g_send_interval; + stream.addr = thiz->g_frame_addr[chanId][readCount]; + stream.len = thiz->g_frame_len[chanId][readCount]; + stream.end_of_frame = HI_TRUE; + stream.end_of_stream = HI_FALSE; + + outPicInfo.width = thiz->g_out_width; + outPicInfo.height = thiz->g_out_height; + outPicInfo.width_stride = thiz->g_out_width_stride; + outPicInfo.height_stride = thiz->g_out_height_stride; + outPicInfo.pixel_format = outFormat; + + if((thiz->g_render == 0) || (readCount % thiz->g_render == 0)) { + int32_t mallocCount = 0; + int32_t tryTimes = 20000; + while(thiz->g_send_exit_state[chanId] == 0) { + mallocCount++; + (void)pthread_mutex_lock(&thiz->g_out_buffer_pool_lock[chanId]); + if(thiz->g_out_buffer_pool[chanId].empty() == false) { + outBuffer = thiz->g_out_buffer_pool[chanId].back(); + thiz->g_out_buffer_pool[chanId].pop_back(); + (void)pthread_mutex_unlock(&thiz->g_out_buffer_pool_lock[chanId]); + break; + } else { + (void)pthread_mutex_unlock(&thiz->g_out_buffer_pool_lock[chanId]); + usleep(1000); + } + + if(mallocCount >= tryTimes) { + printf("[%s][%d] Chn %u DvppMalloc From Pool Failed, Try again \n", __FUNCTION__, __LINE__, chanId); + mallocCount = 0; + } + } + + stream.need_display = HI_TRUE; + outPicInfo.vir_addr = (uint64_t)outBuffer; + outPicInfo.buffer_size = outBufferSize; + } else { + stream.need_display = HI_FALSE; + outPicInfo.vir_addr = 0; + outPicInfo.buffer_size = 0; + } + + readCount = (readCount + 1) % frameCount; + if(readCount == 0) { + circleTimes++; + } + + thiz->get_current_time_us(currentSendTime); + if((currentSendTime - lastSendTime) < thiz->g_send_interval) { + usleep(thiz->g_send_interval - (currentSendTime - lastSendTime)); + } + thiz->get_current_time_us(lastSendTime); + + do { + sendFrameFailCnt++; + ret = hi_mpi_vdec_send_stream(chanId, &stream, &outPicInfo, timeOut); + if(sendFrameFailCnt > 30) { + thiz->vdec_reset_chn(chanId); + sendFrameFailCnt = 0; + break; + } + } while(ret == HI_ERR_VDEC_BUF_FULL); + + if(ret != HI_SUCCESS) { + printf("[%s][%d] Chn %u hi_mpi_vdec_send_stream failed, Error code = %x \n", __FUNCTION__, __LINE__, chanId, ret); + break; + } else { + sendFrameFailCnt = 0; + if((thiz->g_send_times != 0) && (circleTimes >= thiz->g_send_times)) { + break; + } + } + } + + stream.addr = NULL; + stream.len = 0; + stream.end_of_frame = HI_FALSE; + stream.end_of_stream = HI_TRUE; + outPicInfo.vir_addr = 0; + outPicInfo.buffer_size = 0; + hi_mpi_vdec_send_stream(chanId, &stream, &outPicInfo, -1); + + fclose(fpInputFile); + free(inputFileBuf); + if(thiz->g_run_mode == ACL_HOST) { + hi_mpi_dvpp_free(dataDev); + } + printf("[%s][%d] Chn %u send_stream Thread Exit \n", __FUNCTION__, __LINE__, chanId); + return (hi_void*)HI_SUCCESS; +} + +void* MbufVideoSender::get_pic(void* arg) +{ + MbufVideoSender *thiz = static_cast(arg); + prctl(PR_SET_NAME, "VdecGetPic", 0,0,0); + uint32_t chanId = 0; + aclError aclRet = aclrtSetCurrentContext(thiz->g_context); + if(aclRet != ACL_SUCCESS) { + printf("[%s][%d] Chn %u set current context failed, error code = %d, \n", __FUNCTION__, __LINE__, chanId, aclRet); + thiz->g_get_exit_state[chanId] = 1; + return (void*)(HI_FAILURE); + } + + int32_t ret = HI_SUCCESS; + hi_video_frame_info frame; + hi_vdec_stream stream; + int32_t decResult = 0; + void* outputBuffer = NULL; + int32_t successCnt = 0; + int32_t failCnt = 0; + int32_t timeOut = 1000; + int32_t writeFileCnt = 1; + hi_vdec_supplement_info stSupplement{}; + + while(1) { + if(thiz->g_get_exit_state[chanId] == 1) { + break; + } + + ret = hi_mpi_vdec_get_frame(chanId, &frame, &stSupplement, &stream, timeOut); + if(ret == HI_SUCCESS) { + thiz->get_current_time_us(thiz->g_vdec_end_time[chanId]); + outputBuffer = (void*) frame.v_frame.virt_addr[0]; + decResult = frame.v_frame.frame_flag; + if(decResult == 0) { + successCnt++; + printf("[%s][%d] Chn %u GetFrame success, Decode success[%d] \n", __FUNCTION__, __LINE__, chanId, successCnt); + } else if(decResult == 1) { + failCnt++; + printf("[%s][%d] Chn %u GetFrame success, Decode fail[%d] \n", __FUNCTION__, __LINE__, chanId, failCnt); + } else if(decResult == 2) { + printf("[%s][%d] Chn %u GetFrame success, No Picture \n", __FUNCTION__, __LINE__, chanId); + } else if(decResult == 3) { + failCnt++; + printf("[%s][%d] Chn %u GetFrame success, RefFrame Num Error[%d] \n", __FUNCTION__, __LINE__, chanId, failCnt); + } else if(decResult == 4) { + failCnt++; + printf("[%s][%d] Chn %u GetFrame success, RefFrame Size Error[%d] \n", __FUNCTION__, __LINE__, chanId, failCnt); + } + + thiz->g_vdec_get_frame_cnt[chanId] = successCnt + failCnt; + if((thiz->g_is_write_file == 1) && (decResult == 0) && + (outputBuffer != NULL) && (stream.need_display == HI_TRUE)) { + FILE* fp = NULL; + char saveFileName[256]; + ret = snprintf(saveFileName, sizeof(saveFileName) , "%s_chn%u_%d", thiz->g_output_file_name, chanId, writeFileCnt); + if (ret <= 0) { + printf("[%s][%d] Chn %u,snprintf_s fail \n",__FUNCTION__,__LINE__,chanId); + thiz->g_get_exit_state[chanId] = 1; + return (void*)(HI_FAILURE); + } + + if ((frame.v_frame.pixel_format == HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420) || + (frame.v_frame.pixel_format == HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420)) { + thiz->save_yuv_file(thiz->fp_yuv, frame.v_frame, chanId); + } else if ((frame.v_frame.pixel_format == HI_PIXEL_FORMAT_RGB_888) || + (frame.v_frame.pixel_format == HI_PIXEL_FORMAT_BGR_888)) { + thiz->save_rgb_file(fp, frame.v_frame, chanId); + } + writeFileCnt++; + } + if (outputBuffer != NULL) { + (void)pthread_mutex_lock(&thiz->g_out_buffer_pool_lock[chanId]); + thiz->g_out_buffer_pool[chanId].push_back(outputBuffer); + (void)pthread_mutex_unlock(&thiz->g_out_buffer_pool_lock[chanId]); + } + ret = hi_mpi_vdec_release_frame(chanId, &frame); + if (ret != HI_SUCCESS) { + printf("[%s][%d] Chn %u hi_mpi_vdec_release_frame Fail,Error Code = %x \n", + __FUNCTION__,__LINE__,chanId, ret); + } + } + else { + usleep(500); + } + } + printf("[%s][%d] Chn %u get_pic Thread exit \n", __FUNCTION__, __LINE__, chanId); + return (void*)HI_SUCCESS; +} + +void MbufVideoSender::get_every_frame(int32_t chanId, uint8_t* const inputFileBuf, uint32_t* const frameCount, + uint32_t fileSize, hi_payload_type type, uint8_t* dataDev) +{ + int32_t i=0; + int32_t usedBytes = 0; + int32_t readLen = 0; + uint32_t count = 0; + uint8_t* bufPointer = NULL; + bool isFindStart = false; + bool isFindEnd = false; + + while(1) { + isFindStart = false; + isFindEnd = false; + bufPointer = inputFileBuf + usedBytes; + readLen = fileSize - usedBytes; + if(readLen <= 0) { + break; + } + + if(type == HI_PT_H264) { + for(i=0; i0) { + readLen = i; + } + if(isFindStart == false) { + printf("Chn %d can not find h264 start code! readLen %d, usedBytes %d! \n", chanId, readLen, usedBytes); + } + if(isFindEnd == false) { + readLen = i + 8; + } + } else if(type == HI_PT_H265) { + bool isNewPic = false; + for(i=0; i> 1; + if((bufPointer[i+0] == 0) && (bufPointer[i+1] == 0) && (bufPointer[i+2]==1) && + (tmp >= 0 && tmp <= 21) && ((bufPointer[i+5] & 0x80) == 0x80)) { + isNewPic = true; + } + if(isNewPic == true) { + isFindStart = true; + i += 6; + break; + } + } + + for(; i < readLen - 6; i++) { + uint32_t tmp = (bufPointer[i+3]&0x7E) >> 1; + + isNewPic = ((bufPointer[i+0] == 0) && (bufPointer[i+1] ==0) && (bufPointer[i+2]==1) && + ((tmp == 32) || (tmp == 33) || (tmp == 34) || (tmp == 39) || (tmp == 40) || + ((tmp >= 0 && tmp <= 21) && (bufPointer[i+5] & 0x80) == 0x80))); + + if(isNewPic == true) { + isFindEnd = true; + break; + } + } + + if(i > 0) { + readLen = i; + } + if(isFindStart == false) { + printf("Chn %d can not find h265 start code! readLen %d, usedBytes %d! \n", chanId, readLen, usedBytes); + } + if(isFindEnd == false) { + readLen = i + 6; + } + } + + if(g_run_mode == ACL_HOST) { + g_frame_addr[chanId][count] = (bufPointer - inputFileBuf) + dataDev; + } else { + g_frame_addr[chanId][count] = bufPointer; + } + g_frame_len[chanId][count] = readLen; + count++; + usedBytes = usedBytes + readLen; + } + *frameCount = count; +} + +void MbufVideoSender::delay_exec(uint64_t execTime, int32_t seconds) +{ + struct timeval currentTime; + uint64_t tmpCurtime = 0; + uint64_t secondToUs = 1000000; + + gettimeofday(¤tTime, NULL); + tmpCurtime = currentTime.tv_sec * secondToUs + currentTime.tv_usec; + uint64_t nextExecTime = execTime + seconds * secondToUs; + + while(tmpCurtime < nextExecTime) { + usleep(500); + gettimeofday(¤tTime, NULL); + tmpCurtime = currentTime.tv_sec * secondToUs + currentTime.tv_usec; + } + return; +} + +void MbufVideoSender::show_decode_performance() +{ + double averFrameRate = 0; + uint32_t chnNum = 0; + uint64_t secondToUs = 1000000; + for(uint32_t i=g_start_chn_num; i 4096) || (g_in_width < 128)) { + printf("[%s][%d] input file width is invalid, width = %u \n", __FUNCTION__, __LINE__, g_in_width); + return HI_FAILURE; + } + if((g_in_height > 4096) || (g_in_height < 128)) { + printf("[%s][%d] input file height is invalid, height = %u \n", __FUNCTION__, __LINE__, g_in_height); + return HI_FAILURE; + } + if((g_in_format != 0) && (g_in_format != 1)) { + printf("[%s][%d] input format is invalid, format = %u \n", __FUNCTION__, __LINE__, g_in_format); + return HI_FAILURE; + } + if((g_in_bitwidth != 8) && (g_in_bitwidth != 10)) { + printf("[%s][%d] input bitwidth is invalid, bitwidth = %u \n", __FUNCTION__, __LINE__, g_in_bitwidth); + return HI_FAILURE; + } + if((g_out_width != 0) && ((g_out_width > 4096) || (g_out_width < 10))) { + printf("[%s][%d] output width is invalid, width = %u \n", __FUNCTION__, __LINE__, g_out_width); + return HI_FAILURE; + } + if((g_out_height != 0) && ((g_out_height > 4096) || (g_out_height < 6))) { + printf("[%s][%d] output height is invalid, height = %u \n", __FUNCTION__, __LINE__, g_out_height); + return HI_FAILURE; + } + if(g_out_format > 3) { + printf("[%s][%d] output format is invalid, format = %u \n", __FUNCTION__, __LINE__, g_out_format); + return HI_FAILURE; + } + + if((g_out_width_stride % 16 != 0) || (g_out_width_stride < g_out_width) || (g_out_width_stride < 32)) { + printf("[%s][%d] output width stride is invalid, width stride = %u \n", __FUNCTION__, __LINE__, g_out_width_stride); + return HI_FAILURE; + } + if(((g_out_format == 2) || (g_out_format == 3)) && (g_out_width_stride < g_out_width * 3)) { + printf("[%s][%d] output width stride is invalid, width stride = %u \n", __FUNCTION__, __LINE__, g_out_width_stride); + return HI_FAILURE; + } + if(((g_out_height_stride % 2 != 0) && ((g_out_format == 0) || (g_out_format == 1))) || + (g_out_height_stride < g_out_height)) { + printf("[%s][%d] output height stride is invalid, height stride = %u \n", __FUNCTION__, __LINE__, g_out_height_stride); + return HI_FAILURE; + } + if(g_is_write_file > 1) { + printf("[%s][%d] write file parameter is invalid, isWriteFile = %u \n", __FUNCTION__, __LINE__, g_is_write_file); + return HI_FAILURE; + } + if((g_chn_num > 96) || (g_chn_num < 1)) { + printf("[%s][%d] chan num is invalid, chan num = %u \n", __FUNCTION__, __LINE__, g_chn_num); + return HI_FAILURE; + } + if(g_ref_frame_num > 16) { + printf("[%s][%d] RefFrame num is invalid, RefFrame num = %u \n", __FUNCTION__, __LINE__, g_ref_frame_num); + return HI_FAILURE; + } + if(g_display_frame_num > 16) { + printf("[%s][%d] DisplayFrame num is invalid, DisplayFrame num = %u \n", __FUNCTION__, __LINE__, g_display_frame_num); + return HI_FAILURE; + } + if(g_output_order > 2) { + printf("[%s][%d] output order is invalid, output order = %u \n", __FUNCTION__, __LINE__, g_output_order); + return HI_FAILURE; + } + if(g_start_chn_num + g_chn_num >= VDEC_MAX_CHN_NUM) { + printf("[%s][%d] start chan num is invalid, start chan num = %u \n", __FUNCTION__, __LINE__, g_start_chn_num); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +void MbufVideoSender::print_parameter() +{ + printf("\n/****************************Vdec Parameter****************************/\n"); + printf("InputFileName: %s \n", g_input_file_name); + printf("OutputFileName: %s \n", g_output_file_name); + printf("Width: %u \n", g_in_width); + printf("Height: %u \n", g_in_height); + printf("InFormat: %u \n", g_in_format); + printf("Bitwidth: %u \n", g_in_bitwidth); + printf("OutWidth: %u \n", g_out_width); + printf("OutHeight: %u \n", g_out_height); + printf("OutFormat: %u \n", g_out_format); + printf("OutWidthStride: %u \n", g_out_width_stride); + printf("OutHeightStride: %u \n", g_out_height_stride); + printf("ChnNum: %u \n", g_chn_num); + printf("RefFrameNum: %u \n", g_ref_frame_num); + printf("DisplayFrameNum: %u \n", g_display_frame_num); + printf("OutPutOrder: %u \n", g_output_order); + printf("SendTimes: %u \n", g_send_times); + printf("SendInterval: %u \n", g_send_interval); + printf("DelayTime: %u \n", g_delay_time); + printf("AllocNum: %u \n", g_alloc_num); + printf("StartChnNum: %u \n", g_start_chn_num); + printf("Render: %u \n", g_render); + printf("/**********************************************************************/\n"); +} + +void MbufVideoSender::vdec_handle_signal(int32_t signo) +{ + for(int32_t i =g_start_chn_num; i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acl.h" +#include "acl_rt.h" +#include "hi_dvpp.h" +//#include "/usr/sdk/mdc_sdk/dp_gea/mdc_cross_compiler/sysroot/usr/include/driver/ascend_hal.h" +//#include "/usr/sdk/mdc_sdk/dp_gea/mdc_cross_compiler/sysroot/usr/include/driver/ascend_hal_define.h" + +#include "/usr/local/mdc_sdk/dp_gea/mdc_cross_compiler/sysroot/usr/include/driver/ascend_hal.h" +#include "/usr/local/mdc_sdk/dp_gea/mdc_cross_compiler/sysroot/usr/include/driver/ascend_hal_define.h" + +using namespace std; +using namespace cv; +const int32_t MAX_NAME_LENGTH = 500; +using MbufSkeleton = mdc::cam::camera::skeleton::CameraDecodedMbufServiceInterfaceSkeleton; +class MbufVideoSender : public ImageSenderBase { + typedef void* (*pFUNC)(void *); +private: + poolHandle handle; + float lastTime = 0.0F; + + char g_input_file_name[MAX_NAME_LENGTH] = "test264.h264"; + char g_output_file_name[MAX_NAME_LENGTH] = "./outfile"; + uint32_t g_in_width = 3840; // input stream width + uint32_t g_in_height = 2160; // input stream height + uint32_t g_in_format = 0; + uint32_t g_in_bitwidth = 8; + uint32_t g_out_width = 0; + uint32_t g_out_height = 0; + uint32_t g_out_format = 0; + uint32_t g_out_width_stride = 4096; + uint32_t g_out_height_stride = 4096; + uint32_t g_is_write_file = 1; + uint32_t g_chn_num = 1; + uint32_t g_ref_frame_num = 8; + uint32_t g_display_frame_num = 2; + uint32_t g_output_order = 0; + uint32_t g_send_times = 1; + uint32_t g_send_interval = 0; + uint32_t g_delay_time = 1; + uint32_t g_alloc_num = 20; + uint32_t g_start_chn_num = 0; + uint32_t g_render = 0; + uint32_t g_exit = 0; + + uint32_t g_chan_create_state[VDEC_MAX_CHN_NUM] = {0}; + uint64_t g_start_time = 0; + + std::vector g_out_buffer_pool[VDEC_MAX_CHN_NUM]; + pthread_mutex_t g_out_buffer_pool_lock[VDEC_MAX_CHN_NUM]; + + uint32_t g_send_exit_state[VDEC_MAX_CHN_NUM] = {0}; + uint32_t g_get_exit_state[VDEC_MAX_CHN_NUM] = {0}; + + pthread_t g_vdec_send_thread[VDEC_MAX_CHN_NUM] = {0}; + pthread_t g_vdec_get_thread[VDEC_MAX_CHN_NUM] = {0}; + uint32_t g_send_thread_id[VDEC_MAX_CHN_NUM] = {0}; + uint32_t g_get_thread_id[VDEC_MAX_CHN_NUM] = {0}; + + uint8_t* g_frame_addr[VDEC_MAX_CHN_NUM][9999]; + uint64_t g_frame_len[VDEC_MAX_CHN_NUM][9999]; + uint64_t g_vdec_start_time[VDEC_MAX_CHN_NUM] = {0}; + uint64_t g_vdec_end_time[VDEC_MAX_CHN_NUM] = {0}; + uint64_t g_vdec_get_frame_cnt[VDEC_MAX_CHN_NUM] = {0}; + + aclrtRunMode g_run_mode = ACL_HOST; + std::string sourceYuvPath; + FILE* fp_yuv; + chrono::high_resolution_clock::time_point sec; +public: + aclrtContext g_context = NULL; + +public: + MbufVideoSender() = default; + MbufVideoSender(uint32_t id, cv::Size s, std::string dir) : ImageSenderBase(id, s, dir) + { + g_in_width = s.width; + g_in_height = s.height; + g_out_width = s.width; + g_out_height = s.height; + if(comPara.fileType == "h264") { + g_in_format = 0; + } else if(comPara.fileType == "h265") { + g_in_format = 1; + } + + g_out_format = 0; + g_is_write_file = 1; + g_out_width_stride = s.width; + g_out_height_stride = s.height; + sourceYuvPath = dir; + if(dir.back() != '/') { + sourceYuvPath += string("/") + "videoSource.yuv"; + } else { + sourceYuvPath += "videoSource.yuv"; + } + fp_yuv = fopen(sourceYuvPath.c_str(), "wb+"); + sec = chrono::high_resolution_clock::now(); + } + ~MbufVideoSender() + { + if(dataSkeleton != nullptr) { + dataSkeleton->StopOfferService(); + dataSkeleton = nullptr; + } + if(handle != nullptr) { + halBuffDeletePool(handle); + } + }; + + bool RegisterSender() { + std::cout << "Begin register MBUF image sender." << endl; + auto result = ImageSenderBase::RegisterSender(); + std::cout << "Finished to register MBUF image sender." << endl; + return result; + } + + void VdecDecoded() { + std::string path = dir; + std::string postfix = comPara.fileType; + bool isLoop = comPara.loop; + cout << "dir : " << dir << "\t" <<" postfix : " << postfix << endl; + std::vector files; + int32_t fileCnt = getFilesBySort(path, files, comPara.fileType); + if(fileCnt == 0) { + cout <<"PATH:" << path << " has no files!" << endl; + return; + } + do { + for(auto& file : files) { + if(file.empty()) { + std::cerr << "File not exist, or corrupt.path: "<< file << std::endl; + return; + } + memset(g_input_file_name, 0, MAX_NAME_LENGTH); + strcpy(g_input_file_name, file.c_str()); + VdecInit(); + InitThreadPara(); + VdecProcess(); + VdecUninit(); + } + } while(isLoop); + fclose(fp_yuv); + } + + int32_t InitThreadPara() + { + g_send_exit_state[VDEC_MAX_CHN_NUM] = {0}; + g_get_exit_state[VDEC_MAX_CHN_NUM] = {0}; + g_vdec_send_thread[VDEC_MAX_CHN_NUM] = {0}; + g_vdec_get_thread[VDEC_MAX_CHN_NUM] = {0}; + g_send_thread_id[VDEC_MAX_CHN_NUM] = {0}; + g_get_thread_id[VDEC_MAX_CHN_NUM] = {0}; + } + int32_t VdecInit() + { + print_parameter(); + int32_t ret = HI_SUCCESS; + ret = hi_dvpp_init(); + if(ret != HI_SUCCESS) { + printf("[%s][%d] hi_dvpp_init failed !\n", __FUNCTION__, __LINE__); + return -1; + } + ret = vdec_create(); + if(ret != HI_SUCCESS) { + printf("[%s][%d] VdecStart failed \n", __FUNCTION__, __LINE__); + vdec_destroy(); + hi_dvpp_deinit(); + return -1; + } + init_outbuffer_lock(); + get_start_time(); + return ret; + } + void VdecUninit() { + wait_vdec_end(); + show_decode_performance(); + destroy_outbuffer_lock(); + vdec_destroy(); + hi_dvpp_deinit(); + } + void VdecProcess() { + int32_t ret = HI_SUCCESS; + ret = create_send_stream_thread(); + ret = create_send_stream_thread(); + if(ret != 0) { + stop_send_stream_thread(); + } else { + ret = create_get_pic_thread(); + if(ret != 0) { + stop_get_pic_thread(); + } + } + } + int32_t BufCreatePool(const uint32_t blkSize, const uint32_t blkNum) { + constexpr uint32_t alignSize = 32U; + mpAttr attr; + attr.devid = 0; + attr.mGroupId = 0; + attr.blkSize = ((blkSize + alignSize) - 1U) & (~(alignSize -1)); + attr.blkNum = blkNum; + attr.align = alignSize; + attr.hugePageFlag = 1U; + const int32_t ret = halBuffCreatePool(&attr, &handle); + if(ret != DRV_ERROR_NONE) { + std::cout << "halBuffCreatePool error: " << ret << std::endl; + return -1; + } + return 0; + } + int32_t CopyToMbuf(uintptr_t& mbuf, const uint8_t* src, const uint32_t len) const { + Mbuf* pMbuf = nullptr; + int32_t ret = halMbufAllocByPool(handle, &pMbuf); + if(ret != DRV_ERROR_NONE) { + std::cout << "halMbufAllocByPool error: " << ret << std::endl; + return -1; + } + if(pMbuf == nullptr) { + std::cout << "halMbufAllocByPool mbuf null" << std::endl; + return -1; + } + void * dst = nullptr; + uint64_t bufSize = 0U; + ret = halMbufGetDataPtr(pMbuf, &dst, &bufSize); + if(ret != 0 || dst == nullptr) { + std::cout << "MbufGetDataPtr error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + if(len > bufSize) { + std::cout << "Error: Src data length[" << len << "] > mbuf size[" << bufSize << "]" << std::endl; + halBuffFree(pMbuf); + return -1; + } + if(memcpy_s(reinterpret_cast(dst), static_cast(bufSize), src, static_cast(len)) != 0) { + std::cout << "Error: Copy src data to mbuf error!" << std::endl; + halBuffFree(pMbuf); + return -1; + } + ret = halMbufSetDataLen(pMbuf, len); + if(ret != DRV_ERROR_NONE) { + std::cout << "halMbufSetDataLen error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + mbuf = reinterpret_cast(pMbuf); + return 0; + } + void FillImageAndSend(std::string imgPath, uint32_t seq, void* g_stopFlag) override {} +public: + int32_t get_option(int32_t argc, char**argv); + int32_t check_option(); + void print_parameter(); + void vdec_handle_signal(int32_t signo); + int32_t vdec_create(); + void vdec_destroy(); + int32_t create_send_stream_thread(); + int32_t create_get_pic_thread(); + void stop_send_stream_thread(); + void stop_get_pic_thread(); + static void* send_stream(void* arg); + static void* get_pic(void* arg); + void get_every_frame(int32_t chanId, uint8_t* const inputFileBuf, uint32_t* const frameCount, uint32_t fileSize, + hi_payload_type type, uint8_t* devData); + void delay_exec(uint64_t execTime, int32_t seconds); + void wait_vdec_end(); + void show_decode_performance(); + void get_start_time(); + void init_outbuffer_lock(); + void destroy_outbuffer_lock(); + void release_outbuffer(uint32_t chanId); + int32_t hi_dvpp_init(); + void hi_dvpp_deinit(); +private: + int32_t InitGrp(void); + void get_current_time_us(uint64_t& timeUs); + void save_yuv_file(FILE* const fd, hi_video_frame frame, uint32_t chanId); + void FillYuvAndSend(uint8_t* ptr, int32_t w, int32_t h); + void save_rgb_file(FILE* const fd, hi_video_frame frame, uint32_t chanId); + void vdec_reset_chn(uint32_t chanId); +}; + +#endif //MODULES_CAMERA_SAMPLE_IMAGE_SENDER_MBUF_VIDEO_SENDER_H_ diff --git a/local_sensor_data_sender_mdc/mbuf_yuv_sender.h b/local_sensor_data_sender_mdc/mbuf_yuv_sender.h new file mode 100644 index 0000000000000000000000000000000000000000..88ecb2e3296b3876d3ddbc6c00698a92fc5a817d --- /dev/null +++ b/local_sensor_data_sender_mdc/mbuf_yuv_sender.h @@ -0,0 +1,191 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: mbuf_yuv_sender.h head file +*/ +#ifndef MODULES_CAMERA_SAMPLE_IMAGE_SENDER_MBUF_YUV_SENDER_H_ +#define MODULES_CAMERA_SAMPLE_IMAGE_SENDER_MBUF_YUV_SENDER_H_ + +#include "image_sender_base.h" +#include "mdc/cam/camera/cameradecodedmbufserviceinterface_skeleton.h" +#include "util.h" +#include "core/types.h" +#include "driver/ascend_hal.h" +#include "securec.h" + +using namespace std; +using namespace cv; + +using MbufSkeleton = mdc::cam::camera::skeleton::CameraDecodedMbufServiceInterfaceSkeleton; +class MbufYuvSender : public ImageSenderBase{ +private: + poolHandle handle; + float lastTime = 0.0F; + chrono::high_resolution_clock::time_point sec;//-t used + +public: + MbufYuvSender() = default; + MbufYuvSender(uint32_t id, cv::Size s, std::string dir) : ImageSenderBase(id, s, dir) + { + sec = chrono::high_resolution_clock::now(); + } + ~MbufYuvSender() + { + if (dataSkeleton != nullptr){ + dataSkeleton->StopOfferService(); + dataSkeleton = nullptr; + } + if(handle !=nullptr){ + halBuffDeletePool(handle); + } + }; + + bool RegisterSender() + { + std::cout << "Begin register MBUF image sender." << endl; + auto result = ImageSenderBase::RegisterSender(); + std::cout << "Finished to register MBUF image sender." << endl; + return result; + } + + int32_t BufCreatePool(const uint32_t blkSize, const uint32_t blkNum) + { + constexpr uint32_t alignSize = 32U; + mpAttr attr; + attr.devid=0; + attr.mGroupId = 0; + attr.blkSize = ((blkSize + alignSize) - 1U) & (~(alignSize - 1)); + attr.blkNum = blkNum; + attr.align = alignSize; + attr.hugePageFlag= 1U; + const int32_t ret = halBuffCreatePool(&attr, &handle); + if (ret != DRV_ERROR_NONE){ + std::cout << "halBuffCreatePool error: " << ret << std::endl; + return -1; + } + return 0; + } + + int32_t CopyToMbuf(uintptr_t& mbuf, const uint8_t* src, const uint32_t len) const + { + Mbuf* pMbuf = nullptr; + int32_t ret = halMbufAllocByPool(handle, &pMbuf); + if(ret != DRV_ERROR_NONE){ + std::cout << "halMbufAllocByPool error: " << ret << std::endl; + return -1; + } + if (pMbuf == nullptr){ + std::cout << "halMbufAllocByPool mbuf null" << std::endl; + return -1; + } + void* dst = nullptr; + uint64_t bufSize =0U; + ret = halMbufGetDataPtr(pMbuf, &dst, &bufSize); + if (ret != 0 || dst == nullptr){ + std::cout << "MbufGetDataPtr error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + + if (len > bufSize){ + std::cout << "ERROR: Src data length[" << len << "] > mbuf size[" << bufSize << "]" << std::endl; + halBuffFree(pMbuf); + return -1; + } + + if (memcpy_s( + reinterpret_cast(dst), static_cast(bufSize), src, static_cast(len)) != + 0){ + std::cout << "ERROR: Copy src date to mbuf error!" << std::endl; + halBuffFree(pMbuf); + return -1; + } + + ret = halMbufSetDataLen(pMbuf, len); + if(ret != DRV_ERROR_NONE){ + std::cout << "halMbufSetDataLen error: " << ret << std::endl; + halBuffFree(pMbuf); + return -1; + } + + mbuf = reinterpret_cast(pMbuf); + return 0; + } + + void FillImageAndSend(std::string yuvPath, uint32_t seq, void *g_stopFlag) override + { + (void)g_stopFlag; + std::string path = dir; + std::string postfix = comPara.fileType; + bool isLoop = comPara.loop; + cout<<"dir: "< files; + int32_t fileCnt = getFilesBySort(path, files, comPara.fileType); + if (fileCnt == 0){ + cout<<"PATH:"<cameraDecodedMbufEvent.Allocate(); + imagePub->CameraHeader.Seq = seq; + imagePub->FrameType = static_castFrameType)>(Adsfi::HAF_IMAGE_YUV420SP_NV12_UINT8); + imagePub->Width = w; + imagePub->Height = h; + imagePub->DataSize = frameSize; + imagePub->CameraHeader.FrameId = file; + uintptr_t imgdata{}; + (void)CopyToMbuf(imgdata, YUV420NV12.data, frameSize); + if (imgdata == reinterpret_cast(nullptr)){ + std::cout << "ERROR: CopyToMbuf failed!" << std::endl; + return; + } + imagePub->RawData = reinterpret_cast(imgdata); + if (comPara.time.empty()) { + timeval now; + gettimeofday(&now, NULL); + imagePub->CameraHeader.Stamp.Sec = now.tv_sec; + imagePub->CameraHeader.Stamp.Nsec = now.tv_usec * 1000U; + } else { + time_t timeStamp = convertTimeStr2TimeStamp(comPara.time); + auto t1= chrono::high_resolution_clock::now(); + int64_t duration = (t1 - sec).count()/1000000000.0; + imagePub->CameraHeader.Stamp.Sec = timeStamp + duration; + printf("timeStamp=%ld\n", timeStamp + duration); + } + dataSkeleton->cameraDecodedMbufEvent.Send(move(imagePub)); + cout << "Begin send image. seq: " << seq << ", frameID: " << frameID << "path: " << file << endl; + seq++; + if(comPara.frequency !="") { + int32_t freq = atoi(comPara.frequency.c_str()); + int32_t sleepTime = 1000000 / freq; + usleep(sleepTime); + }else{ + usleep(1000000 / 30);//30hz + } + } + free(yuvBuff); + } + }while(isLoop); + } +}; +#endif diff --git a/local_sensor_data_sender_mdc/pcd_sender.h b/local_sensor_data_sender_mdc/pcd_sender.h new file mode 100644 index 0000000000000000000000000000000000000000..6d1ace2925753fd16ac1c49c9f308bdd207989a1 --- /dev/null +++ b/local_sensor_data_sender_mdc/pcd_sender.h @@ -0,0 +1,185 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: pcd_sender head file +*/ +#ifndef MODULES_CAMERA_SAMPLE_IMAGE_SENDER_PCD_SENDER_H_ +#define MODULES_CAMERA_SAMPLE_IMAGE_SENDER_PCD_SENDER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "yaml/haf_yaml.h" +#include "image_sender_base.h" +#include "ara/lidar/impl_type_lidarpointcloud.h" +#include "ara/lidar/impl_type_lidarpointfield.h" +#include "ara/lidar/lidarserviceinterface_common.h" +#include "ara/lidar/lidarserviceinterface_skeleton.h" + +using namespace std; +const int16_t X_IN_POINTCLOUD = 0; +const int16_t Y_IN_POINTCLOUD = 4; +const int16_t Z_IN_POINTCLOUD = 8; +const int16_t INTENSITY_IN_POINTCLOUD = 28; +const int16_t X_IN_POINTCLOUD_SIMPLE = 0; +const int16_t Y_IN_POINTCLOUD_SIMPLE = 2; +const int16_t Z_IN_POINTCLOUD_SIMPLE = 4; +const int16_t INTENSITY_IN_POINTCLOUD_SIMPLE = 10; + +namespace ara { + namespace lidar { + constexpr ara::com::ServiceIdentifierType LidarServiceInterface::ServiceIdentifier; + constexpr ara::com::ServiceVersionType LidarServiceInterface::ServiceVersion; + } // namespace lidar +} // namespace ara + +using Skeleton_pcd = ara::lidar::skeleton::LidarServiceInterfaceSkeleton; + +class PcdSender : public ImageSenderBase { +private: + chrono::high_resolution_clock::time_point sec;//-t used +public: + PcdSender() = default; + PcdSender(uint32_t id, cv::Size s, std::string dir) : ImageSenderBase(id, s, dir) + { + sec = chrono::high_resolution_clock::now(); + } + ~PcdSender() = default; + bool RegisterSender() + { + std::cout << "Begin register normal image sender." << std::endl; + auto result = ImageSenderBase::RegisterSender(); + std::cout << "Finished to register normal image sender." << std::endl; + return result; + } + + void FillImageAndSend(std::string imgPath, uint32_t seq, void *flag) override + { + std::string path = dir; + std::string postfix = comPara.fileType; + bool isLoop = comPara.loop; + cout << "dir : " < pcd_names; + if (path.back() != '/') + { + path = path + string("/"); + } + GetFilesFromDirectory(path, pcd_names); + std::cout <<"There are"<::Ptr lidarData(new pcl::PointCloud); + if (pcl::io::loadPCDFile(pcd_source_path, *lidarData) == -1){ + std::cout << "load pcd failed" << std::endl; + continue; + } + std::cout<<"Load local pcd successful, pointcloud size is: "<< lidarData->width<<", "<< + lidarData->height << std::endl; + + std::stringstream str; + str<<"copy-" << pcd_name; + pcl::PCDWriter writer; + int32_t res = writer.writeBinaryCompressed(str.str(), *lidarData); + std::cout<<"-----------------writer.writeBinaryCompressed result "<< "res" <height; + tmp.width = lidarData->width; + std::vector pointCloudData; + pointCloudData.resize(tmp.pointStep * tmp.height * tmp.width); + uint8_t *pointCloud0 = &pointCloudData[0]; + uint8_t *pointCloudCurr = nullptr; + for (int pointCount = 0;pointCount < (static_cast(tmp.height) * static_cast(tmp.width)); + pointCount++){ + pointCloudCurr = pointCloud0 + tmp.pointStep * pointCount; + if(comPara.transMode == "simple"){ + *(reinterpret_cast(pointCloudCurr + X_IN_POINTCLOUD_SIMPLE)) = lidarData->points[pointCount].x; + *(reinterpret_cast(pointCloudCurr + Y_IN_POINTCLOUD_SIMPLE)) = lidarData->points[pointCount].y; + *(reinterpret_cast(pointCloudCurr + Z_IN_POINTCLOUD_SIMPLE)) = lidarData->points[pointCount].z; + *(reinterpret_cast(pointCloudCurr + INTENSITY_IN_POINTCLOUD_SIMPLE)) = + lidarData->points[pointCount].intensity; + } else { + *(reinterpret_cast(pointCloudCurr + X_IN_POINTCLOUD)) = lidarData->points[pointCount].x; + *(reinterpret_cast(pointCloudCurr + Y_IN_POINTCLOUD)) = lidarData->points[pointCount].y; + *(reinterpret_cast(pointCloudCurr + Z_IN_POINTCLOUD)) = lidarData->points[pointCount].z; + *(reinterpret_cast(pointCloudCurr + INTENSITY_IN_POINTCLOUD)) = + lidarData->points[pointCount].intensity; + } + } + tmp.data.assign(pointCloudData.begin(),pointCloudData.end()); + if(comPara.time.empty()){ + timeval tv; + gettimeofday(&tv, 0); + tmp.header.stamp.sec = tv.tv_sec; + tmp.header.stamp.nsec = 1e3; + } else { + time_t timeStamp = convertTimeStr2TimeStamp(comPara.time); + auto t1 = chrono::high_resolution_clock::now(); + int64_t duration = (t1 - sec).count() / 1000000000.0; + tmp.header.stamp.sec = timeStamp + duration; + printf("timeStamp=%ld\n", timeStamp + duration); + } + tmp.header.seq = i; + std::cout<<"tmp.header.stamp.sec: "<< tmp.header.stamp.sec << std::endl; + std::cout<<"tmp.header.stamp.nsec: "<< tmp.header.stamp.nsec << std::endl; + std::cout<<"tmp.header.frameId: "<< tmp.header.frameId << std::endl; + dataSkeleton->mdcEvent.Send(std::move(tmp)); + //100ms sleep 10hz + //usleep(interval * 1000); + if(comPara.frequency != ""){ + int32_t freq = atoi(comPara.frequency.c_str()); + int32_t sleepTime = 1000000/freq; + usleep(sleepTime); + }else{ + usleep(1000000/30);//30hz + } + } + }while(isLoop); + } +private: + void GetFilesFromDirectory(const std::string &name, std::vector &v) + { + DIR *dirp = opendir(name.c_str()); + if(dirp == nullptr){ + return; + } + struct dirent *dp; + while((dp = readdir(dirp)) != nullptr){ + if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0){ + continue; + } + if(EndsWith(dp->d_name, ".pcd")){ + v.push_back(dp->d_name); + } + } + closedir(dirp); + } + + bool EndsWith(const std::string &str, const std::string &suffix) + { + return str.size() >= suffix.size() && str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; + } +}; + + +#endif /* MODULE_CAMERA_SAMPLE_IMAGE_SENDER_PCD_SENDER_H */ diff --git a/local_sensor_data_sender_mdc/start.sh b/local_sensor_data_sender_mdc/start.sh new file mode 100644 index 0000000000000000000000000000000000000000..dda74732a56b26531215ab999485eb7e93205cb1 --- /dev/null +++ b/local_sensor_data_sender_mdc/start.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +cd $(dirname "$0") +export LD_LIBRARY_PATH=/opt/platform/mdc_platform/lib:./lib:/opt/usr/ads/lib:$LD_LIBRARY_PATH +cp -f /opt/usr/ads/resource/image/test.jpg /opt/usr/ads/adsfi_dt/common/image_sender/image/ +dos2unix image_config.yaml +export CM_CONFIG_FILE_PATH=/opt/platform/mdc_platform/manual_service/camera_a_cm/etc/CameraProcess +export RT_DDS_URI=${CM_CONFIG_FILE_PATH}/dds.xml + +chmod +x bin/* +./bin/image_sender + diff --git a/local_sensor_data_sender_mdc/util.cpp b/local_sensor_data_sender_mdc/util.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83e862f322c18dd005534fb376ceefa84a870ca6 --- /dev/null +++ b/local_sensor_data_sender_mdc/util.cpp @@ -0,0 +1,156 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: util source file +*/ + +#include "util.h" +#include +#include +#include +using namespace std; + +void yuv420p2nv12(const cv::Mat& yuv420p, cv::Mat& yuv420_nv12, int width, int height) +{ + auto resolution = width * height; + for (int i =0; i < resolution / 2;i +=2){ + yuv420_nv12.data[resolution + i] = yuv420p.data[resolution + (i / 2)]; + yuv420_nv12.data[resolution + i + 1] = yuv420p.data[resolution + resolution / 4 + (i /2)]; + } +} + +int32_t getFiles(std::string& path, std::vector& files, std::string suffix) +{ + std::string suffixName = "."+suffix; + DIR *dirp; + struct dirent *dp; + int32_t fileCnt = 0; + dirp = opendir(path.c_str()); + if (dirp == NULL){ + printf("opendir %s failed\n",path.c_str()); + return 0; + } + + while ((dp = readdir(dirp))!=NULL){ + std::string curpath(path); + if (path.back() !='/'){ + curpath += string("/") += dp->d_name; + } else { + curpath += dp->d_name; + } + if(dp->d_type == DT_REG){ + if(std::string(strrchr(dp->d_name,'.')) == suffixName) { + files.push_back(curpath); + fileCnt++; + } + } + } + closedir(dirp); + return fileCnt; +} + +int32_t getFilesBySort(std::string& path, std::vector& files, std::string suffix) +{ + std::string suffixName = "." + suffix; + int32_t fileCnt = 0; + struct dirent **name_list; + int32_t count = scandir(path.c_str(), &name_list, NULL, alphasort); + if(count < 0) + { + printf("opendir %s failed\n",path.c_str()); + return 0; + } + for(int32_t i = 0;i < count; i++){ + struct dirent *name; + name = name_list[i]; + std::string curpath(path); + if (path.back()!='/'){ + curpath += string("/") += name->d_name; + }else{ + curpath += name->d_name; + } + + if(std::string(strrchr(name->d_name,'.')) == suffixName){ + files.push_back(curpath); + fileCnt++; + } + free(name); + } + free(name_list); + return fileCnt; +} + +time_t convertTimeStr2TimeStamp(string timeStr) +{ + struct tm timeinfo; + strptime(timeStr.c_str(), "%Y-%m-%d %H:%M:%S", &timeinfo); + time_t timeStamp = mktime(&timeinfo); + //printf("timeStamp=%1d\n", timeStamp); + return timeStamp; +} + +FuncTimeMeasure::FuncTimeMeasure(std::string&& descrip) : description(std::move(descrip)) +{ + start = std::chrono::steady_clock::now(); +} + +FuncTimeMeasure::~FuncTimeMeasure() +{ + end = std::chrono::steady_clock::now(); + auto duration = std::chrono::duration_cast(end - start).count(); + std::cout << "Time costed for [" << description << "] is " << duration << "ms" << std::endl; +} + +std::string CurrentTimeAndDate() +{ + auto now = std::chrono::system_clock::now(); + auto in_time_t = std::chrono::system_clock::to_time_t(now); + + std::stringstream ss; + ss << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d %X"); + return ss.str(); +} + +void ConfigMangage::Parse() +{ + cout << "begin to parse config file: "<< file << endl; + auto root = Adsfi::HafYamlNode(file).GetNode(); + for(auto it = root.begin(); it != root.end(); ++it){ + Config conf; + conf.dir = (*it)["dir"].as(); + conf.instanceId = (*it)["instanceId"].as(); + conf.width = (*it)["width"].as(); + conf.height = (*it)["height"].as(); + configs.push_back(conf); + } + cout << "Parse config file finished." << endl; +} + +std::vector ConfigMangage::GetConfig() +{ + return configs; +} + +void ConfigMangage::Show() +{ + cout << endl << endl; + cout << "Image sender Configs:" << endl; + cout << "dir\tinstanceId\twidth\theight" << endl; + for (auto& conf : configs){ + cout << conf.dir << "\t" < count; + for(auto& conf : configs){ + count[conf.instanceId]++; + if (count[conf.instanceId] > 1){ + cerr << "ERROR: Multiple instance id found: "<< conf.instanceId < +#include +#include +#include +#include +#include + +#include // chrono::system_clock +#include // localtime +#include // stringstream +#include // put_time +#include // string + +std::string CurrentTimeAndDate(); + +void yuv420p2nv12(const cv::Mat& yuv420p, cv::Mat& yuv420_nv12, int width, int height); +int32_t getFiles(std::string& path, std::vector& files, std::string suffix); +int32_t getFilesBySort(std::string& path, std::vector& files, std::string suffix); +time_t convertTimeStr2TimeStamp(std::string timeStr); + +class FuncTimeMeasure { +public: +FuncTimeMeasure(std::string&& descrip); +~FuncTimeMeasure(); + +private: + std::string description; + std::chrono::time_point start{}; + std::chrono::time_point end{}; +}; + +struct Config { + std::string dir{""}; + int32_t instanceId{0}; + int32_t width{0}; + int32_t height{0}; +}; + +class ConfigMangage { +public: + ConfigMangage() = default; + ~ConfigMangage() =default; + ConfigMangage(std::string configFile) : file(configFile) + {} + void Parse(); + std::vector GetConfig(); + void Show(); + bool CheckConfig(); + +private: + std::string file{"image_config.yaml"}; + std::vector configs; +}; diff --git a/local_sensor_data_sender_mdc/yaml/haf_yaml.h b/local_sensor_data_sender_mdc/yaml/haf_yaml.h new file mode 100644 index 0000000000000000000000000000000000000000..65be7243f60be0413c33850a1f1f0b35978203b6 --- /dev/null +++ b/local_sensor_data_sender_mdc/yaml/haf_yaml.h @@ -0,0 +1,109 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. +* Description: yaml处理类 +*/ + +#ifndef ADSF_INTERFACES_YAML_HAFYAML_H +#define ADSF_INTERFACES_YAML_HAFYAML_H + +#include +#include +#include +#include "yaml-cpp/yaml.h" + +namespace Adsfi { + using HafYamlIterator = YAML::const_iterator; + using HafException = YAML::Exception; + + class HafYamlNode { + public: + HafYamlNode(const std::string path) + { + std::ifstream fin(path); + if (!fin) { + std::clog <<"Error: File corrupted or not exist.:" << path << std::endl; + } else { + fin.close(); + } + node = YAML::LoadFile(path); + } + + HafYamlNode() {} + + HafYamlNode(const YAML::Node child) + { + this->node = child; + } + ~HafYamlNode() {}; + + // indexing + template const HafYamlNode operator[](const Key &keyName) const + { + return HafYamlNode(node[keyName]); + } + + template HafYamlNode operator[](const Key &keyName) + { + return HafYamlNode(node[keyName]); + } + + // access + template T as() const + { + return node.as(); + } + + template bool GetValue(const std::string &keyName, T &value) const + { + if (node[keyName]) { + value = node[keyName].as(); + return true; + } + return false; + } + + HafYamlIterator begin() const + { + return node.begin(); + } + + HafYamlIterator end() const + { + return node.end(); + } + + bool IsSequence() const + { + return node.IsSequence(); + } + + bool IsDefined() const + { + return node.IsDefined(); + } + + size_t NodeSize() const + { + return node.size(); + } + + template void SetModeValue(const Key &keyName, const Value &value) + { + node[keyName] = value; + return; + } + + YAML::Node GetNode() const + { + return node; + } + + const YAML::Node HasKeyValue(const std::string &keyName) const + { + return node[keyName]; + } + private: + YAML::Node node; + }; +} +#endif diff --git a/rosbag2ImageAndPcd.py b/rosbag2ImageAndPcd.py new file mode 100644 index 0000000000000000000000000000000000000000..75f9e28321dd291db8c656981bf791fac55fc550 --- /dev/null +++ b/rosbag2ImageAndPcd.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*-# +# ------------------------------------------------------------------------------- +# Name: parse_bag +# Author: yunhgu +# Date: 2022/1/10 11:01 +# Description: +# ------------------------------------------------------------------------------- +import copy +import struct +from pathlib import Path +from traceback import format_exc + +import cv2 +import numpy as np +import rosbag +import sensor_msgs.point_cloud2 as pc2 +from cv_bridge import CvBridge + +PCD_ASCII_TEMPLATE = """VERSION 0.7 +FIELDS x y z intensity +SIZE 4 4 4 2 +TYPE F F F U +COUNT 1 1 1 1 +WIDTH {} +HEIGHT 1 +VIEWPOINT 0 0 0 1 0 0 0 +POINTS {} +DATA ascii +""" + +PCD_BINARY_TEMPLATE = """VERSION 0.7 +FIELDS x y z intensity +SIZE 4 4 4 4 +TYPE F F F F +COUNT 1 1 1 1 +WIDTH {} +HEIGHT 1 +VIEWPOINT 0 0 0 1 0 0 0 +POINTS {} +DATA binary +""" + + +class BagExtractor: + def __init__(self, bag_folder, dst_folder): + self.bag_folder = Path(bag_folder) + self.dst_folder = Path(dst_folder) + self.bridge = CvBridge() + + def extract_pcd_img(self, pcd_topic_list: list, img_topic_list: list): + """ + :param pcd_topic_list: 点云文件topic名字列表 + :param img_topic_list: 图片文件topic名字列表 + :return: + """ + for bag_file in self.bag_folder.rglob("*.bag"): + output_file = self.dst_folder.joinpath(bag_file.relative_to(self.bag_folder)) + output_folder = output_file.parent.joinpath(f"{output_file.stem}") + output_folder.mkdir(parents=True, exist_ok=True) + with rosbag.Bag(bag_file, 'r') as bag: + info = bag.get_type_and_topic_info() + print(info.topics) + print('*************************************************') + print(info.msg_types) + pcd_number = self.get_pcd_img_number(info, pcd_topic_list) + img_number = self.get_pcd_img_number(info, img_topic_list) + print(f"解析{bag_file.name} pcd总数:{pcd_number} 图片总数:{img_number}") + for topic, msg, t in bag.read_messages(): + #time_str = "%.9f" % msg.header.stamp.to_sec() + if topic in pcd_topic_list: # 点云的topic + time_str = "%.9f" % msg.header.stamp.to_sec() + pcd_path = output_folder.joinpath(f"{time_str}.pcd") + # self.to_pcd_ascii(pcd_path, msg) + self.to_pcd_binary(pcd_path, msg) + print(f"Extract pcd file {time_str}.pcd") + if topic in img_topic_list: # 图片的topic + #print(topic) + #if topic.find("sensor_msgs/Image") > -1: + time_str = "%.9f" % msg.header.stamp.to_sec() + img_path = output_folder.joinpath(f"{time_str}.jpg") + self.to_img(img_path, msg) + print(f"Extract img file {time_str}.jpg") + + @classmethod + def get_pcd_img_number(cls, info, topic_list): + try: + for topic in topic_list: + topic_ob = info.topics.get(topic, None) + if topic_ob: + return topic_ob.message_count + return 0 + except Exception as e: + print(f"获取pcd|img帧数出错:{e}") + return 0 + + @classmethod + def to_pcd_ascii(cls, pcd_path, msg): + with open(pcd_path, 'w') as f: + points_data = np.array(list(pc2.read_points(msg))) + lidar = list(np.delete(points_data, np.where(np.isnan(points_data))[0], axis=0)) + header = copy.deepcopy(PCD_ASCII_TEMPLATE).format(len(lidar), len(lidar)) + f.write(header) + for pi in lidar: + f.write(' '.join([str(i) for i in pi]) + '\n') + + @classmethod + def to_pcd_binary(cls, pcd_path, msg): + with open(pcd_path, 'wb') as f: + points_data = np.array(list(pc2.read_points(msg))) + lidar = list(np.delete(points_data, np.where(np.isnan(points_data))[0], axis=0)) + header = copy.deepcopy(PCD_BINARY_TEMPLATE).format(len(lidar), len(lidar)) + f.write(header.encode()) + for pi in lidar: + h = struct.pack('ffff', pi[0], pi[1], pi[2], pi[3]) + f.write(h) + + def to_img(self, img_path, msg): + try: + # cv_image = self.bridge.compressed_imgmsg_to_cv2(msg) + cv_image = self.bridge.imgmsg_to_cv2(msg) + cv2.imencode('.jpg', cv_image)[1].tofile(str(img_path)) + except Exception as e: + print(f"生成图片失败:{e}") + + +if __name__ == '__main__': + try: + bag_path = r'/home/ts/cm/rosbag/rosbag' # bag文件路径 + dst_path = r'/home/ts/cm/rosbag/result' # 结果路径 + extractor = BagExtractor(bag_path, dst_path) + extractor.extract_pcd_img(pcd_topic_list=['/kitti/velo/pointcloud'], + img_topic_list=['/kitti/camera_color_left/image_raw', '/kitti/camera_color_right/image_raw', '/kitti/camera_gray_left/image_raw', '/kitti/camera_gray_right/image_raw']) + except Exception as ee: + print(f"运行失败,无法解决请连续开发人员!{format_exc()}{ee}") +