Skip to content

Switch aux_global_position to AuxGlobalPosition message type#180

Merged
bkueng merged 4 commits intomainfrom
agp_interface
Feb 20, 2026
Merged

Switch aux_global_position to AuxGlobalPosition message type#180
bkueng merged 4 commits intomainfrom
agp_interface

Conversation

@haumarco
Copy link
Copy Markdown
Contributor

@haumarco haumarco commented Feb 17, 2026

Summary

  • Migrate GlobalPositionMeasurementInterface from VehicleGlobalPosition to the new AuxGlobalPosition message type for the aux_global_position topic
  • API change: The constructor now takes id and source parameters to populate the new message fields. Both have defaults (id=1, source=SOURCE_VISION), so existing code compiles without changes but should be updated to set meaningful values.
  // Before
  GlobalPositionMeasurementInterface(node);
  // After
  GlobalPositionMeasurementInterface(node, id=1, source=2);
  • PX4 uses the id field to demultiplex measurements from multiple external positioning sources on the same topic

@haumarco haumarco requested a review from bkueng February 17, 2026 14:16
Comment on lines +100 to +101
uint8_t _id;
uint8_t _source;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
uint8_t _id;
uint8_t _source;
const uint8_t _id;
const uint8_t _source;

class GlobalPositionMeasurementInterface : public PositionMeasurementInterfaceBase {
public:
explicit GlobalPositionMeasurementInterface(rclcpp::Node& node,
explicit GlobalPositionMeasurementInterface(rclcpp::Node& node, uint8_t id = 1,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you add API docs for the extra args and describe how to set them?
Is the id not starting with 0?

And as a user I'd ask myself why do I have to set both source and id if they are just integers? Can't one be inferred from the other?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GitBook PR

  • ID is not starting at 0. Zero is the default value of unpopulated params for unused sensors
  • The source type is propagated to downstream consumers in messages derived from this data. So mavlink etc want to know what the source type is. We decided against an ID "pattern" to store this knowledge in the ID. You can have multiple instances with the same source-type.

@haumarco haumarco marked this pull request as ready for review February 19, 2026 16:56
@haumarco
Copy link
Copy Markdown
Contributor Author

@bkueng Any other feedback? CI is failing because the PR with AuxGlobalPosition message is not yet merged, but it's a chicken and egg problem.

/**
* @param id Unique identifier non-zero for this position source. PX4 uses this to demultiplex
* measurements from multiple external positioning sources on the same topic.
* @param source Source type of the position data, using AuxGlobalPosition::SOURCE_*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be good to change this to an enum then (defined here), which would make it easier to use.

enum class SourceType {
   Vision = AuxGlobalPosition::SOURCE_VISION,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The enum is defined in the AuxGlobalPosition message, do we really want to have duplicated enums?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

after discussion. yes it makes sense to use it

@bkueng bkueng merged commit cc90bb6 into main Feb 20, 2026
2 of 4 checks passed
@bkueng bkueng deleted the agp_interface branch February 20, 2026 15:03
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