Skip to content

Commit

Permalink
fixed cntrl & tracker switching while rc mode active
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Aug 22, 2024
1 parent 647b7b6 commit f3d5d5d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/control_manager/control_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6950,6 +6950,8 @@ void ControlManager::bumperPushFromObstacle(void) {

if (!bumper_repulsing_) {

bumper_repulsing_ = true;

if (_bumper_switch_tracker_) {

auto active_tracker_idx = mrs_lib::get_mutexed(mutex_tracker_list_, active_tracker_idx_);
Expand Down Expand Up @@ -6979,8 +6981,6 @@ void ControlManager::bumperPushFromObstacle(void) {
}
}

bumper_repulsing_ = true;

callbacks_enabled_ = false;

mrs_msgs::ReferenceSrvResponse::ConstPtr tracker_response;
Expand Down Expand Up @@ -8075,7 +8075,9 @@ std::tuple<bool, std::string> ControlManager::switchTracker(const std::string& t
return std::tuple(false, ss.str());
}

if (rc_goto_active_) {
if (rc_goto_active_ && tracker_name != _ehover_tracker_name_ && tracker_name != _landoff_tracker_name_ && tracker_name != _null_tracker_name_ &&
!bumper_repulsing_) {

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());
Expand Down Expand Up @@ -8215,7 +8217,9 @@ std::tuple<bool, std::string> ControlManager::switchController(const std::string
return std::tuple(false, ss.str());
}

if (rc_goto_active_) {
if (rc_goto_active_ && controller_name != _failsafe_controller_name_ && controller_name != _eland_controller_name_ &&
controller_name != _bumper_controller_name_ && !bumper_repulsing_) {

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());
Expand Down

0 comments on commit f3d5d5d

Please sign in to comment.