@@ -23,6 +23,8 @@ LandPlanner::LandPlanner(
2323 landing_detected_message_received_(false ),
2424 transform_wrapper_(),
2525 state_(LandState::DONE ),
26+ requested_x_(0.0 ),
27+ requested_y_(0.0 ),
2628 requested_height_(0.0 ),
2729 cushion_height_(0.0 ),
2830 actual_descend_rate_(0.0 ),
@@ -44,7 +46,7 @@ LandPlanner::LandPlanner(
4446 " startup_timeout" )),
4547 update_timeout_(ros_utils::ParamUtils::getParam<double >(
4648 private_nh,
47- " update_timeout" )),
49+ " update_timeout" )),
4850 uav_arm_client_(nh.serviceClient<iarc7_msgs::Arm>(" uav_arm" ))
4951{
5052 landing_detected_subscriber_ = nh.subscribe (" landing_detected" ,
@@ -83,10 +85,12 @@ bool LandPlanner::prepareForTakeover(const ros::Time& time)
8385 return false ;
8486 }
8587
86- requested_height_ = transform.transform .translation .z ;
88+ requested_x_ = transform.transform .translation .x ;
89+ requested_y_ = transform.transform .translation .y ;
90+ requested_height_ = transform.transform .translation .z ;
8791
8892 // height determined by the ratio of landing accelerations
89- cushion_height_ = std::min (0.5 * (std::pow (descend_rate_,2 )/cushion_acceleration_),
93+ cushion_height_ = std::min (0.5 * (std::pow (descend_rate_,2 )/cushion_acceleration_),
9094 requested_height_ * ( 1 - ( 1 / ( 1 - descend_acceleration_/cushion_acceleration_))));
9195 actual_descend_rate_ = 0.0 ;
9296
@@ -133,7 +137,7 @@ bool LandPlanner::getTargetMotionPoint(const ros::Time& time,
133137 + (cushion_acceleration_
134138 * (time - last_update_time_).toSec ()));
135139 }
136-
140+
137141 requested_height_ = std::max (0.0 , requested_height_
138142 + (actual_descend_rate_
139143 * (time - last_update_time_).toSec ()));
@@ -169,6 +173,8 @@ bool LandPlanner::getTargetMotionPoint(const ros::Time& time,
169173 // Fill in the uav_command's information
170174 motion_point.header .stamp = time;
171175
176+ motion_point.motion_point .pose .position .x = requested_x_;
177+ motion_point.motion_point .pose .position .y = requested_y_;
172178 motion_point.motion_point .pose .position .z = requested_height_;
173179 motion_point.motion_point .twist .linear .z = actual_descend_rate_;
174180
0 commit comments