Skip to content

Commit

Permalink
fxd ctrl & trck swtching while rc joystic active
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Aug 29, 2024
1 parent 9736826 commit bb1a7e7
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/control_manager/control_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4181,6 +4181,19 @@ bool ControlManager::callbackSwitchTracker(mrs_msgs::String::Request& req, mrs_m
return true;
}

if (rc_goto_active_) {

std::stringstream ss;
ss << "can not switch tracker, RC joystick is active";

res.message = ss.str();
res.success = false;

ROS_WARN_STREAM("[ControlManager]: " << ss.str());

return true;
}

auto [success, response] = switchTracker(req.value);

res.success = success;
Expand Down Expand Up @@ -4212,6 +4225,19 @@ bool ControlManager::callbackSwitchController(mrs_msgs::String::Request& req, mr
return true;
}

if (rc_goto_active_) {

std::stringstream ss;
ss << "can not switch controller, RC joystick is active";

res.message = ss.str();
res.success = false;

ROS_WARN_STREAM("[ControlManager]: " << ss.str());

return true;
}

auto [success, response] = switchController(req.value);

res.success = success;
Expand Down Expand Up @@ -8075,12 +8101,6 @@ std::tuple<bool, std::string> ControlManager::switchTracker(const std::string& t
return std::tuple(false, ss.str());
}

if (rc_goto_active_) {
ss << "can not switch tracker, the RC joystick is active";
ROS_WARN_STREAM_THROTTLE(1.0, "[ControlManager]: " << ss.str());
return std::tuple(false, ss.str());
}

auto new_tracker_idx = idxInVector(tracker_name, _tracker_names_);

// check if the tracker exists
Expand Down Expand Up @@ -8215,12 +8235,6 @@ std::tuple<bool, std::string> ControlManager::switchController(const std::string
return std::tuple(false, ss.str());
}

if (rc_goto_active_) {
ss << "can not switch controller, the RC joystick is active";
ROS_WARN_STREAM_THROTTLE(1.0, "[ControlManager]: " << ss.str());
return std::tuple(false, ss.str());
}

auto new_controller_idx = idxInVector(controller_name, _controller_names_);

// check if the controller exists
Expand Down

0 comments on commit bb1a7e7

Please sign in to comment.