Auterion / px4-ros2-interface-lib

Library to interface with PX4 from a companion computer using ROS 2
BSD 3-Clause "New" or "Revised" License
68 stars 21 forks source link

scripts: add script to compare message sets #51

Closed GuillaumeLaine closed 3 months ago

GuillaumeLaine commented 3 months ago

Adds a script to compare the message definition sets of two repos

Example Usage

To determine if the px4-ros2 library is compatible with a specific version of PX4 when it depends on a particular version of px4_msgs:

$ ./scripts/check-message-compatibility.py ../px4_msgs/ ../APX4/

Case: Compatible (verbose)

$ ./scripts/check-message-compatibility.py -v ../px4_msgs/ ../APX4/
Checking the following message files:

  - ActuatorMotors.msg
  - ActuatorServos.msg
  - ArmingCheckReply.msg
  - ArmingCheckRequest.msg
  - ConfigOverrides.msg
  - GotoSetpoint.msg
  - ManualControlSetpoint.msg
  - ModeCompleted.msg
  - RegisterExtComponentReply.msg
  - RegisterExtComponentRequest.msg
  - TrajectorySetpoint.msg
  - UnregisterExtComponent.msg
  - VehicleAngularVelocity.msg
  - VehicleAttitude.msg
  - VehicleAttitudeSetpoint.msg
  - VehicleCommand.msg
  - VehicleCommandAck.msg
  - VehicleControlMode.msg
  - VehicleGlobalPosition.msg
  - VehicleLocalPosition.msg
  - VehicleOdometry.msg
  - VehicleRatesSetpoint.msg
  - VehicleStatus.msg

OK! Messages are compatible.

Case: Incompatbile (verbose)

$ ./scripts/check-message-compatibility.py -v ../px4_msgs/ ../APX4/
Checking the following message files:

  - ActuatorMotors.msg
  - ActuatorServos.msg
  - ArmingCheckReply.msg
  - ArmingCheckRequest.msg
  - ConfigOverrides.msg
  - GotoSetpoint.msg
  - ManualControlSetpoint.msg
  - ModeCompleted.msg
  - RegisterExtComponentReply.msg
  - RegisterExtComponentRequest.msg
  - TrajectorySetpoint.msg
  - UnregisterExtComponent.msg
  - VehicleAngularVelocity.msg
  - VehicleAttitude.msg
  - VehicleAttitudeSetpoint.msg
  - VehicleCommand.msg
  - VehicleCommandAck.msg
  - VehicleControlMode.msg
  - VehicleGlobalPosition.msg
  - VehicleLocalPosition.msg
  - VehicleOdometry.msg
  - VehicleRatesSetpoint.msg
  - VehicleStatus.msg

Mismatch found between ../px4_msgs//msg/VehicleGlobalPosition.msg and ../APX4//msg/VehicleGlobalPosition.msg:
--- ../px4_msgs//msg/VehicleGlobalPosition.msg
+++ ../APX4//msg/VehicleGlobalPosition.msg
@@ -22,7 +22,6 @@

 float32 terrain_alt        # Terrain altitude WGS84, (metres)
 bool terrain_alt_valid     # Terrain altitude estimate is valid
-float32 my_other_field

 bool dead_reckoning        # True if this position is estimated through dead-reckoning

Mismatch found between ../px4_msgs//msg/VehicleLocalPosition.msg and ../APX4//msg/VehicleLocalPosition.msg:
--- ../px4_msgs//msg/VehicleLocalPosition.msg
+++ ../APX4//msg/VehicleLocalPosition.msg
@@ -45,7 +45,6 @@
 bool heading_good_for_control

 float32 tilt_var
-uint8 my_new_field

 # Position of reference point (local NED frame origin) in global (GPS / WGS84) frame
 bool xy_global             # true if position (x, y) has a valid global reference (ref_lat, ref_lon)

Note: The printed diff includes all content differences. The computed check is less sensitive to formatting and comments.

FAILED! Some files differ:
  - VehicleGlobalPosition.msg
  - VehicleLocalPosition.msg