Enable Pixhawk to Receive MAVLink v2 Framed Messages

I’m currently working on a project where I need to enable Pixhawk to receive MAVLink v2 framed messages. However, I’m encountering some difficulties in implementing this functionality. MAVLink v2 offers significant improvements over v1, especially in terms of efficiency and security, and enabling Pixhawk to handle v2 messages would be extremely beneficial for many projects.

The goal of this issue is to discuss and find a solution or workaround for enabling Pixhawk to receive MAVLink v2 framed messages

Hey @JulianOes,

I’m encountering an issue with sending BATTERY_STATUS. It seems that the extension fields (time_remaining, ChargeState, VoltagesExt, Mode) aren’t reflecting in QGroundcontrol. Do you have any suggestions on how to solve this problem so that they’re properly displayed in QGC?

I have an external BMS that is sending these common.MessageBatteryStatus.
When I am changing the configuration setting in pixhawk to External Battery : func (d *Driver) sendMavBatteryStatusMessage() {
time.Sleep(1500 * time.Microsecond)

for {
	time.Sleep(batteryStatusMessagePeriod)

	// d.status.cell1 := uint16(d.status.voltage / 10)

	msg := &common.MessageBatteryStatus{
		Id:               180,
		BatteryFunction:  common.MAV_BATTERY_FUNCTION_ALL,
		Type:             common.MAV_BATTERY_TYPE_LION,
		Temperature:      d.status.temperature,
		Voltages:         [10]uint16{d.status.cell1, d.status.cell2, d.status.cell3, d.status.cell4, d.status.cell5, d.status.cell6, d.status.cell7, d.status.cell8, d.status.cell9, d.status.cell10},
		CurrentBattery:   d.status.current,
		CurrentConsumed:  d.status.capacityConsumed,
		EnergyConsumed:   d.status.energyConsumed,
		BatteryRemaining: d.status.remaining,
		TimeRemaining:    d.status.timeRemaining,
		ChargeState:      common.MAV_BATTERY_CHARGE_STATE_OK,
		VoltagesExt:      [4]uint16{d.status.cell11, d.status.cell12, d.status.cell13, 0},
		Mode:             common.MAV_BATTERY_MODE_AUTO_DISCHARGING,
	}

	d.node.WriteMessageAll(msg)
}

}

  • All these Values are reflecting in QGC battery Bar (id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining)
  • These values are not reflecting even if I am sending (time_remaining, charge_state, voltages_ext, mode, fault_bitmask), These Values are marked in blue and they are extension field of MAVLink V2 lib.
  • As I am using a 14s battery and time_remaining is critical to RTL, all these fields are important for my project.

I’m so confused. PX4 supports MAVLink v2. If you want to force everything MAVLink v2, just set MAV_PROTO_VER to 2.

Still I am not receiving anything after changing MAV_PROTO_VER to 2.


After changin to V2… rebooted the Vehical
image
image

First of all, PX4 Autopilot supports MAVLink 2; I’m sure that’s not your issue here.

I have a few questions for you

  • What version of PX4 are you running?
  • Can you talk about your setup?
    • How are you connecting your BMS to Pixhawk?
  • When and how are you running the script you posted above?