Goal: we want to send custom MAVLink messages from RPi 3 to pixhawk, through Telem2 serial port. This messages have to be used to send information to our AP_Beacon_Bluebeacon.cpp custom class to integrate our BLE positioning system, that extends AP_Beacon_Backend.cpp. We process Beacon data on the RPi and we want to give to the EKF the information about Beacon distances and positions and about vehicle position.
What we did: On the ardupiulot side, we created our custom MAVLink messages inside ardupilotmega.xml in this pathā¦\ardupilot\modules\mavlink\message_definitions\v1.0, while on the RPi side, we added them to the ardupilotmega.xml in pymavlink, we ran setup.py to generate the support code (< our_message >_encode and similar methods) to use them within the DroneKit API. On Pixhawk, we set the parameters like in this guide Communicating with Raspberry Pi via MAVLink ā Dev documentation, just with the baudrate 57600 (because on RPi we set the baudrate with this value) and we have created a new value for the parameter Complete Parameter List ā Copter documentation so that we enabled the use of our new .cpp class (that is correctly compiled and executed).
After these steps, we created a python script, running on RPi, sending messages like this:
msg = vehicle.message_factory.mvl_beacon_init_encode(b_x,b_y,b_z,acc)
vehicle.send_mavlink(msg)
Inside our AP_Beacon_Bluebeacon.cpp class we have
AP_HAL::UARTDriver *uart;
uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_MAVLink, 1);
if(mavlink_parse_char(MAVLINK_COMM_0, received, &msg, &status0)) {
if(msg.msgid == MAVLINK_MSG_ID_MVL_BEACON_INIT) {
mavlink_mvl_beacon_init_t beacon_init;
mavlink_msg_mvl_beacon_init_decode(&msg, &beacon_init);
}
}
Our problems: if we run mavproxy.py on RPi 3, we can communicate (for example, if we type āparam show ARMING_CHECKā, we see the value of the parameter). If we run our python script, sending the message above, we see some MAVLink messages only on Telem1, but nothing on Telem2 (where the RPi is and should be connected).
Our questions: is there a simple way to debug the exchange of messages? Is there some configuration missing? Did we make some mistakes? Did we miss some intermediate passages?
Thanks for your help,
Nicola and team