I am wondering what the best way to communicate a scalar value between an arduino and pixhawk would be.
I would like to use this value in the control_allocator, so it would have to be broadcast by the arduino to the pixhawk at least as fast as the control allocator module is running.
Does anyone have any advice on how to do this ?
Sending a value via MAVLink would work. Choose a message (or add one) and implement it end to end.
And if you want it fast enough, make sure the baudrate is high enough, although for one value that shouldn’t be too much of a problem, unless you chose to use one of the ancient 8bit ATMEGA 328p Arduinos. I can assure you they create a lot of headache because they are quite slow compared to any STM32 used these days, and they don’t even have enough flash space to comfortably host MAVLink, unless you save flash space by removing most messages, so that the CRC_EXTRA table is smaller.
Thank you very much for your reply. I can’t find any example code that does this. Would you be able to provide any ?
There are examples out there: