Skip to content

Commit

Permalink
Merge pull request #20 from bringauto/fix_empty_commands
Browse files Browse the repository at this point in the history
Hotfix generating empty command messages
  • Loading branch information
MarioIvancik authored Aug 30, 2024
2 parents 6f97f0f + 0461009 commit 0215140
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::Station>(), "", MissionModule::AutonomyCommand_Action_NO_ACTION);
MissionModule::AutonomyCommand command = generateCommand(std::vector<MissionModule::Station>(),
"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;
}
Expand Down
5 changes: 5 additions & 0 deletions source/external_server_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0215140

Please sign in to comment.