Closed LightningPORTO closed 2 years ago
To send commands you should use command plugin services, so you just need to create service client and perform a call.
Hello Vooon, thanks for your answer.
I am familiar with the sending protocol that MAVROS has implemented, I would like to receive a MAVlink command, not send.
Are there any additional examples you can provide ? Thank you again.
Then simply make handler and provide it to get_subscriptions():
Subscriptions get_subscriptions() override
{
return {
make_handler(&CustomPlugin::handle_command_long)
};
}
@vooon
I'm sorry for reopening this, but, following your example on the handler, can you please give me an example of the callback function?
Any callback example that receives a MAVlink command would do.
Thank you
void CustomPlugin::handle_command_long(const mavlink::mavlink_message_t *msg, mavlink::common::msg::COMMAND_LONG &cmd)
{
if (!m_uas->is_my_target(cmd))
return;
if (cmd.command != 123) {
// not my command
return;
}
// do stuff
}
Issue details
Hello,
I'm currently developing a basic implementation of the MAVlink camera protocol here as a plugin for MAVROS. I have managed to receive incoming msgs, however, I don't know how to receive MAVink commands.
Are there any examples I can get? I haven't found any.
Thank you in advance
MAVROS version and platform
Mavros: 0.18.4 ROS: NOETIC Ubuntu: 20.04
Autopilot type and version
[x] ArduPilot [ ] PX4