Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg: introduce subset of versioned messages #23850

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ pipeline {
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/px4_msgs.git")
// 'main' branch
sh('rm -f px4_msgs/msg/*.msg')
sh('rm -f px4_msgs/msg/versioned/*.msg')
sh('rm -f px4_msgs/srv/*.srv')
sh('cp msg/*.msg px4_msgs/msg/')
sh('cp msg/versioned/*.msg px4_msgs/versioned/msg/')
sh('cp srv/*.srv px4_msgs/srv/')
sh('cd px4_msgs; git status; git add .; git commit -a -m "Update message definitions `date`" || true')
sh('cd px4_msgs; git push origin main || true')
Expand Down
19 changes: 16 additions & 3 deletions Tools/msg/generate_msg_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@

def get_msgs_list(msgdir):
"""
Makes list of msg files in the given directory
Makes a list of relative paths of .msg files in the given directory
and its subdirectories.

Parameters:
msgdir (str): The directory to search for .msg files.

Returns:
list: A list of relative paths to .msg files.
"""
return [fn for fn in os.listdir(msgdir) if fn.endswith(".msg")]
msgs = []
for root, _, files in os.walk(msgdir):
for fn in files:
if fn.endswith(".msg"):
relative_path = os.path.relpath(os.path.join(root, fn), msgdir)
msgs.append(relative_path)
return msgs


if __name__ == "__main__":
Expand All @@ -32,7 +45,7 @@ def get_msgs_list(msgdir):
filelist_in_markdown=''

for msg_file in msg_files:
msg_name = os.path.splitext(msg_file)[0]
msg_name = os.path.splitext(os.path.basename(msg_file))[0]
output_file = os.path.join(output_dir, msg_name+'.md')
msg_filename = os.path.join(msg_path, msg_file)
print("{:} -> {:}".format(msg_filename, output_file))
Expand Down
72 changes: 39 additions & 33 deletions msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,14 @@ set(msg_files
ActionRequest.msg
ActuatorArmed.msg
ActuatorControlsStatus.msg
ActuatorMotors.msg
ActuatorOutputs.msg
ActuatorServos.msg
ActuatorServosTrim.msg
ActuatorTest.msg
AdcReport.msg
Airspeed.msg
AirspeedValidated.msg
AirspeedWind.msg
ArmingCheckReply.msg
ArmingCheckRequest.msg
AutotuneAttitudeControlStatus.msg
BatteryStatus.msg
Buffer128.msg
ButtonEvent.msg
CameraCapture.msg
Expand All @@ -62,7 +57,6 @@ set(msg_files
CellularStatus.msg
CollisionConstraints.msg
CollisionReport.msg
ConfigOverrides.msg
ControlAllocatorStatus.msg
Cpuload.msg
DatamanRequest.msg
Expand Down Expand Up @@ -110,7 +104,6 @@ set(msg_files
GimbalManagerSetAttitude.msg
GimbalManagerSetManualControl.msg
GimbalManagerStatus.msg
GotoSetpoint.msg
GpioConfig.msg
GpioIn.msg
GpioOut.msg
Expand All @@ -120,7 +113,6 @@ set(msg_files
Gripper.msg
HealthReport.msg
HeaterStatus.msg
HomePosition.msg
HoverThrustEstimate.msg
InputRc.msg
InternalCombustionEngineStatus.msg
Expand All @@ -136,7 +128,6 @@ set(msg_files
LogMessage.msg
MagnetometerBiasEstimate.msg
MagWorkerData.msg
ManualControlSetpoint.msg
ManualControlSwitches.msg
MavlinkLog.msg
MavlinkTunnel.msg
Expand All @@ -145,7 +136,6 @@ set(msg_files
Mission.msg
MissionResult.msg
MountOrientation.msg
ModeCompleted.msg
NavigatorMissionItem.msg
NavigatorStatus.msg
NormalizedUnsignedSetpoint.msg
Expand Down Expand Up @@ -182,8 +172,6 @@ set(msg_files
RateCtrlStatus.msg
RcChannels.msg
RcParameterMap.msg
RegisterExtComponentReply.msg
RegisterExtComponentRequest.msg
RoverAckermannGuidanceStatus.msg
RoverAckermannStatus.msg
RoverDifferentialGuidanceStatus.msg
Expand Down Expand Up @@ -223,47 +211,59 @@ set(msg_files
TiltrotorExtraControls.msg
TimesyncStatus.msg
TrajectoryBezier.msg
TrajectorySetpoint.msg
TrajectoryWaypoint.msg
TransponderReport.msg
TuneControl.msg
UavcanParameterRequest.msg
UavcanParameterValue.msg
UlogStream.msg
UlogStreamAck.msg
UnregisterExtComponent.msg
VehicleAcceleration.msg
VehicleAirData.msg
VehicleAngularAccelerationSetpoint.msg
VehicleAngularVelocity.msg
VehicleAttitude.msg
VehicleAttitudeSetpoint.msg
VehicleCommand.msg
VehicleCommandAck.msg
VehicleConstraints.msg
VehicleControlMode.msg
VehicleGlobalPosition.msg
VehicleImu.msg
VehicleImuStatus.msg
VehicleLandDetected.msg
VehicleLocalPosition.msg
VehicleLocalPositionSetpoint.msg
VehicleMagnetometer.msg
VehicleOdometry.msg
VehicleOpticalFlow.msg
VehicleOpticalFlowVel.msg
VehicleRatesSetpoint.msg
VehicleRoi.msg
VehicleStatus.msg
VehicleThrustSetpoint.msg
VehicleTorqueSetpoint.msg
VehicleTrajectoryBezier.msg
VehicleTrajectoryWaypoint.msg
VelocityLimits.msg
VtolVehicleStatus.msg
WheelEncoders.msg
Wind.msg
YawEstimatorStatus.msg
versioned/ActuatorMotors.msg
versioned/ActuatorServos.msg
versioned/ArmingCheckReply.msg
versioned/ArmingCheckRequest.msg
versioned/BatteryStatus.msg
versioned/ConfigOverrides.msg
versioned/GotoSetpoint.msg
versioned/HomePosition.msg
versioned/ManualControlSetpoint.msg
versioned/ModeCompleted.msg
versioned/RegisterExtComponentReply.msg
versioned/RegisterExtComponentRequest.msg
versioned/TrajectorySetpoint.msg
versioned/UnregisterExtComponent.msg
versioned/VehicleAngularVelocity.msg
versioned/VehicleAttitude.msg
versioned/VehicleAttitudeSetpoint.msg
versioned/VehicleCommandAck.msg
versioned/VehicleCommand.msg
versioned/VehicleControlMode.msg
versioned/VehicleGlobalPosition.msg
versioned/VehicleLandDetected.msg
versioned/VehicleLocalPosition.msg
versioned/VehicleOdometry.msg
versioned/VehicleRatesSetpoint.msg
versioned/VehicleStatus.msg
versioned/VtolVehicleStatus.msg
)
list(SORT msg_files)

Expand Down Expand Up @@ -315,7 +315,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
Expand All @@ -336,7 +336,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--json
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_source_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
Expand Down Expand Up @@ -374,7 +374,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${ucdr_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr
DEPENDS
Expand All @@ -396,7 +396,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--sources
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_source_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
Expand Down Expand Up @@ -447,7 +447,13 @@ if(CONFIG_LIB_CDRSTREAM)
# Copy .msg files
foreach(msg_file ${msg_files})
get_filename_component(msg ${msg_file} NAME_WE)
configure_file(${PX4_SOURCE_DIR}/msg/${msg}.msg ${idl_out_path}/${msg}.msg COPYONLY)
get_filename_component(msg_directory ${msg_file} DIRECTORY)
get_filename_component(msg_directory ${msg_directory} NAME)
if(msg_directory STREQUAL "versioned")
configure_file(${PX4_SOURCE_DIR}/msg/${msg_directory}/${msg}.msg ${idl_out_path}/${msg}.msg COPYONLY)
else()
configure_file(${PX4_SOURCE_DIR}/msg/${msg}.msg ${idl_out_path}/${msg}.msg COPYONLY)
endif()
list(APPEND uorb_cdr_idl ${idl_out_path}/${msg}.idl)
list(APPEND uorb_cdr_msg ${idl_out_path}/${msg}.msg)
list(APPEND uorb_cdr_idl_uorb ${idl_uorb_path}/${msg}.h)
Expand Down Expand Up @@ -492,7 +498,7 @@ if(CONFIG_LIB_CDRSTREAM)
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}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${idl_uorb_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream
DEPENDS
Expand Down
3 changes: 3 additions & 0 deletions msg/ActuatorMotors.msg → msg/versioned/ActuatorMotors.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Motor control message

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp the data this control response is based on was sampled

Expand Down
3 changes: 3 additions & 0 deletions msg/ActuatorServos.msg → msg/versioned/ActuatorServos.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Servo control message

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp the data this control response is based on was sampled

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

uint8 request_id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

# broadcast message to request all registered arming checks to be reported
Expand Down
2 changes: 2 additions & 0 deletions msg/BatteryStatus.msg → msg/versioned/BatteryStatus.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
bool connected # Whether or not a battery is connected, based on a voltage threshold
float32 voltage_v # Battery voltage in volts, 0 if unknown
Expand Down
3 changes: 3 additions & 0 deletions msg/ConfigOverrides.msg → msg/versioned/ConfigOverrides.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Configurable overrides by (external) modes or mode executors

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

bool disable_auto_disarm # Prevent the drone from automatically disarming after landing (if configured)
Expand Down
2 changes: 2 additions & 0 deletions msg/GotoSetpoint.msg → msg/versioned/GotoSetpoint.msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Unset optional setpoints are not controlled
# Unset optional constraints default to vehicle specifications

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

# setpoints
Expand Down
2 changes: 2 additions & 0 deletions msg/HomePosition.msg → msg/versioned/HomePosition.msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GPS home position in WGS84 coordinates.

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

float64 lat # Latitude in degrees
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp of the raw data (microseconds)

Expand Down
3 changes: 3 additions & 0 deletions msg/ModeCompleted.msg → msg/versioned/ModeCompleted.msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# The possible values of nav_state are defined in the VehicleStatus msg.
# Note that this is not always published (e.g. when a user switches modes or on
# failsafe activation)

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

uint64 request_id # ID from the request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Request to register an external component

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

uint64 request_id # ID, set this to a random value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Needs to be kinematically consistent and feasible for smooth flight.
# setting a value to NaN means the state should not be controlled

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

# NED local world frame
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

char[25] name # either the mode name, or component name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # timestamp of the data sample on which this message is based (microseconds)
Expand Down
2 changes: 2 additions & 0 deletions msg/VehicleAttitude.msg → msg/versioned/VehicleAttitude.msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This is similar to the mavlink message ATTITUDE_QUATERNION, but for onboard use
# The quaternion uses the Hamilton convention, and the order is q(w, x, y, z)

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

uint64 timestamp_sample # the timestamp of the raw data (microseconds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

float32 yaw_sp_move_rate # rad/s (commanded by user)
Expand Down
2 changes: 2 additions & 0 deletions msg/VehicleCommand.msg → msg/versioned/VehicleCommand.msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Vehicle Command uORB message. Used for commanding a mission / action / etc.
# Follows the MAVLink COMMAND_INT / COMMAND_LONG definition

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

uint16 VEHICLE_CMD_CUSTOM_0 = 0 # test command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Used for acknowledging the vehicle command being received.
# Follows the MAVLink COMMAND_ACK message definition

uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)

# Result cases. This follows the MAVLink MAV_RESULT enum definition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0

uint64 timestamp # time since system start (microseconds)
bool flag_armed # synonym for actuator_armed.armed

Expand Down
Loading
Loading