Skip to content

Comments

libs: vehicle: Add PX4 first version#2218

Merged
patrickelectric merged 2 commits intobluerobotics:masterfrom
patrickelectric:px4
Dec 10, 2025
Merged

libs: vehicle: Add PX4 first version#2218
patrickelectric merged 2 commits intobluerobotics:masterfrom
patrickelectric:px4

Conversation

@patrickelectric
Copy link
Member

Allows PX4 firmware to be connected in Cockpit

createArduPilotVehicle(heartbeat, system_id, component_id)
break
case MavAutopilot.MAV_AUTOPILOT_PX4:
VehicleFactory.createVehicle(Vehicle.Firmware.PX4, Vehicle.Type.Copter, system_id)
Copy link
Member

Choose a reason for hiding this comment

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

Does PX4 include the same vehicle type info in the heartbeat, so we can parse and create the proper vehicle based on that?

On the other hand, from what I'm seeing, despite the Vehicle.Type.Copter, the PX4 class is completely generic to any vehicle type, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I plan to specialize it as I go with the development. This at least allows people to connect with cockpit. Future prs will improve the experience

@rafaellehmkuhl
Copy link
Member

@patrickelectric just to align, from the code everything appears to be fine. To be extra careful I will just ask us to wait for the 1.17 stable release to merge it.

@patrickelectric
Copy link
Member Author

since 1.17 was released, can we merge this ?

@rafaellehmkuhl
Copy link
Member

since 1.17 was released, can we merge this ?

Sure! Will take another look tomorrow and if everything's good we can merge it.

console.warn(`Vehicle not supported: ${system_id}/${component_id}: ${heartbeat.autopilot.type}`)
switch (heartbeat.autopilot.type) {
case MavAutopilot.MAV_AUTOPILOT_ARDUPILOTMEGA:
createArduPilotVehicle(heartbeat, system_id, component_id)
Copy link
Member

Choose a reason for hiding this comment

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

One question here: is there a reason why we are creating this dedicated createArduPilotVehicle method instead of using the same VehicleFactory.createVehicle(Vehicle.Firmware.ArduPilot, ...) as it's being used with the PX4?

Copy link
Member

Choose a reason for hiding this comment

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

@patrickelectric it's a minor code organization issue. If you see it as straightforward to, we can fix that now, otherwise we can work on that in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to parse heartbeat.mavtype.type, that makes the code quite big inside this case, is for organization. We can move PX4 to a similar approach in the next PRs.

@patrickelectric patrickelectric merged commit 6a2cb1a into bluerobotics:master Dec 10, 2025
12 checks passed
@ES-Alexander ES-Alexander added the docs-needed Change needs to be documented label Dec 18, 2025
@rafaellehmkuhl rafaellehmkuhl linked an issue Feb 1, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-needed Change needs to be documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add initial support for PX4 vehicles(s)

3 participants