From b9f41e8ce52f84443766678ce0d53f966247fcba Mon Sep 17 00:00:00 2001 From: MarioIvancik Date: Fri, 30 Aug 2024 12:43:57 +0200 Subject: [PATCH 1/2] first command route name Undefined --- CMakeLists.txt | 2 +- .../modules/mission_module/devices/AutonomyDevice.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 106b4fe..19e3f11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ INCLUDE(CheckPIESupported) CHECK_PIE_SUPPORTED() SET(CMAKE_POSITION_INDEPENDENT_CODE ON) -SET(MISSION_MODULE_VERSION 1.2.8) +SET(MISSION_MODULE_VERSION 1.2.9) OPTION(BRINGAUTO_INSTALL "Configure install" OFF) OPTION(BRINGAUTO_PACKAGE "Configure package creation" OFF) diff --git a/source/bringauto/modules/mission_module/devices/AutonomyDevice.cpp b/source/bringauto/modules/mission_module/devices/AutonomyDevice.cpp index d86443d..3f1aeac 100644 --- a/source/bringauto/modules/mission_module/devices/AutonomyDevice.cpp +++ b/source/bringauto/modules/mission_module/devices/AutonomyDevice.cpp @@ -77,7 +77,10 @@ int AutonomyDevice::aggregate_error(struct buffer *error_message, const struct b } int AutonomyDevice::generate_first_command(struct buffer *default_command) { - MissionModule::AutonomyCommand command = generateCommand(std::vector(), "", MissionModule::AutonomyCommand_Action_NO_ACTION); + MissionModule::AutonomyCommand command = generateCommand(std::vector(), + "Undefined", // Necessary due to protobuf generating empty messages with default values + MissionModule::AutonomyCommand_Action_NO_ACTION); + if (protobuf::ProtobufHelper::serializeProtobufMessageToBuffer(default_command, command) != OK) { return NOT_OK; } From 04610096a92d252f7b1cdd3efe9567ca366c88f3 Mon Sep 17 00:00:00 2001 From: MarioIvancik Date: Fri, 30 Aug 2024 13:52:27 +0200 Subject: [PATCH 2/2] set route to Undefined on empty command from API --- source/external_server_api.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/external_server_api.cpp b/source/external_server_api.cpp index ca41ce0..2c3dec7 100644 --- a/source/external_server_api.cpp +++ b/source/external_server_api.cpp @@ -308,6 +308,11 @@ int wait_for_command(int timeout_time_in_ms, void *context) { if(!parse_status.ok()) { return NOT_OK; } + + if (proto_command.action() == MissionModule::AutonomyCommand_Action_NO_ACTION) { + proto_command.set_route("Undefined"); // Necessary due to protobuf generating empty messages with default values + } + std::string command_str; proto_command.SerializeToString(&command_str);