Seems to be a popular question lately. You probably don’t need a custom message type or class.
If you are compiling your own custom firmware, look at gcs::send_named_float()
.
If you want to avoid custom firmware and use Lua, instead, the following topics discuss ways to use the gcs:send_named_float()
binding via serial or I2C:
Unsupported Sensors? Try Arduino + Lua! - Blog - ArduPilot Discourse