From 8d1ad9cc6aedaa02d40d7f76f934c875af6f7ae3 Mon Sep 17 00:00:00 2001 From: PonomarevDA Date: Mon, 27 Nov 2023 23:45:17 +0300 Subject: [PATCH] update cyphal_application submodule --- CMakeLists.txt | 12 +++++ Libs/cyphal_application | 2 +- scripts/Dockerfile | 1 + src/autopilot_interface/cyphal_hitl.cpp | 4 +- src/autopilot_interface/cyphal_hitl.hpp | 58 ++++++++++++------------- 5 files changed, 45 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f881006..6fc90b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ else() ) endif() +# set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Werror -std=c++17") set(CYPHAL_REPO_DIR ${CMAKE_CURRENT_LIST_DIR}/Libs/cyphal_application) set(PLATFORM socketcan) @@ -61,6 +62,17 @@ if(NOT DEFINED ARDUPILOT_JSON_SIM_INTERFACE) ) endif() +execute_process( + COMMAND git rev-parse --short=16 HEAD + COMMAND_ERROR_IS_FATAL ANY + OUTPUT_VARIABLE GIT_HASH_64_BIT + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if("GIT_HASH_64_BIT" STREQUAL "") + set(GIT_HASH_64_BIT "BADC0FFEEFFF") +endif() +set(GIT_HASH "0x${GIT_HASH_64_BIT}") +add_definitions(-DGIT_HASH=${GIT_HASH}) # Generate DSDL when build add_custom_target( diff --git a/Libs/cyphal_application b/Libs/cyphal_application index e8633b8..9fb5bb0 160000 --- a/Libs/cyphal_application +++ b/Libs/cyphal_application @@ -1 +1 @@ -Subproject commit e8633b8eb7410512b41b617cffbda11a458fdf30 +Subproject commit 9fb5bb0bcbf6b841a4d45921753ef0d8bc066f54 diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 29727f0..3f78618 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -23,6 +23,7 @@ COPY package.xml package.xml COPY src/ src/ COPY compile_dsdl.sh compile_dsdl.sh COPY Libs/ Libs/ +COPY .git/ .git/ # 4. Build ROS RUN ./Libs/cyphal_application/scripts/nnvg_generate_c_headers.sh diff --git a/src/autopilot_interface/cyphal_hitl.cpp b/src/autopilot_interface/cyphal_hitl.cpp index 2e0af95..f79da88 100644 --- a/src/autopilot_interface/cyphal_hitl.cpp +++ b/src/autopilot_interface/cyphal_hitl.cpp @@ -102,10 +102,10 @@ void CyphalHitlInterface::publish_esc_feedback(uint8_t esc_idx, float voltage, f return; } - ZubaxCompactFeedback feedback; + cyphal::ZubaxCompactFeedback feedback; feedback.dc_voltage = std::round(voltage * 5.0f); feedback.dc_current = std::round(current * 5.0f); - feedback.velocity = rpm * ZubaxCompactFeedbackPublisher::RPM_TO_RAD_PER_SEC; + feedback.velocity = rpm * cyphal::ZubaxCompactFeedbackPublisher::RPM_TO_RAD_PER_SEC; esc_feedback[esc_idx]->publish(feedback); } diff --git a/src/autopilot_interface/cyphal_hitl.hpp b/src/autopilot_interface/cyphal_hitl.hpp index 305aa41..23a4f0a 100644 --- a/src/autopilot_interface/cyphal_hitl.hpp +++ b/src/autopilot_interface/cyphal_hitl.hpp @@ -67,35 +67,35 @@ class CyphalHitlInterface { private: void _update_port_identifiers(); - Cyphal cyphal; - - SetpointSubscriber setpoint; - ReadinessSubscriber readiness; - HighColorSubscriber rgbled; - ZubaxCompactFeedbackPublisher esc_feedback_0; - ZubaxCompactFeedbackPublisher esc_feedback_1; - ZubaxCompactFeedbackPublisher esc_feedback_2; - ZubaxCompactFeedbackPublisher esc_feedback_3; - std::array esc_feedback; - - GpsPointPublisher gps_point; - Int16Publisher gps_sats; - Int16Publisher gps_status; - Int16Publisher gps_pdop; - - BaroPressurePublisher baro_pressure; - BaroTemperaturePublisher baro_temperature; - - MagneticFieldPublisher magnetometer; - - ImuAccelPublisher accel; - ImuGyroPublisher gyro; - RawImuPublisher imu; - - DiffPressurePublisher diff_pressure_0; - DiffPressurePublisher diff_pressure_1; - RangefinderRangePublisher rangefinder; - UdralBatteryPublisher battery; + cyphal::Cyphal cyphal; + + cyphal::SetpointSubscriber setpoint; + cyphal::ReadinessSubscriber readiness; + cyphal::HighColorSubscriber rgbled; + cyphal::ZubaxCompactFeedbackPublisher esc_feedback_0; + cyphal::ZubaxCompactFeedbackPublisher esc_feedback_1; + cyphal::ZubaxCompactFeedbackPublisher esc_feedback_2; + cyphal::ZubaxCompactFeedbackPublisher esc_feedback_3; + std::array esc_feedback; + + cyphal::GpsPointPublisher gps_point; + cyphal::Int16Publisher gps_sats; + cyphal::Int16Publisher gps_status; + cyphal::Int16Publisher gps_pdop; + + cyphal::BaroPressurePublisher baro_pressure; + cyphal::BaroTemperaturePublisher baro_temperature; + + cyphal::MagneticFieldPublisher magnetometer; + + cyphal::ImuAccelPublisher accel; + cyphal::ImuGyroPublisher gyro; + cyphal::RawImuPublisher imu; + + cyphal::DiffPressurePublisher diff_pressure_0; + cyphal::DiffPressurePublisher diff_pressure_1; + cyphal::RangefinderRangePublisher rangefinder; + cyphal::UdralBatteryPublisher battery; double _time_factor{1.0}; };