Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[navigation] disable takeoff if initial xy pos error is larger than threshold #660

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ namespace aerial_robot_navigation
bool lock_teleop_;
ros::Time force_landing_start_time_;

double takeoff_xy_pos_tolerance_;
double hover_convergent_start_time_;
double hover_convergent_duration_;
double land_check_start_time_;
Expand Down Expand Up @@ -365,6 +366,15 @@ namespace aerial_robot_navigation
{
if(getNaviState() == TAKEOFF_STATE) return;

double pos_x_error = getTargetPos().x() - estimator_->getPos(Frame::COG, estimate_mode_).x();
double pos_y_error = getTargetPos().y() - estimator_->getPos(Frame::COG, estimate_mode_).y();
double pos_xy_error_dist = std::sqrt(pos_x_error * pos_x_error + pos_y_error * pos_y_error);
if(pos_xy_error_dist > takeoff_xy_pos_tolerance_)
sugikazu75 marked this conversation as resolved.
Show resolved Hide resolved
{
ROS_ERROR_STREAM("initial xy error distance: " << pos_xy_error_dist << " is larger than threshold " << takeoff_xy_pos_tolerance_ << ". switch back to ARM_OFF_STATE");
setNaviState(STOP_STATE);
}

if(getNaviState() == ARM_ON_STATE)
{
setNaviState(TAKEOFF_STATE);
Expand Down Expand Up @@ -407,7 +417,8 @@ namespace aerial_robot_navigation
setInitHeight(estimator_->getPos(Frame::COG, estimate_mode_).z());
setTargetYawFromCurrentState();

ROS_INFO_STREAM("init height for takeoff: " << init_height_);
ROS_INFO_STREAM("init height for takeoff: " << init_height_ << ", target height: " << getTargetPos().z());
ROS_INFO_STREAM("target xy pos: " << "[" << getTargetPos().x() << ", " << getTargetPos().y() << "]");

ROS_INFO("Start state");
}
Expand Down
1 change: 1 addition & 0 deletions aerial_robot_control/src/flight_navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ void BaseNavigator::rosParamInit()
land_descend_vel_ == -0.3;
}

getParam<double>(nh, "takeoff_xy_pos_tolerance", takeoff_xy_pos_tolerance_, 0.3);
getParam<double>(nh, "hover_convergent_duration", hover_convergent_duration_, 1.0);
getParam<double>(nh, "land_check_duration", land_check_duration_, 0.5);
if (land_check_duration_ < 0.5) {
Expand Down
Loading