0

I'm using mavlink with a pixhawk flight controller. I receive messages from heartbeat thought I don't know how to receive information about it's altitude, pitch, roll or yaw. When I connect pixhawk through qgroundcontrol application I immediately connected and can see the direction on compass, yet I don't know how to replicate that. The information I'm specificallly looking for can be received by getting a return from messages: msg_vfr_hud.MAVLINK_MSG_ID_VFR_HUD, msg_ahrs2.MAVLINK_MSG_ID_AHRS2, msg_ahrs3.MAVLINK_MSG_ID_AHRS3.

I tried creating them like that:

    msg_ahrs2 msg = new msg_ahrs2();
    communicationService.pushMavLinkMessage(msg);

But I don't receive any information back. Do I have to make any preflight configuration? Any help will be appreciated.

Artemis
  • 271
  • 1
  • 2
  • 8

1 Answers1

1

When the connection is established between the flight controller and companion board, the flight controller will automatically start sending telemetry messages (like GPS information ..).

The connection between the flight controller and the companion board is either serial or by socket (TCP/UDP) so you should handle the incoming data correctly and use mavlink_parse_char function to get mavlink packet format.

You can use dronekit (A python API) , Ottofly (C++ API) or you can build your own one to get and send data to flight controller.

Check this example in C for Udp connection.

Soubhi M. Hadri
  • 133
  • 1
  • 15