[SITL-Gazebo] Custom Mavlink Message Support

Hi there, hope everyone is doing well. I have some issues regarding custom MAVLINK messages to and from gazebo.

According to the documentations on MAVLink Messaging | PX4 User Guide it has helped me to create MAVLINK messages to send, receive and handle.

However, for gazebo-SITL purposes, I’ve seen that gazebo-SITL does not have much documentations and the only MAVLINK messages are in Simulation | PX4 User Guide After messing around with trying to send and receive between PX4 (simulator_mavlink.cpp) and gazebo (gazebo_mavlink_interface.cpp & mavlink_interface.cpp) I am unable to pass a new message and besides not being able to send and receive, it led to a poll timeout. ERROR [simulator] poll timeout 0, 22

For my steps on how I did my integration :

  • From PX4 to Gazebo, I’ve added mavlink header to simulator_mavlink.cpp, added send_message function to Simulator::send() and calls it with send_controls();

  • In mavlink_interface, I am not able to find the msg->msgid of the mavlink message that I’ve sent.

  • Vice versa, from gazebo to simulator_mavlink to handle the message, (message is basic) mavlink_msg_basic_encode_chan(1, 0, MAVLINK_COMM_0, &msg, &basic_msg); encode the data and after sending, it stills gets the poll timeout.

Really do hope for any help and leads on this! :slight_smile: