SMACC2
Loading...
Searching...
No Matches
cb_obstacle_guard.cpp
Go to the documentation of this file.
1// Copyright 2026 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
22
23namespace cl_px4_mr
24{
25
27
29
31{
33 if (guard_ == nullptr)
34 {
35 RCLCPP_ERROR(
36 getLogger(), "CbObstacleGuard: CpForwardObstacleGuard not found - obstacle events disabled");
37 return;
38 }
39 // start from a clean slate: whatever the cone saw before this behavior
40 // existed (the ground while on the pad, walls swept during a turn) is not a
41 // detection; a real obstacle re-triggers within a couple of clouds
42 guard_->reset();
45 RCLCPP_INFO(getLogger(), "CbObstacleGuard: armed");
46}
47
48void CbObstacleGuard::onExit() { RCLCPP_INFO(getLogger(), "CbObstacleGuard: disarmed"); }
49
51{
52 if (postTooClose_)
53 {
55 }
56}
57
59{
60 if (postCleared_)
61 {
63 }
64}
65
66} // namespace cl_px4_mr
CpForwardObstacleGuard * guard_
std::function< void()> postTooClose_
std::function< void()> postCleared_
smacc2::SmaccSignalConnection onObstacleTooClose(void(T::*callback)(), T *object)
smacc2::SmaccSignalConnection onObstacleCleared(void(T::*callback)(), T *object)
virtual rclcpp::Logger getLogger() const
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)