Alex Mikhalev
6 years ago
7 changed files with 89 additions and 5 deletions
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
set(COMPONENT_SRCS "nanopb/pb_common.c" |
||||
"nanopb/pb_decode.c" |
||||
"nanopb/pb_encode.c") |
||||
set(COMPONENT_ADD_INCLUDEDIRS "nanopb") |
||||
|
||||
register_component() |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
function(nanopb_generate PROTO_FILE PB_OUT HDR_VAR SRC_VAR) |
||||
get_filename_component(PROTO_FILE_NAME ${PROTO_FILE} NAME_WE) |
||||
get_filename_component(PROTO_FILE_PATH ${PROTO_FILE} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
get_filename_component(PROTO_FILE_DIR ${PROTO_FILE_PATH} DIRECTORY) |
||||
set(PROTO_HDR "${PB_OUT}/${PROTO_FILE_NAME}.pb.h") |
||||
set(PROTO_SRC "${PB_OUT}/${PROTO_FILE_NAME}.pb.c") |
||||
list(APPEND "${HDR_VAR}" ${PROTO_HDR}) |
||||
list(APPEND "${SRC_VAR}" ${PROTO_SRC}) |
||||
if(NOT CMAKE_SCRIPT_MODE_FILE) |
||||
add_custom_command(OUTPUT ${PROTO_HDR} ${PROTO_SRC} |
||||
COMMAND protoc |
||||
--plugin=protoc-gen-nanopb=${CMAKE_CURRENT_LIST_DIR}/nanopb/generator/protoc-gen-nanopb |
||||
--nanopb_out=${PB_OUT} |
||||
--proto_path ${PROTO_FILE_DIR} |
||||
${PROTO_FILE_PATH} |
||||
DEPENDS ${PROTO_FILE_PATH}) |
||||
endif() |
||||
list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${PROTO_HDR} ${PROTO_SRC}) |
||||
endfunction() |
||||
|
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
syntax = "proto3"; |
||||
|
||||
enum UGV_State { |
||||
IDLE = 0; |
||||
AQUIRING = 1; |
||||
DRIVING = 2; |
||||
FINISHED = 3; |
||||
} |
||||
|
||||
message Location { |
||||
uint32 fix_quality = 1; |
||||
float latitude = 2; |
||||
float longitude = 3; |
||||
float altitude = 4; |
||||
} |
||||
|
||||
message UGV_Status { |
||||
UGV_State state = 1; |
||||
Location location = 2; |
||||
} |
||||
|
||||
message UGV_Message { |
||||
oneof ugv_message { |
||||
UGV_Status status = 1; |
||||
uint32 command_ack = 2; |
||||
} |
||||
} |
||||
|
||||
enum GroundCommandType { |
||||
DISABLE = 0; |
||||
ENABLE = 1; |
||||
} |
||||
|
||||
message GroundCommand { |
||||
uint32 id = 1; |
||||
GroundCommandType type = 2; |
||||
} |
||||
|
||||
message GroundMessage { |
||||
oneof ground_message { |
||||
GroundCommand command = 1; |
||||
} |
||||
} |
Loading…
Reference in new issue