本文整理汇总了C++中UAS::update_capabilities方法的典型用法代码示例。如果您正苦于以下问题:C++ UAS::update_capabilities方法的具体用法?C++ UAS::update_capabilities怎么用?C++ UAS::update_capabilities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UAS
的用法示例。
在下文中一共展示了UAS::update_capabilities方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autopilot_version_cb
void autopilot_version_cb(const ros::TimerEvent &event) {
bool ret = false;
try {
auto client = nh.serviceClient<mavros::CommandLong>("cmd/command");
mavros::CommandLong cmd{};
cmd.request.command = MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES;
cmd.request.confirmation = false;
cmd.request.param1 = 1.0;
ROS_DEBUG_NAMED("sys", "VER: Sending request.");
ret = client.call(cmd);
}
catch (ros::InvalidNameException &ex) {
ROS_ERROR_NAMED("sys", "VER: %s", ex.what());
}
ROS_ERROR_COND_NAMED(!ret, "sys", "VER: command plugin service call failed!");
if (version_retries > 0) {
version_retries--;
ROS_WARN_COND_NAMED(version_retries != RETRIES_COUNT - 1, "sys",
"VER: request timeout, retries left %d", version_retries);
}
else {
uas->update_capabilities(false);
autopilot_version_timer.stop();
ROS_WARN_NAMED("sys", "VER: your FCU don't support AUTOPILOT_VERSION, "
"switched to default capabilities");
}
}
示例2: handle_autopilot_version
void handle_autopilot_version(const mavlink_message_t *msg, uint8_t sysid, uint8_t compid) {
mavlink_autopilot_version_t apv;
mavlink_msg_autopilot_version_decode(msg, &apv);
autopilot_version_timer.stop();
uas->update_capabilities(true, apv.capabilities);
// Note based on current APM's impl.
// APM uses custom version array[8] as a string
ROS_INFO_NAMED("sys", "VER: Capabilities 0x%016llx", (long long int)apv.capabilities);
ROS_INFO_NAMED("sys", "VER: Flight software: %08x (%*s)",
apv.flight_sw_version,
8, apv.flight_custom_version);
ROS_INFO_NAMED("sys", "VER: Middleware software: %08x (%*s)",
apv.middleware_sw_version,
8, apv.middleware_custom_version);
ROS_INFO_NAMED("sys", "VER: OS software: %08x (%*s)",
apv.os_sw_version,
8, apv.os_custom_version);
ROS_INFO_NAMED("sys", "VER: Board hardware: %08x", apv.board_version);
ROS_INFO_NAMED("sys", "VER: VID/PID: %04x:%04x", apv.vendor_id, apv.product_id);
ROS_INFO_NAMED("sys", "VER: UID: %016llx", (long long int)apv.uid);
}