Servers by jDrones

Suggestion: New MAVLink Message for a sensor value array

(Peter) #1

Hi!
For a project I need to send a message containing 1 timestamp and a number of sensor data values (magnetic induction in my case), which have a sufficiently precise sample rate (50 Hz in my case), so that each value can be assigned with a timestamp. I added this to my own ArduCopter code.

Do you think a message of this kind is useful to others too, so I should do some changes to it and add it to the official ardupilotmega dialect, if the community thinks, it’s adequate? Or do you think this use case is too custom built?

My message (which in this state is for internal use only and open to improvement) is specified by:

message name: CSMAG0
dialect: ardupilotmega
message id# 240
fields:
time_usec uint64_t timestamp
induction int32_t[N] magnetic induction values

N ::= 1 … 62 (I chose N=10 for now)

to Ardupilotmega.xml I added:

<message id=“240” name=“CSMAG0”>

<description>Magnetometer sensor data</description>

<field type=“uint64_t” name=“time_usec” units=“us”>Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.</field>

<field type=“int32_t[10]” name=“induction”>Measured magnetic induction values, which can be converted into magnetic induction in Nanoteslas.</field>

</message>

In case this message is useful, I would generalize it to “sensor values” or something like that, and of course change the name. At this point I’m also not sure, what to do with N for a generalized message.

(Andre-K) #2

Have you seen the already defined, DATA* packets ?

(Peter) #3

yeah, it would have been possible with that, too.
However then I would have needed to implement my required data structure (time stamp and N 32 bit values) in this DATA64 message of raw bytes, for example.