Skip to content

Commit

Permalink
Merge pull request #1703 from amilcarlucas/remove-deprecated-battery2
Browse files Browse the repository at this point in the history
sys_status.cpp: remove deprecated BATTERY2 mavlink message support
  • Loading branch information
vooon committed Feb 16, 2022
2 parents 8548237 + 7817e88 commit b70b2e9
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions mavros/src/plugins/sys_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ class SystemStatusPlugin : public plugin::PluginBase
state_pub = nh.advertise<mavros_msgs::State>("state", 10, true);
extended_state_pub = nh.advertise<mavros_msgs::ExtendedState>("extended_state", 10);
batt_pub = nh.advertise<BatteryMsg>("battery", 10);
batt2_pub = nh.advertise<BatteryMsg>("battery2", 10);
estimator_status_pub = nh.advertise<mavros_msgs::EstimatorStatus>("estimator_status", 10);
statustext_pub = nh.advertise<mavros_msgs::StatusText>("statustext/recv", 10);
statustext_sub = nh.subscribe("statustext/send", 10, &SystemStatusPlugin::statustext_cb, this);
Expand All @@ -515,7 +514,6 @@ class SystemStatusPlugin : public plugin::PluginBase
make_handler(&SystemStatusPlugin::handle_extended_sys_state),
make_handler(&SystemStatusPlugin::handle_battery_status),
make_handler(&SystemStatusPlugin::handle_estimator_status),
make_handler(&SystemStatusPlugin::handle_battery2),
};
}

Expand All @@ -534,7 +532,6 @@ class SystemStatusPlugin : public plugin::PluginBase
ros::Publisher state_pub;
ros::Publisher extended_state_pub;
ros::Publisher batt_pub;
ros::Publisher batt2_pub;
ros::Publisher estimator_status_pub;
ros::Publisher statustext_pub;
ros::Subscriber statustext_sub;
Expand Down Expand Up @@ -798,19 +795,6 @@ class SystemStatusPlugin : public plugin::PluginBase
batt_pub.publish(batt_msg);
}

void handle_battery2(const mavlink::mavlink_message_t *msg, mavlink::ardupilotmega::msg::BATTERY2 &batt) {
float volt = batt.voltage / 1000.0f; // mV
float curr = batt.current_battery / 100.0f; // 10 mA or -1

auto batt_msg = boost::make_shared<BatteryMsg>();
batt_msg->header.stamp = ros::Time::now();

batt_msg->voltage = volt;
batt_msg->current = curr;

batt2_pub.publish(batt_msg);
}

void handle_statustext(const mavlink::mavlink_message_t *msg, mavlink::common::msg::STATUSTEXT &textm)
{
auto text = mavlink::to_string(textm.text);
Expand Down

0 comments on commit b70b2e9

Please sign in to comment.