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

scripts: add script to compare message sets #51

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

GuillaumeLaine
Copy link
Collaborator

@GuillaumeLaine GuillaumeLaine commented Aug 6, 2024

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

@GuillaumeLaine GuillaumeLaine marked this pull request as ready for review August 6, 2024 11:30
Copy link
Collaborator

@bkueng bkueng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, very informative output.

Can you also add a note to the README (https://github.com/Auterion/px4-ros2-interface-lib?tab=readme-ov-file#compatibility-with-px4)?

scripts/check-message-compatibility.py Outdated Show resolved Hide resolved
scripts/check-message-compatibility.py Outdated Show resolved Hide resolved
scripts/check-message-compatibility.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@bkueng bkueng merged commit 45e69ad into main Aug 8, 2024
9 checks passed
@bkueng bkueng deleted the add_compatibility_script branch August 8, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants