diff --git a/include/roscontroller.h b/include/roscontroller.h index 7599c58..2972cc1 100644 --- a/include/roscontroller.h +++ b/include/roscontroller.h @@ -11,10 +11,10 @@ #include "mavros_msgs/ExtendedState.h" #include "mavros_msgs/SetMode.h" #include "mavros_msgs/State.h" -#include "mavros_msgs/BatteryStatus.h" #include "mavros_msgs/Mavlink.h" #include "mavros_msgs/PositionTarget.h" #include "sensor_msgs/NavSatStatus.h" +#include "sensor_msgs/BatteryState.h" #include "mavros_msgs/WaypointPush.h" #include "mavros_msgs/Waypoint.h" #include "mavros_msgs/PositionTarget.h" @@ -205,7 +205,7 @@ private: double gps_r_lat); /*battery status callback */ - void battery(const mavros_msgs::BatteryStatus::ConstPtr& msg); + void battery(const sensor_msgs::BatteryState::ConstPtr& msg); /*flight extended status callback*/ void flight_extended_status_update(const mavros_msgs::ExtendedState::ConstPtr& msg); diff --git a/src/buzzuav_closures.cpp b/src/buzzuav_closures.cpp index 364f2f8..a9a06ff 100644 --- a/src/buzzuav_closures.cpp +++ b/src/buzzuav_closures.cpp @@ -400,7 +400,7 @@ int buzzuav_arm(buzzvm_t vm) / Buzz closure to arm /---------------------------------------*/ { - cur_cmd = mavros_msgs::CommandCode::CMD_COMPONENT_ARM_DISARM; + cur_cmd = mavros_msgs::CommandCode::COMPONENT_ARM_DISARM; printf(" Buzz requested Arm \n"); buzz_cmd = COMMAND_ARM; return buzzvm_ret0(vm); @@ -411,7 +411,7 @@ int buzzuav_disarm(buzzvm_t vm) / Buzz closure to disarm /---------------------------------------*/ { - cur_cmd = mavros_msgs::CommandCode::CMD_COMPONENT_ARM_DISARM + 1; + cur_cmd = mavros_msgs::CommandCode::COMPONENT_ARM_DISARM + 1; printf(" Buzz requested Disarm \n"); buzz_cmd = COMMAND_DISARM; return buzzvm_ret0(vm); diff --git a/src/roscontroller.cpp b/src/roscontroller.cpp index 787d85c..15efa1f 100644 --- a/src/roscontroller.cpp +++ b/src/roscontroller.cpp @@ -271,7 +271,7 @@ void roscontroller::GetSubscriptionParameters(ros::NodeHandle& node_handle) m_smTopic_infos.insert(pair(topic, "sensor_msgs/LaserScan")); node_handle.getParam("topics/battery", topic); - m_smTopic_infos.insert(pair(topic, "mavros_msgs/BatteryStatus")); + m_smTopic_infos.insert(pair(topic, "sensor_msgs/BatteryState")); node_handle.getParam("topics/status", topic); m_smTopic_infos.insert(pair(topic, "mavros_msgs/State")); @@ -367,7 +367,7 @@ void roscontroller::Subscribe(ros::NodeHandle& n_c) { flight_status_sub = n_c.subscribe(it->first, 5, &roscontroller::flight_status_update, this); } - else if (it->second == "mavros_msgs/BatteryStatus") + else if (it->second == "sensor_msgs/BatteryState") { battery_sub = n_c.subscribe(it->first, 5, &roscontroller::battery, this); } @@ -682,7 +682,7 @@ script } else ROS_ERROR("Failed to call service from flight controller"); - cmd_srv.request.command = mavros_msgs::CommandCode::CMD_MISSION_START; + cmd_srv.request.command = mavros_msgs::CommandCode::MISSION_START; if (mav_client.call(cmd_srv)) { ROS_INFO("Reply: %ld", (long int)cmd_srv.response.success); @@ -720,7 +720,7 @@ script cmd_srv.request.param2 = gimbal[1]; cmd_srv.request.param3 = gimbal[2]; cmd_srv.request.param4 = gimbal[3]; - cmd_srv.request.command = mavros_msgs::CommandCode::CMD_DO_MOUNT_CONTROL; + cmd_srv.request.command = mavros_msgs::CommandCode::DO_MOUNT_CONTROL; if (mav_client.call(cmd_srv)) { ROS_INFO("Reply: %ld", (long int)cmd_srv.response.success); @@ -836,12 +836,12 @@ void roscontroller::gps_convert_ned(float& ned_x, float& ned_y, double gps_t_lon ned_y = DEG2RAD(d_lon) * EARTH_RADIUS * cos(DEG2RAD(gps_t_lat)); }; -void roscontroller::battery(const mavros_msgs::BatteryStatus::ConstPtr& msg) +void roscontroller::battery(const sensor_msgs::BatteryState::ConstPtr& msg) /* / Update battery status into BVM from subscriber /------------------------------------------------------*/ { - buzzuav_closures::set_battery(msg->voltage, msg->current, msg->remaining); + buzzuav_closures::set_battery(msg->voltage, msg->current, msg->percentage*100.0); // DEBUG // ROS_INFO("voltage : %d current : %d remaining : %d",msg->voltage, // msg->current, msg ->remaining); @@ -1094,8 +1094,8 @@ bool roscontroller::rc_callback(mavros_msgs::CommandLong::Request& req, mavros_m buzzuav_closures::rc_call(rc_cmd); res.success = true; break; - case mavros_msgs::CommandCode::CMD_COMPONENT_ARM_DISARM: - rc_cmd = mavros_msgs::CommandCode::CMD_COMPONENT_ARM_DISARM; + case mavros_msgs::CommandCode::COMPONENT_ARM_DISARM: + rc_cmd = mavros_msgs::CommandCode::COMPONENT_ARM_DISARM; armstate = req.param1; if (armstate) { @@ -1123,10 +1123,10 @@ bool roscontroller::rc_callback(mavros_msgs::CommandLong::Request& req, mavros_m buzzuav_closures::rc_call(rc_cmd); res.success = true; break; - case mavros_msgs::CommandCode::CMD_DO_MOUNT_CONTROL: + case mavros_msgs::CommandCode::DO_MOUNT_CONTROL: ROS_INFO("RC_Call: Gimbal!!!! "); buzzuav_closures::rc_set_gimbal(req.param1, req.param2, req.param3, req.param4, req.param5); - rc_cmd = mavros_msgs::CommandCode::CMD_DO_MOUNT_CONTROL; + rc_cmd = mavros_msgs::CommandCode::DO_MOUNT_CONTROL; buzzuav_closures::rc_call(rc_cmd); res.success = true; break;