I want to submit my gains for the PID regulator via MAVLink. Unfortunately, I am not very used to MAVLink and there are several functions which may be used for that purpose (I think). My string is currently JSON formatted and I was directly sending it to the serial port before.
Is there a straight forward way to submit the data like it is (see below) with MAVLink, or is it better not to transfer a JSON string with MAVLink and submit each single value? If yes, what is the function of choice.
So far I noticed that for most of the sensors, there are already MAVLink function defined. For the PID gains I found not so much.
AP_HAL::UARTDriver *pOut = uartX == UART_C ? hal.uartC : hal.uartA;
pOut->printf( "{\"t\":\"pid_cnf\","
"\"p_rkp\":%.2f,\"p_rki\":%.2f,\"p_rkd\":%.4f,\"p_rimax\":%.2f,"
"\"r_rkp\":%.2f,\"r_rki\":%.2f,\"r_rkd\":%.4f,\"r_rimax\":%.2f,"
"\"y_rkp\":%.2f,\"y_rki\":%.2f,\"y_rkd\":%.4f,\"y_rimax\":%.2f,"
"\"p_skp\":%.2f,\"r_skp\":%.2f,\"y_skp\":%.4f}\n",
static_cast<double>(pit_rkp), static_cast<double>(pit_rki), static_cast<double>(pit_rkd), static_cast<double>(pit_rimax),
static_cast<double>(rol_rkp), static_cast<double>(rol_rki), static_cast<double>(rol_rkd), static_cast<double>(rol_rimax),
static_cast<double>(yaw_rkp), static_cast<double>(yaw_rki), static_cast<double>(yaw_rkd), static_cast<double>(yaw_rimax),
static_cast<double>(pit_skp), static_cast<double>(rol_skp), static_cast<double>(yaw_skp) );