| 138 | } |
| 139 | |
| 140 | bool RemoteControl::waitForNextStepCommon(const std::string& caption, bool autonomous) |
| 141 | { |
| 142 | std::unique_lock<std::mutex> wait_lock(mutex_); |
| 143 | |
| 144 | // Check if we really need to wait |
| 145 | if (next_step_ready_ || autonomous || !rclcpp::ok()) |
| 146 | { |
| 147 | return true; |
| 148 | } |
| 149 | |
| 150 | // Show message |
| 151 | { |
| 152 | RCLCPP_INFO_STREAM(logger_, CONSOLE_COLOR_CYAN << "Waiting to continue: " << caption |
| 153 | << CONSOLE_COLOR_RESET); |
| 154 | } |
| 155 | |
| 156 | if (displayWaitingState_) |
| 157 | { |
| 158 | displayWaitingState_(true); |
| 159 | } |
| 160 | |
| 161 | is_waiting_ = true; |
| 162 | |
| 163 | // Wait until next step is ready |
| 164 | wait_next_step_.wait(wait_lock, [this]() { return next_step_ready_ || !rclcpp::ok(); }); |
| 165 | RCLCPP_INFO_STREAM(logger_, CONSOLE_COLOR_CYAN << "... continuing" << CONSOLE_COLOR_RESET); |
| 166 | |
| 167 | if (displayWaitingState_) |
| 168 | { |
| 169 | displayWaitingState_(false); |
| 170 | } |
| 171 | |
| 172 | next_step_ready_ = false; |
| 173 | is_waiting_ = false; |
| 174 | |
| 175 | return true; |
| 176 | } |
| 177 | |
| 178 | } // namespace rviz_visual_tools |
nothing calls this directly
no outgoing calls
no test coverage detected