diff --git a/Udral/actuator.cpp b/Udral/actuator.cpp index 2ca8a14..4b5e4a4 100644 --- a/Udral/actuator.cpp +++ b/Udral/actuator.cpp @@ -13,7 +13,7 @@ SetpointSubscriber::SetpointSubscriber(Cyphal* driver_) : int8_t SetpointSubscriber::init() { port_id = paramsGetIntegerValue(IntParamsIndexes::SETPOINT_ID); if (driver->subscribe(this, - reg_udral_service_actuator_common_sp_Vector4_0_1_EXTENT_BYTES_, + reg_udral_service_actuator_common_sp_Vector31_0_1_EXTENT_BYTES_, CanardTransferKindMessage) < 0) { return -1; } @@ -24,11 +24,12 @@ int8_t SetpointSubscriber::init() { void SetpointSubscriber::callback(const CanardRxTransfer& transfer) { const uint8_t* payload = static_cast(transfer.payload); size_t payload_len = transfer.payload_size; - reg_udral_service_actuator_common_sp_Vector4_0_1_deserialize_(&msg, payload, &payload_len); + reg_udral_service_actuator_common_sp_Vector31_0_1_deserialize_(&msg, payload, &payload_len); + _setpoint_size = payload_len / 2; _recv_counter++; } -const reg_udral_service_actuator_common_sp_Vector4_0_1& SetpointSubscriber::get_setpoint() const { +const reg_udral_service_actuator_common_sp_Vector31_0_1& SetpointSubscriber::get_setpoint() const { return msg; } diff --git a/Udral/actuator.hpp b/Udral/actuator.hpp index 13d739f..6db213e 100644 --- a/Udral/actuator.hpp +++ b/Udral/actuator.hpp @@ -7,7 +7,7 @@ #include "cyphal.hpp" #include "reg/udral/service/actuator/common/sp/Scalar_0_1.h" -#include "reg/udral/service/actuator/common/sp/Vector4_0_1.h" +#include "reg/udral/service/actuator/common/sp/Vector31_0_1.h" #include "reg/udral/service/common/Readiness_0_1.h" @@ -15,12 +15,14 @@ struct SetpointSubscriber: public CyphalSubscriber { SetpointSubscriber(Cyphal* driver); int8_t init(); void callback(const CanardRxTransfer& transfer) override; - const reg_udral_service_actuator_common_sp_Vector4_0_1& get_setpoint() const; + const reg_udral_service_actuator_common_sp_Vector31_0_1& get_setpoint() const; + uint8_t get_setpoint_size() const {return _setpoint_size;}; uint32_t get_recv_counter() const; void clear_recv_counter(); private: - reg_udral_service_actuator_common_sp_Vector4_0_1 msg = {}; + reg_udral_service_actuator_common_sp_Vector31_0_1 msg = {}; uint32_t _recv_counter{0}; + uint8_t _setpoint_size{0}; };