diff --git a/src/drone_controls/src/PositionChanger.cpp b/src/drone_controls/src/PositionChanger.cpp index 3bc2669c..4779db1f 100644 --- a/src/drone_controls/src/PositionChanger.cpp +++ b/src/drone_controls/src/PositionChanger.cpp @@ -315,10 +315,10 @@ public: void handle_height_message(const drone_services::msg::HeightData::SharedPtr message) { - this->current_height = message->height; + this->current_height = message->min_height; if (!this->got_ready_drone_request) { - this->start_height = message->height; + this->start_height = message->min_height; } if (this->is_landing) { @@ -508,6 +508,7 @@ private: rclcpp::Publisher::SharedPtr failsafe_publisher; rclcpp::Subscription::SharedPtr lidar_subscription; rclcpp::Subscription::SharedPtr odometry_subscription; + rclcpp::Subscription::SharedPtr height_subscription; rclcpp::Client::SharedPtr trajectory_client; rclcpp::Client::SharedPtr attitude_client; @@ -535,6 +536,7 @@ private: float current_height = 0; float start_height = -1; bool is_landing = false; + bool has_landed = false; bool move_direction_allowed[4] = {true}; // whether the drone can move in a certain direction float collision_prevention_weights[4] = {0}; // the amount to move away from an object in a certain direction if the drone is too close bool failsafe_enabled = false;