mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
* fix(gps): split RTCM corrections and moving-baseline uORB topics
The single gps_inject_data topic served two unrelated purposes:
external fixed-base RTCM corrections (from MAVLink GPS_RTCM_DATA or
UAVCAN RTCMStream) and moving-base-to-rover RTCM 4072. In a
dual-GPS-with-moving-base plus fixed-base setup, the two streams
collided on the same queue and the FMU UAVCAN bridge mirrored
fixed-base RTCM onto the MovingBaselineData CAN message, breaking
rover heading or RTK fix (see PX4/PX4-Autopilot#27088).
Split by role:
- rtcm_corrections (renamed from gps_inject_data): external RTCM
flowing into the vehicle; producers are
MAVLink, UAVCAN RTCMStream, and GPS drivers in
dump mode.
- rtcm_moving_baseline (new): moving-base GPS output intended for a
rover; single producer per vehicle
(MAX_INSTANCES = 1).
The GPS driver routes its own RTCM output to the right topic via
GPSHelper::isMovingBase(), and gates the two inbound streams per role
using new GPSHelper virtuals (PX4-GPSDrivers#212):
shouldInjectRTCMCorrections() is true for any configured receiver, so a
UART2 moving-base rover still accepts fixed-base corrections over its
main link; shouldInjectMovingBaseline() is true only for a UART1/CAN
heading rover, since a UART2 rover gets the baseline directly in
hardware and a moving base produces rather than consumes it. That
submodule PR also renames the ambiguous UBXMode fields to name their
UART explicitly (RoverWithMovingBase -> RoverWithMovingBaseUART2,
MovingBase -> MovingBaseUART2).
Septentrio's publish_rtcm_corrections() always publishes to
rtcm_moving_baseline (only the Secondary moving base calls it).
Rover-side consumers (gps, septentrio, uavcan bridge) drain both topics
independently; each topic gets its own stale-link switchover timer so
corrections failover is not suppressed by moving-baseline traffic, or
vice versa.
FMU UAVCAN bridge: two independent drain loops, one per topic. No
more dual-publish of a single uORB message onto both RTCMStream and
MovingBaselineData CAN streams.
CANnode MovingBaselineDataPub subscribes to rtcm_moving_baseline. The
bus_type == UAVCAN check is kept, now purely as a loop guard so a node
with both CANNODE_PUB_MBD and CANNODE_SUB_MBD does not rebroadcast a
peer's moving-baseline data back onto the bus. CANnode RTCMStream
subscriber maps each CAN source node ID to its own rtcm_corrections
instance (one PublicationMulti per source, capped at MAX_INSTANCES) so
multiple CAN RTCM sources (e.g. dual rovers outputting MSM7 for logging
plus a fixed-base feed) land on independent uORB instances instead of
interleaving on one, which would otherwise defeat the consumer's
per-instance stale-link selection.
Depends on PX4-GPSDrivers#212 (submodule bump included).
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(gps): use separate RTCM parsers for corrections and moving baseline
On a rover injecting both fixed-base corrections and moving-baseline RTCM, feeding both streams through a single parser allowed a fragmented frame from one source to be corrupted by bytes interleaved from the other. Reassemble each stream in its own Rtcm3Parser so frames are recovered independently.
Also collapse the two near-identical topics into a single RtcmData.msg published under both rtcm_corrections and rtcm_moving_baseline (the SensorGps pattern), track corrections and moving-baseline injection on separate perf counters so the reported corrections rate is no longer inflated by moving-baseline traffic, and zero-initialize the CAN DeviceId unions before populating their fields.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(septentrio): avoid bugprone sizeof division on RTCM byte buffer
moving_baseline.data is a uint8_t array, so sizeof(data)/sizeof(data[0]) divides by 1; clang-tidy's bugprone-sizeof-expression flags this as a suspicious sizeof(T)/sizeof(T). Use sizeof(data) directly - the capacity value is unchanged.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* refactor(gps): use dedicated per-stream RTCM drain functions
rtcm_moving_baseline has a single publisher (instance 0), so its
consumers are now a plain uORB::Subscription instead of a 4-instance
SubscriptionMultiArray, and the per-stream selected-instance and
stale-link timer members it no longer needs are removed.
With each RTCM stream now a fixed type with a single caller, the
templated drain helpers (drain_rtcm_subscriptions, the overloaded
drain_rtcm_to_can) bought nothing, so replace them with dedicated
functions: drainRtcmCorrections()/drainMovingBaseline() in the GPS
driver and the UAVCAN bridge, drain_rtcm_corrections()/
drain_moving_baseline() in Septentrio. The UAVCAN bridge calls
PublishRTCMStream/PublishMovingBaselineData directly instead of through
Forward lambdas.
Rename SeptentrioDriver::publish_rtcm_corrections() to
publish_moving_baseline(): it is only reached from the Secondary
moving-base decode path and only ever emits moving-baseline RTCM.
Corrections-path behavior (instance selection, generation-gap warning,
burst cap, self-injection filter) is unchanged.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* refactor(gps): rename RTCM inject gate to receiverReady and simplify chunk helper
Rename GPSHelper::shouldInjectRTCMCorrections() to receiverReady(). The
virtual gates injection of both RTCM corrections and moving-baseline, and
for UBX it simply reports whether the receiver is configured, so the name
now describes what it actually gates rather than implying it only concerns
corrections. Bumps the GPS-drivers submodule to the matching rename.
Drop the vestigial message-type template parameter from publish_rtcm_chunks:
both topics share rtcm_data_s, so only the publication type needs templating.
* fix(septentrio): log dropped RTCM uORB generations
Match the gps driver and warn when the RTCM corrections or moving-baseline
subscription skips a uORB generation, so dropped injection data is visible.
* docs(docs): Docs only update to the RtcmData msg
* chore(gps): pin GPSDrivers to merged main
Contains #212 (RTCM/moving-baseline gating virtuals), #213 (X20 CFG-ODO
NAK tolerance), and #215 (SPARTN input enable, best-effort VALSET).
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(septentrio): reassemble RTCM frames per stream before injecting
Both drains wrote raw uORB chunks to the receiver, so a fragmented frame
on one stream could get the other stream's bytes spliced in mid-frame and
corrupt both. Reassemble each stream in its own parser and only write
complete frames, mirroring the gps driver. Injection stats now count
frames instead of uORB chunks.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* refactor(mavlink)!: remove GPS_RTCM_DATA output stream
GPS_RTCM_DATA is a GCS-to-vehicle correction transport; echoing
rtcm_corrections back out over MAVLink had no consumer and the echo was
lossy anyway (uint8 len and 180-byte payload truncate 300-byte uORB
chunks). Receiving GPS_RTCM_DATA is unchanged.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
618 lines
20 KiB
CMake
618 lines
20 KiB
CMake
############################################################################
|
|
#
|
|
# Copyright (c) 2016-2022 PX4 Development Team. All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
#
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in
|
|
# the documentation and/or other materials provided with the
|
|
# distribution.
|
|
# 3. Neither the name PX4 nor the names of its contributors may be
|
|
# used to endorse or promote products derived from this software
|
|
# without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
############################################################################
|
|
|
|
# Support IN_LIST if() operator
|
|
cmake_policy(SET CMP0057 NEW)
|
|
|
|
include(px4_list_make_absolute)
|
|
|
|
set(msg_files
|
|
ActionRequest.msg
|
|
ActuatorArmed.msg
|
|
ActuatorControlsStatus.msg
|
|
ActuatorOutputs.msg
|
|
ActuatorServosTrim.msg
|
|
ActuatorTest.msg
|
|
AdcReport.msg
|
|
Airspeed.msg
|
|
AirspeedWind.msg
|
|
AutotuneAttitudeControlStatus.msg
|
|
BatteryInfo.msg
|
|
ButtonEvent.msg
|
|
CameraCapture.msg
|
|
CameraStatus.msg
|
|
CameraTrigger.msg
|
|
CanInterfaceStatus.msg
|
|
CellularStatus.msg
|
|
CollisionConstraints.msg
|
|
ControlAllocatorStatus.msg
|
|
Cpuload.msg
|
|
DatamanRequest.msg
|
|
DatamanResponse.msg
|
|
DebugArray.msg
|
|
DebugKeyValue.msg
|
|
DebugValue.msg
|
|
DebugVect.msg
|
|
DeviceInformation.msg
|
|
DifferentialPressure.msg
|
|
DistanceSensor.msg
|
|
DistanceSensorModeChangeRequest.msg
|
|
DronecanNodeStatus.msg
|
|
Ekf2Timestamps.msg
|
|
EscEepromRead.msg
|
|
EscEepromWrite.msg
|
|
EscReport.msg
|
|
EscStatus.msg
|
|
EstimatorAidSource1d.msg
|
|
EstimatorAidSource2d.msg
|
|
EstimatorAidSource3d.msg
|
|
EstimatorBias.msg
|
|
EstimatorBias3d.msg
|
|
EstimatorEventFlags.msg
|
|
EstimatorFusionControl.msg
|
|
EstimatorGpsStatus.msg
|
|
EstimatorInnovations.msg
|
|
EstimatorSelectorStatus.msg
|
|
EstimatorSensorBias.msg
|
|
EstimatorStates.msg
|
|
EstimatorStatus.msg
|
|
EstimatorStatusFlags.msg
|
|
versioned/Event.msg
|
|
FigureEightStatus.msg
|
|
FailsafeFlags.msg
|
|
FailureDetectorStatus.msg
|
|
FailureInjection.msg
|
|
FlightPhaseEstimation.msg
|
|
FollowTarget.msg
|
|
FollowTargetEstimator.msg
|
|
FollowTargetStatus.msg
|
|
FuelTankStatus.msg
|
|
FixedWingLateralGuidanceStatus.msg
|
|
FixedWingLateralStatus.msg
|
|
FixedWingRunwayControl.msg
|
|
GeneratorStatus.msg
|
|
GeofenceResult.msg
|
|
GeofenceStatus.msg
|
|
GainCompression.msg
|
|
GimbalControls.msg
|
|
GimbalDeviceAttitudeStatus.msg
|
|
GimbalDeviceInformation.msg
|
|
GimbalDeviceSetAttitude.msg
|
|
GimbalManagerInformation.msg
|
|
GimbalManagerSetAttitude.msg
|
|
GimbalManagerSetManualControl.msg
|
|
GimbalManagerStatus.msg
|
|
GpioConfig.msg
|
|
GpioIn.msg
|
|
GpioOut.msg
|
|
GpioRequest.msg
|
|
GpsDump.msg
|
|
Gripper.msg
|
|
HealthReport.msg
|
|
HeaterStatus.msg
|
|
HoverThrustEstimate.msg
|
|
InputRc.msg
|
|
InternalCombustionEngineControl.msg
|
|
InternalCombustionEngineStatus.msg
|
|
IridiumsbdStatus.msg
|
|
IrlockReport.msg
|
|
LandingGear.msg
|
|
LandingGearWheel.msg
|
|
LandingTargetInnovations.msg
|
|
LandingTargetPose.msg
|
|
LaunchDetectionStatus.msg
|
|
LedControl.msg
|
|
LoggerStatus.msg
|
|
LogMessage.msg
|
|
MagnetometerBiasEstimate.msg
|
|
MagWorkerData.msg
|
|
ManualControlSwitches.msg
|
|
MavlinkLog.msg
|
|
MavlinkTunnel.msg
|
|
MessageFormatRequest.msg
|
|
MessageFormatResponse.msg
|
|
Mission.msg
|
|
MissionResult.msg
|
|
MountOrientation.msg
|
|
NavigatorMissionItem.msg
|
|
NavigatorStatus.msg
|
|
NeuralControl.msg
|
|
NormalizedUnsignedSetpoint.msg
|
|
ObstacleDistance.msg
|
|
OffboardControlMode.msg
|
|
OnboardComputerStatus.msg
|
|
OpenDroneIdArmStatus.msg
|
|
OpenDroneIdBasicId.msg
|
|
OpenDroneIdOperatorId.msg
|
|
OpenDroneIdSelfId.msg
|
|
OpenDroneIdSystem.msg
|
|
OrbitStatus.msg
|
|
OrbTest.msg
|
|
OrbTestLarge.msg
|
|
OrbTestMedium.msg
|
|
ParameterResetRequest.msg
|
|
ParameterSetUsedRequest.msg
|
|
ParameterSetValueRequest.msg
|
|
ParameterSetValueResponse.msg
|
|
ParameterUpdate.msg
|
|
Ping.msg
|
|
PositionControllerLandingStatus.msg
|
|
PositionControllerStatus.msg
|
|
PositionSetpoint.msg
|
|
PositionSetpointTriplet.msg
|
|
PowerButtonState.msg
|
|
PowerMonitor.msg
|
|
PpsCapture.msg
|
|
PurePursuitStatus.msg
|
|
PwmInput.msg
|
|
Px4ioStatus.msg
|
|
QshellReq.msg
|
|
QshellRetval.msg
|
|
RadioStatus.msg
|
|
RangingBeacon.msg
|
|
RateCtrlStatus.msg
|
|
RcChannels.msg
|
|
RcParameterMap.msg
|
|
RoverAttitudeSetpoint.msg
|
|
RoverAttitudeStatus.msg
|
|
RoverPositionSetpoint.msg
|
|
RoverRateSetpoint.msg
|
|
RoverRateStatus.msg
|
|
RoverSpeedSetpoint.msg
|
|
RoverSpeedStatus.msg
|
|
RoverSteeringSetpoint.msg
|
|
RoverThrottleSetpoint.msg
|
|
Rpm.msg
|
|
RtcmData.msg
|
|
RtlStatus.msg
|
|
RtlTimeEstimate.msg
|
|
SatelliteInfo.msg
|
|
SensorAccel.msg
|
|
SensorAccelFifo.msg
|
|
SensorBaro.msg
|
|
SensorCombined.msg
|
|
SensorCorrection.msg
|
|
SensorGnssRelative.msg
|
|
SensorGnssStatus.msg
|
|
SensorGps.msg
|
|
SensorGyro.msg
|
|
SensorGyroFft.msg
|
|
SensorGyroFifo.msg
|
|
SensorHygrometer.msg
|
|
SensorMag.msg
|
|
SensorOpticalFlow.msg
|
|
SensorPreflightMag.msg
|
|
SensorSelection.msg
|
|
SensorsStatus.msg
|
|
SensorsStatusImu.msg
|
|
SensorTemp.msg
|
|
SensorUwb.msg
|
|
SensorAirflow.msg
|
|
SystemPower.msg
|
|
TakeoffStatus.msg
|
|
TaskStackInfo.msg
|
|
TecsStatus.msg
|
|
TelemetryStatus.msg
|
|
TiltrotorExtraControls.msg
|
|
TimesyncStatus.msg
|
|
TrajectorySetpoint6dof.msg
|
|
TransponderReport.msg
|
|
TuneControl.msg
|
|
UavcanParameterRequest.msg
|
|
UavcanParameterValue.msg
|
|
UlogStream.msg
|
|
UlogStreamAck.msg
|
|
VehicleAcceleration.msg
|
|
VehicleAirData.msg
|
|
VehicleConstraints.msg
|
|
VehicleControlMode.msg
|
|
VehicleImu.msg
|
|
VehicleImuStatus.msg
|
|
VehicleLocalPositionSetpoint.msg
|
|
VehicleMagnetometer.msg
|
|
VehicleOpticalFlow.msg
|
|
VehicleOpticalFlowVel.msg
|
|
VehicleRoi.msg
|
|
VehicleThrustSetpoint.msg
|
|
VehicleTorqueSetpoint.msg
|
|
VelocityLimits.msg
|
|
Vtx.msg
|
|
WheelEncoders.msg
|
|
YawEstimatorStatus.msg
|
|
versioned/ActuatorMotors.msg
|
|
versioned/ActuatorServos.msg
|
|
versioned/AirspeedValidated.msg
|
|
versioned/ArmingCheckReply.msg
|
|
versioned/ArmingCheckRequest.msg
|
|
versioned/AuxGlobalPosition.msg
|
|
versioned/BatteryStatus.msg
|
|
versioned/ConfigOverrides.msg
|
|
versioned/FixedWingLateralSetpoint.msg
|
|
versioned/FixedWingLongitudinalSetpoint.msg
|
|
versioned/GotoSetpoint.msg
|
|
versioned/HomePosition.msg
|
|
versioned/LateralControlConfiguration.msg
|
|
versioned/LongitudinalControlConfiguration.msg
|
|
versioned/ManualControlSetpoint.msg
|
|
versioned/ModeCompleted.msg
|
|
versioned/RaptorInput.msg
|
|
versioned/RaptorStatus.msg
|
|
versioned/RegisterExtComponentReply.msg
|
|
versioned/RegisterExtComponentRequest.msg
|
|
versioned/SetpointConfig.msg
|
|
versioned/SetpointConfigReply.msg
|
|
versioned/TrajectorySetpoint.msg
|
|
versioned/UnregisterExtComponent.msg
|
|
versioned/VehicleAngularVelocity.msg
|
|
versioned/VehicleAttitude.msg
|
|
versioned/VehicleAttitudeSetpoint.msg
|
|
versioned/VehicleCommandAck.msg
|
|
versioned/VehicleCommand.msg
|
|
versioned/VehicleGlobalPosition.msg
|
|
versioned/VehicleLandDetected.msg
|
|
versioned/VehicleLocalPosition.msg
|
|
versioned/VehicleOdometry.msg
|
|
versioned/VehicleRatesSetpoint.msg
|
|
versioned/VehicleStatus.msg
|
|
versioned/VtolVehicleStatus.msg
|
|
versioned/Wind.msg
|
|
)
|
|
list(SORT msg_files)
|
|
|
|
if(CONFIG_NAVIGATOR_ADSB)
|
|
list(APPEND msg_files
|
|
DetectAndAvoid.msg
|
|
DetectAndAvoidMostUrgent.msg)
|
|
endif()
|
|
|
|
if(CONFIG_MODULES_VISION_TARGET_ESTIMATOR)
|
|
list(APPEND msg_files
|
|
TargetGnss.msg
|
|
VteInput.msg
|
|
VtePosition.msg
|
|
VteOrientation.msg
|
|
VteAidSource1d.msg
|
|
VteAidSource3d.msg
|
|
VteBiasInitStatus.msg
|
|
FiducialMarkerPosReport.msg
|
|
FiducialMarkerYawReport.msg
|
|
PrecLandStatus.msg)
|
|
endif()
|
|
|
|
px4_list_make_absolute(msg_files ${CMAKE_CURRENT_SOURCE_DIR} ${msg_files})
|
|
|
|
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
|
|
# Check that the msg directory and the CMakeLists.txt file exists
|
|
if(EXISTS ${EXTERNAL_MODULES_LOCATION}/msg/CMakeLists.txt)
|
|
add_subdirectory(${EXTERNAL_MODULES_LOCATION}/msg external_msg)
|
|
|
|
# Add each of the external message files to the global msg_files list
|
|
foreach(external_msg_file ${config_msg_list_external})
|
|
list(APPEND msg_files ${EXTERNAL_MODULES_LOCATION}/msg/${external_msg_file})
|
|
endforeach()
|
|
endif()
|
|
endif()
|
|
|
|
# headers
|
|
set(msg_out_path ${PX4_BINARY_DIR}/uORB/topics)
|
|
set(ucdr_out_path ${PX4_BINARY_DIR}/uORB/ucdr)
|
|
set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources)
|
|
|
|
set(uorb_headers)
|
|
set(uorb_sources)
|
|
set(uorb_ucdr_headers)
|
|
set(uorb_json_files)
|
|
foreach(msg_file ${msg_files})
|
|
get_filename_component(msg ${msg_file} NAME_WE)
|
|
|
|
# Pascal case to snake case (MsgFile -> msg_file)
|
|
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" msg "${msg}")
|
|
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" msg "${msg}")
|
|
string(TOLOWER "${msg}" msg)
|
|
|
|
list(APPEND uorb_headers ${msg_out_path}/${msg}.h)
|
|
list(APPEND uorb_sources ${msg_source_out_path}/${msg}.cpp)
|
|
list(APPEND uorb_ucdr_headers ${ucdr_out_path}/${msg}.h)
|
|
list(APPEND uorb_json_files ${msg_source_out_path}/${msg}.json)
|
|
endforeach()
|
|
|
|
# set parent scope msg_files for ROS
|
|
set(msg_files ${msg_files} PARENT_SCOPE)
|
|
|
|
# Generate uORB headers
|
|
add_custom_command(
|
|
OUTPUT
|
|
${uorb_headers}
|
|
${msg_out_path}/uORBTopics.hpp
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
--headers
|
|
-f ${msg_files}
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
|
|
-o ${msg_out_path}
|
|
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
|
|
DEPENDS
|
|
${msg_files}
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/msg.h.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/uORBTopics.hpp.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
|
COMMENT "Generating uORB topic headers"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
add_custom_target(uorb_headers DEPENDS ${uorb_headers})
|
|
|
|
add_custom_command(
|
|
OUTPUT
|
|
${uorb_json_files}
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
--json
|
|
-f ${msg_files}
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
|
|
-o ${msg_source_out_path}
|
|
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
|
|
DEPENDS
|
|
${msg_files}
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/msg.json.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
|
COMMENT "Generating uORB json files"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
add_custom_target(uorb_json_files DEPENDS ${uorb_json_files})
|
|
|
|
set(uorb_message_fields_cpp_file ${msg_source_out_path}/uORBMessageFieldsGenerated.cpp)
|
|
set(uorb_message_fields_header_file ${msg_out_path}/uORBMessageFieldsGenerated.hpp)
|
|
add_custom_command(
|
|
OUTPUT
|
|
${uorb_message_fields_cpp_file}
|
|
${uorb_message_fields_header_file}
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_compressed_fields.py
|
|
-f ${uorb_json_files}
|
|
--source-output-file ${uorb_message_fields_cpp_file}
|
|
--header-output-file ${uorb_message_fields_header_file}
|
|
DEPENDS
|
|
${uorb_json_files}
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_compressed_fields.py
|
|
COMMENT "Generating uORB compressed fields"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
|
|
# Generate microcdr headers
|
|
add_custom_command(
|
|
OUTPUT ${uorb_ucdr_headers}
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
--headers
|
|
-f ${msg_files}
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
|
|
-o ${ucdr_out_path}
|
|
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr
|
|
DEPENDS
|
|
${msg_files}
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr/msg.h.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
|
COMMENT "Generating uORB topic ucdr headers"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
add_custom_target(uorb_ucdr_headers DEPENDS ${uorb_ucdr_headers})
|
|
|
|
# Generate uORB sources
|
|
add_custom_command(
|
|
OUTPUT
|
|
${uorb_sources}
|
|
${msg_source_out_path}/uORBTopics.cpp
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
--sources
|
|
-f ${msg_files}
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
|
|
-o ${msg_source_out_path}
|
|
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
|
|
DEPENDS
|
|
${msg_files}
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/msg.cpp.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/uORBTopics.cpp.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
|
COMMENT "Generating uORB topic sources"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
|
|
add_library(uorb_msgs ${uorb_headers} ${msg_out_path}/uORBTopics.hpp ${uorb_sources} ${msg_source_out_path}/uORBTopics.cpp ${uorb_message_fields_cpp_file})
|
|
target_link_libraries(uorb_msgs PRIVATE m)
|
|
add_dependencies(uorb_msgs prebuild_targets uorb_headers)
|
|
|
|
if(CONFIG_LIB_CDRSTREAM)
|
|
set(uorb_cdr_idl)
|
|
set(uorb_cdr_msg)
|
|
set(uorb_cdr_hash)
|
|
set(uorb_cdr_idl_uorb)
|
|
set(idl_include_path ${PX4_BINARY_DIR}/uORB/idl)
|
|
set(idl_out_path ${idl_include_path}/px4/msg)
|
|
set(idl_rihs01_out_path ${idl_include_path}/px4)
|
|
set(idl_uorb_path ${PX4_BINARY_DIR}/msg/px4/msg)
|
|
|
|
# Make sure that CycloneDDS has been checkout out
|
|
execute_process(COMMAND git submodule sync src/lib/cdrstream/cyclonedds
|
|
WORKING_DIRECTORY ${PX4_SOURCE_DIR} )
|
|
execute_process(COMMAND git submodule update --init --force src/lib/cdrstream/cyclonedds
|
|
WORKING_DIRECTORY ${PX4_SOURCE_DIR} )
|
|
|
|
# CycloneDDS-tools doesn't ship with the cdrstream-desc feature thus we've to compile idlc from source
|
|
MESSAGE(STATUS "Configuring idlc :" ${CMAKE_CURRENT_BINARY_DIR}/idlc)
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/idlc)
|
|
execute_process(COMMAND ${CMAKE_COMMAND} ${PX4_SOURCE_DIR}/src/lib/cdrstream/cyclonedds
|
|
-DCMAKE_C_COMPILER=/usr/bin/gcc
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
-DCMAKE_C_FLAGS=-Wno-maybe-uninitialized\ -Wno-unused-parameter
|
|
-DBUILD_EXAMPLES=OFF
|
|
-DENABLE_SSL=OFF
|
|
-DENABLE_SECURITY=OFF
|
|
-DBUILD_DDSPERF=OFF
|
|
-DENABLE_LTO=OFF
|
|
-DENABLE_LIFESPAN=OFF
|
|
-DENABLE_DEADLINE_MISSED=OFF
|
|
-DENABLE_NETWORK_PARTITIONS=oFF
|
|
-DENABLE_SOURCE_SPECIFIC_MULTICAST=oFF
|
|
-DENABLE_IPV6=OFF
|
|
-DENABLE_TYPE_DISCOVERY=OFF
|
|
-DENABLE_TOPIC_DISCOVERY=oFF
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/idlc
|
|
RESULT_VARIABLE CMD_ERROR
|
|
OUTPUT_FILE CMD_OUTPUT )
|
|
MESSAGE(STATUS "Building idlc :" ${CMAKE_CURRENT_BINARY_DIR}/idlc)
|
|
execute_process(COMMAND ${CMAKE_COMMAND} --build . --target idlc
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/idlc
|
|
RESULT_VARIABLE CMD_ERROR
|
|
OUTPUT_FILE CMD_OUTPUT )
|
|
list(APPEND CMAKE_PROGRAM_PATH "${CMAKE_CURRENT_BINARY_DIR}/idlc/bin")
|
|
|
|
# Copy .msg files
|
|
foreach(msg_file ${msg_files})
|
|
get_filename_component(msg ${msg_file} NAME_WE)
|
|
configure_file(${msg_file} ${idl_out_path}/${msg}.msg COPYONLY)
|
|
list(APPEND uorb_cdr_idl ${idl_out_path}/${msg}.idl)
|
|
list(APPEND uorb_cdr_msg ${idl_out_path}/${msg}.msg)
|
|
list(APPEND uorb_cdr_hash ${idl_out_path}/${msg}.json)
|
|
list(APPEND uorb_cdr_idl_uorb ${idl_uorb_path}/${msg}.h)
|
|
endforeach()
|
|
|
|
# Generate IDL from .msg using rosidl_adapter
|
|
# Note this a submodule inside PX4 hence no ROS2 installation required
|
|
add_custom_command(
|
|
OUTPUT ${uorb_cdr_idl}
|
|
COMMAND ${CMAKE_COMMAND}
|
|
-E env "PYTHONPATH=${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_adapter:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_cli"
|
|
${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/cdrstream/msg2idl.py
|
|
${uorb_cdr_msg}
|
|
DEPENDS
|
|
${uorb_cdr_msg}
|
|
git_cyclonedds
|
|
COMMENT "Generating IDL from uORB topic headers"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
|
|
file(CREATE_LINK ${idl_rihs01_out_path} ${idl_include_path}/px4_msgs SYMBOLIC)
|
|
|
|
# Generate IDL from .msg using rosidl_adapter
|
|
# Note this is a submodule inside PX4 hence no ROS2 installation required
|
|
add_custom_command(
|
|
OUTPUT ${uorb_cdr_hash}
|
|
COMMAND ${CMAKE_COMMAND}
|
|
-E env "PYTHONPATH=${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_adapter:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_cli:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_parser:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_generator_type_description"
|
|
${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/cdrstream/idl2rihs01.py
|
|
--output-dir ${idl_rihs01_out_path}
|
|
${uorb_cdr_idl}
|
|
DEPENDS
|
|
${uorb_cdr_idl}
|
|
git_cyclonedds
|
|
COMMENT "Generating RIHS01 hashes from IDL"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
|
|
# Generate C definitions from IDL
|
|
set(CYCLONEDDS_DIR ${PX4_SOURCE_DIR}/src/lib/cdrstream/cyclonedds)
|
|
include("${CYCLONEDDS_DIR}/cmake/Modules/Generate.cmake")
|
|
idlc_generate(TARGET uorb_cdrstream
|
|
FEATURES "cdrstream-desc"
|
|
FILES ${uorb_cdr_idl}
|
|
INCLUDES ${idl_include_path}
|
|
BASE_DIR ${idl_include_path}
|
|
WARNINGS no-implicit-extensibility no-unsupported-annotations)
|
|
target_link_libraries(uorb_cdrstream INTERFACE cdr)
|
|
|
|
# Generate and overwrite IDL header with custom headers for uORB operatability
|
|
# We typedef the IDL struct the uORB struct so that the IDL offset calculate
|
|
# the offset of internal uORB struct for serialization/deserialization
|
|
|
|
# In the future we might want to turn this around let the IDL struct be the leading ABI
|
|
# However we need to remove the padding for logging and remove the re-ordering of fields
|
|
|
|
add_custom_target(
|
|
uorb_idl_header
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
--uorb-idl-header
|
|
-f ${msg_files}
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
|
|
-o ${idl_uorb_path}
|
|
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream
|
|
DEPENDS
|
|
uorb_cdrstream
|
|
${msg_files}
|
|
${uorb_cdr_hash}
|
|
${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream/uorb_idl_header.h.em
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
|
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
|
COMMENT "Generating uORB compatible IDL headers"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
add_dependencies(uorb_msgs uorb_idl_header)
|
|
|
|
# Compile all CDR compatible message defnitions
|
|
target_link_libraries(uorb_msgs PRIVATE uorb_cdrstream )
|
|
endif()
|
|
|
|
if(CONFIG_MODULES_ZENOH)
|
|
# The Zenoh Kconfig.topics catalog is generated into the build tree in
|
|
# cmake/kconfig.cmake (it must exist before Kconfig is parsed). Here we only
|
|
# generate the per-board publisher/subscriber factory.
|
|
add_custom_command(
|
|
OUTPUT
|
|
${PX4_BINARY_DIR}/src/modules/zenoh/uorb_pubsub_factory.hpp
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/zenoh/px_generate_zenoh_topic_files.py
|
|
--zenoh-pub-sub
|
|
-f ${msg_files}
|
|
-o ${PX4_BINARY_DIR}/src/modules/zenoh/
|
|
-e ${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh
|
|
--rihs ${idl_rihs01_out_path}
|
|
DEPENDS
|
|
${msg_files}
|
|
${uorb_cdr_hash}
|
|
${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh/uorb_pubsub_factory.hpp.em
|
|
${PX4_SOURCE_DIR}/Tools/zenoh/px_generate_zenoh_topic_files.py
|
|
COMMENT "Generating Zenoh Topic Code"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
VERBATIM
|
|
)
|
|
add_library(zenoh_topics ${PX4_BINARY_DIR}/src/modules/zenoh/uorb_pubsub_factory.hpp)
|
|
set_target_properties(zenoh_topics PROPERTIES LINKER_LANGUAGE CXX)
|
|
endif()
|