libs: vehicle: Add PX4 first version#2218
libs: vehicle: Add PX4 first version#2218patrickelectric merged 2 commits intobluerobotics:masterfrom
Conversation
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
| createArduPilotVehicle(heartbeat, system_id, component_id) | ||
| break | ||
| case MavAutopilot.MAV_AUTOPILOT_PX4: | ||
| VehicleFactory.createVehicle(Vehicle.Firmware.PX4, Vehicle.Type.Copter, system_id) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
@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. |
|
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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.
Allows PX4 firmware to be connected in Cockpit