19 #include <mavros_msgs/RadioStatus.h> 22 namespace std_plugins {
37 PluginBase::initialize(uas_);
68 void handle_radio_status(
const mavlink::mavlink_message_t *msg, mavlink::common::msg::RADIO_STATUS &rst)
70 has_radio_status =
true;
74 void handle_radio(
const mavlink::mavlink_message_t *msg, mavlink::ardupilotmega::msg::RADIO &rst)
83 template<
typename msgT>
86 if (mmsg->sysid !=
'3' || mmsg->compid !=
'D')
89 auto msg = boost::make_shared<mavros_msgs::RadioStatus>();
93 #define RST_COPY(field) msg->field = rst.field 104 msg->rssi_dbm = (rst.rssi / 1.9) - 127;
105 msg->remrssi_dbm = (rst.remrssi / 1.9) - 127;
115 std::lock_guard<std::mutex> lock(diag_mutex);
125 std::lock_guard<std::mutex> lock(diag_mutex);
131 else if (last_status->rssi < low_rssi)
133 else if (last_status->remrssi < low_rssi)
134 stat.
summary(1,
"Low remote RSSI");
138 stat.
addf(
"RSSI",
"%u", last_status->rssi);
139 stat.
addf(
"RSSI (dBm)",
"%.1f", last_status->rssi_dbm);
140 stat.
addf(
"Remote RSSI",
"%u", last_status->remrssi);
141 stat.
addf(
"Remote RSSI (dBm)",
"%.1f", last_status->remrssi_dbm);
142 stat.
addf(
"Tx buffer (%)",
"%u", last_status->txbuf);
143 stat.
addf(
"Noice level",
"%u", last_status->noise);
144 stat.
addf(
"Remote noice level",
"%u", last_status->remnoise);
145 stat.
addf(
"Rx errors",
"%u", last_status->rxerrors);
146 stat.
addf(
"Fixed",
"%u", last_status->fixed);
MAVROS Plugin base class.
void handle_radio_status(const mavlink::mavlink_message_t *msg, mavlink::common::msg::RADIO_STATUS &rst)
void handle_radio(const mavlink::mavlink_message_t *msg, mavlink::ardupilotmega::msg::RADIO &rst)
#define ROS_WARN_THROTTLE_NAMED(period, name,...)
void publish(const boost::shared_ptr< M > &message) const
void summary(unsigned char lvl, const std::string s)
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
#define UAS_DIAG(uasobjptr)
helper accessor to diagnostic updater
void handle_message(const mavlink::mavlink_message_t *mmsg, msgT &rst)
void initialize(UAS &uas_)
Plugin initializer.
Subscriptions get_subscriptions()
Return vector of MAVLink message subscriptions (handlers)
void addf(const std::string &key, const char *format,...)
PluginBase()
Plugin constructor Should not do anything before initialize()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
mavros_msgs::RadioStatus::Ptr last_status
void connection_cb(bool connected) override
ros::Publisher status_pub
void enable_connection_cb()
std::vector< HandlerInfo > Subscriptions
Subscriptions vector.
void diag_run(diagnostic_updater::DiagnosticStatusWrapper &stat)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
std::recursive_mutex mutex
std::shared_ptr< MAVConnInterface > Ptr