[wip] gz plugins (#24153)

* added optical flow to gz bridge

* log high rate sensor data

* it builds

* it builds and publishes, need to figure out build system now

* single library

* rename files

* add gz_msg for proto, fix build, test basic flow impl

* update rate, no blur

* PX4-OpticalFlow impl

* rename OpticalFlowSensor

* rename plugins

* disable gps, add plugin path

* cleanup

* fix plugin path export

* properly add OpticalFlowSystem dependency to gz

* move everything under gz_bridge

* cleanup

* add GZ_VEBOSE

* cleanup model/world build target cmake

* added GZ_DISTRO env, harmonic or ionic

* fix gz transport, unstage ark fpv bootloader

* unstage logged_topics.cpp

* cleanup

* make format

* ci fixes

* fix cmake

* remove required for gz-transport

* use model/world namespace for multi vehicle sim. Make format

* make format

* license

* remove needless member var

* made separate Kconfig for gz_msgs, gz_plugins, and gz_bridge

* move OpticalFlow build to it's own cmake

* fix clang

* cleanup comments

* fix rebase
This commit is contained in:
Jacob Dahl
2025-03-03 12:21:28 -09:00
committed by GitHub
parent 3b2d74b017
commit 6dc39d9deb
20 changed files with 764 additions and 53 deletions
@@ -0,0 +1,55 @@
############################################################################
#
# Copyright (c) 2025 PX4 Development Team. All rights reserved.
#
############################################################################
# message(FATAL_ERROR "JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE JAKE ")
# Check for Gazebo first
if(NOT DEFINED ENV{GZ_DISTRO})
set(GZ_DISTRO "harmonic" CACHE STRING "Gazebo distribution to use")
else()
set(GZ_DISTRO $ENV{GZ_DISTRO})
endif()
# Set versions based on distribution
if(GZ_DISTRO STREQUAL "harmonic")
set(GZ_CMAKE_VERSION "3")
set(GZ_MSGS_VERSION "10")
set(GZ_TRANSPORT_VERSION "13")
elseif(GZ_DISTRO STREQUAL "ionic")
set(GZ_CMAKE_VERSION "4")
set(GZ_MSGS_VERSION "11")
set(GZ_TRANSPORT_VERSION "14")
else()
message(FATAL_ERROR "Unknown Gazebo distribution: ${GZ_DISTRO}")
endif()
# Find required packages
find_package(gz-transport${GZ_TRANSPORT_VERSION})
if(gz-transport${GZ_TRANSPORT_VERSION}_FOUND)
find_package(gz-cmake${GZ_CMAKE_VERSION} REQUIRED)
find_package(gz-msgs${GZ_MSGS_VERSION} REQUIRED)
find_package(Protobuf REQUIRED)
# Generate protobuf messages
file(GLOB MSGS_PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/*.proto")
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${MSGS_PROTOS})
# Create library
add_library(px4_gz_msgs STATIC
${PROTO_SRCS}
${PROTO_HDRS}
)
target_include_directories(px4_gz_msgs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${Protobuf_INCLUDE_DIRS}
)
target_link_libraries(px4_gz_msgs PUBLIC ${PROTOBUF_LIBRARIES})
# Export the binary dir for other modules
set(PX4_GZ_MSGS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
endif()
+6
View File
@@ -0,0 +1,6 @@
menuconfig MODULES_SIMULATION_GZ_MSGS
bool "gz_msgs"
default n
depends on PLATFORM_POSIX
---help---
Enable proto generation for custom PX4 messages
@@ -0,0 +1,19 @@
syntax = "proto3";
package px4.msgs;
message OpticalFlow {
// Timestamp (microseconds, since system start)
int64 time_usec = 1;
// Integration time
uint32 integration_time_us = 2;
// Integrated x-axis flow (rad)
float integrated_x = 3;
// Integrated y-axis flow (rad)
float integrated_y = 4;
// Quality of optical flow measurement (0: bad, 255: maximum quality)
float quality = 5;
}