Skip to content

set_string parameter type mismatch #1124

@laol-tomsk

Description

@laol-tomsk

As far as I understand, Message::set_string is a tool to fill string fields in messages. I tried using it to fill vendor_name and model_name in CAMERA_INFORMATION, and it looks like it's supposed to be done like this:

mavlink::common::msg::CAMERA_INFORMATION resp_msg{};
mavlink::set_string(resp_msg.vendor_name, std::string("Vendor Name"));
mavlink::set_string(resp_msg.model_name, std::string("Model Name"));

However, it does not work, because vendor_name and model_name in CAMERA_INFORMATION are both of type std::array<unsigned char, 32>&, while set_string needs its first argument to be std::array<char, _N> &a (i.e. unsigned char vs. char).

Shouldn't set_string accept std::array<unsigned char, _N> as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions