mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 04:06:33 +08:00
initial minimal PX4_ROS2 platform and px4_ros2_default build (#20689)
- new ROS2 platform in PX4 intended for creating configs that build and run entirely in ROS2 - PX4_CONFIG defaults to px4_ros2_default if no config specified and in a colcon workspace with ROS_VERSION=2 - currently doesn't do much other than allow you to build px4 msgs interface package
This commit is contained in:
+18
-14
@@ -33,6 +33,16 @@
|
||||
|
||||
# find PX4 config
|
||||
# look for in tree board config that matches CONFIG input
|
||||
|
||||
if(NOT CONFIG)
|
||||
# default to px4_ros2_default if building within a ROS2 colcon environment
|
||||
if(("$ENV{COLCON}" MATCHES "1") AND ("$ENV{ROS_VERSION}" MATCHES "2"))
|
||||
set(CONFIG "px4_ros2_default" CACHE STRING "desired configuration")
|
||||
else()
|
||||
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT PX4_CONFIG_FILE)
|
||||
|
||||
file(GLOB_RECURSE board_configs
|
||||
@@ -40,8 +50,6 @@ if(NOT PX4_CONFIG_FILE)
|
||||
"boards/*.px4board"
|
||||
)
|
||||
|
||||
set(PX4_CONFIGS ${board_configs} CACHE STRING "PX4 board configs" FORCE)
|
||||
|
||||
foreach(filename ${board_configs})
|
||||
# parse input CONFIG into components to match with existing in tree configs
|
||||
# the platform prefix (eg nuttx_) is historical, and removed if present
|
||||
@@ -63,9 +71,9 @@ if(NOT PX4_CONFIG_FILE)
|
||||
)
|
||||
set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE)
|
||||
set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE)
|
||||
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
|
||||
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
|
||||
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
break()
|
||||
endif()
|
||||
|
||||
@@ -76,19 +84,15 @@ if(NOT PX4_CONFIG_FILE)
|
||||
)
|
||||
set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE)
|
||||
set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE)
|
||||
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
|
||||
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
|
||||
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT PX4_CONFIG_FILE)
|
||||
message(FATAL_ERROR "PX4 config file not set, try one of ${PX4_CONFIGS}")
|
||||
endif()
|
||||
|
||||
message(STATUS "PX4 config file: ${PX4_CONFIG_FILE}")
|
||||
|
||||
include_directories(${PX4_BOARD_DIR}/src)
|
||||
@@ -108,9 +112,9 @@ set(PX4_BOARD_LABEL ${LABEL} CACHE STRING "PX4 board label" FORCE)
|
||||
set(PX4_CONFIG "${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}" CACHE STRING "PX4 config" FORCE)
|
||||
|
||||
if(EXISTS "${PX4_BOARD_DIR}/uavcan_board_identity")
|
||||
include ("${PX4_BOARD_DIR}/uavcan_board_identity")
|
||||
include ("${PX4_BOARD_DIR}/uavcan_board_identity")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${PX4_BOARD_DIR}/sitl.cmake")
|
||||
include ("${PX4_BOARD_DIR}/sitl.cmake")
|
||||
include ("${PX4_BOARD_DIR}/sitl.cmake")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user