How to use Result mavsdk::MavlinkPassthrough::send_message correctly?

Hi every one.
I sending messege using mavsdk::MavlinkPassthrough. I recive results returned for requests - “Success”. But nothing happening.
For example
GPS_HIL with MAV_USEHILGPS set to 1 in qGC:

void send_GPS_HIL(MavlinkPassthrough& mavlink_passthrough)
{
    mavlink_message_t message;

    mavlink_msg_hil_gps_pack(
                mavlink_passthrough.get_our_sysid(),
                mavlink_passthrough.get_our_compid(),
                &message,
               0,
                3,
                507607300,
                105896370,
                170000,
                UINT16_MAX,
                UINT16_MAX,
                UINT16_MAX,
                0,0,0,0,
                UINT8_MAX,
                0,
                25300
                );
    std::cout << "GPS_HIL SEND: " << mavlink_passthrough.send_message(message)<< std::endl;
}

GPS_INPUT returned Success, but don’t work.

void send_LANDING_TARGET(MavlinkPassthrough& mavlink_passthrough,
                         float angle_x, float angle_y, float distance,
                         float size_x, float size_y,
                         Offboard::PositionNedYaw target){
    mavlink_message_t message;
    float q[4] = {1,0,0,0};

    mavlink_msg_landing_target_pack(
                mavlink_passthrough.get_our_sysid(),
                mavlink_passthrough.get_our_compid(),
                &message,
                0,
                0,
                1,
                angle_x,
                angle_y,
                distance,
                size_x,
                size_y,
                target.north_m,
                target.east_m,
                target.down_m,
                q,
                3,
                1);
    std::cout << "LANDING TARGET SEND: " << mavlink_passthrough.send_message(message)<< std::endl;
}

Landing target returned Success, but don’t work.

What am i missing? Maybe some settings of the PX4 parameters… :thinking:

Thanks!

1 Like

Okey.
If I want transmit GPS_HIL I need:
in qGC

  1. set MAV_USEHILGPS to 1.
  2. (it very strange, because in MAV_USEHILGPS says: “Use HIL GPS message even if not in HIL mode”) set Vehicle Setup → Safety ->HITL Enabled → HITL Enabled.
    But in this mode i need transmit all other HIL messages…

I will investigate further.
Can anyone help?

1 Like

Hi Artem, were you ever able to solve this?

Hi, @gbrawn
I sometimes come back to this problem, but so far I have not found a solution.

I had a similar issue with multiple drones and UTM messages. What solved my issue was whenever I tried to format the outbound message, it would give me problems. Maybe try and subscribe to a similar message and modify that message so the formatting stays close to what MAVLINK likes?
Just a thought, not sure if it’s viable for your issue.