i am using a Pixhawk 2.4.6 with ardupilot rover 4.0 and Mission Planner.
I’ve managed to get data from and to Pixhawk over MAVLink via a Teensy 3.5.
I send BATTERY_STATUS, GPS_INPUT, DISTANCE_SENSOR and RPM massages to it. This works fine and all data are displayed correct in MAVLink Inspector.
But there are two issues at this time:
If I send 2 messages from the same type with different ids, only one sensor shows a reaction and changes values between the two massages. (In case of rangefinder, i configured RNGFND1=10 and RNGFND2 = 10) Tried it with same component ID as Pixhawk and with a different. Same result.
- Values from DISTANCE_SESNOR and GPS_INPUT are used by Mission Planner, but BATTERY_STATUS and RPM are ignored.
Does anybody has an advice for me?
The background why i use this exernal sensor data is, that my boat uses 2 digital controlled batteries and a slightly complex GPS/IMU system for exact positions for measurements, that communicates only over RS232. This unit should be used as backup GPS, simply because it’s there. Primary GPS is the Emlid Reach M2.
You need to take the communication direction into account:
- DISTANCE_SENSOR messages can be read and written by Ardupilot
- GPS_INPUT are read-only messages (sensor to the ArduPilot)
- BATTERY_STATUS and RPM sensor are write-only messages (from ArduPilot to GCS)
So unless you change the code to support BATTERY_STATUS and RPM MavLink messages input it will not work.
You could probably use a small AP_Periph board that will do that for you without the need to write a single line of code though. More boards get supported each day.
Thanks for @peterbarker for correcting me on this
Ok ,thank you for the explanation!
I thing changing the code is a large effort for me, because i am not familar with the ardupilot firmware code despite that would be a verry pretty solution.
The solution with a AP board looks a bit complicated, but is think that colud be a future extension to my project.
My other not so cool work-arround idea is to feed a faked battery voltage over a onboard DAC pin from Teensy to Pixhawk and a faked RPM siganl over timer triggered pulses.
DISTANCE_SENSOR goes both ways.
I now corrected and extended my original reply above.