SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
include
cl_px4_mr
client_behaviors
cb_obstacle_guard.hpp
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
21
#pragma once
22
23
#include <functional>
24
25
#include <
cl_px4_mr/components/cp_forward_obstacle_guard.hpp
>
26
#include <
smacc2/smacc_client_behavior.hpp
>
27
28
namespace
cl_px4_mr
29
{
30
31
// Turns CpForwardObstacleGuard's signals into state machine events
32
// EvObstacleTooClose / EvObstacleCleared<CbObstacleGuard, TOrthogonal>.
33
// Synchronous behavior: onEntry runs on the state machine thread, so it may
34
// resolve the component and create signal connections there. Configure it
35
// once on a container state (e.g. the in-flight mode state) so a single
36
// instance covers every inner flight state.
37
class
CbObstacleGuard
:
public
smacc2::SmaccClientBehavior
38
{
39
public
:
40
CbObstacleGuard
();
41
virtual
~CbObstacleGuard
();
42
43
template
<
typename
TOrthogonal,
typename
TSourceObject>
44
void
onStateOrthogonalAllocation
()
45
{
46
postTooClose_
= [
this
]() { this->
postEvent<EvObstacleTooClose<TSourceObject, TOrthogonal>
>(); };
47
postCleared_
= [
this
]() { this->
postEvent<EvObstacleCleared<TSourceObject, TOrthogonal>
>(); };
48
}
49
50
void
onEntry
()
override
;
51
void
onExit
()
override
;
52
53
private
:
54
void
onTooClose
();
55
void
onCleared
();
56
57
CpForwardObstacleGuard
*
guard_
=
nullptr
;
58
std::function<void()>
postTooClose_
;
59
std::function<void()>
postCleared_
;
60
};
61
62
}
// namespace cl_px4_mr
cl_px4_mr::CbObstacleGuard
Definition
cb_obstacle_guard.hpp:38
cl_px4_mr::CbObstacleGuard::~CbObstacleGuard
virtual ~CbObstacleGuard()
Definition
cb_obstacle_guard.cpp:28
cl_px4_mr::CbObstacleGuard::guard_
CpForwardObstacleGuard * guard_
Definition
cb_obstacle_guard.hpp:57
cl_px4_mr::CbObstacleGuard::onEntry
void onEntry() override
Definition
cb_obstacle_guard.cpp:30
cl_px4_mr::CbObstacleGuard::postTooClose_
std::function< void()> postTooClose_
Definition
cb_obstacle_guard.hpp:58
cl_px4_mr::CbObstacleGuard::onExit
void onExit() override
Definition
cb_obstacle_guard.cpp:48
cl_px4_mr::CbObstacleGuard::CbObstacleGuard
CbObstacleGuard()
Definition
cb_obstacle_guard.cpp:26
cl_px4_mr::CbObstacleGuard::onCleared
void onCleared()
Definition
cb_obstacle_guard.cpp:58
cl_px4_mr::CbObstacleGuard::onTooClose
void onTooClose()
Definition
cb_obstacle_guard.cpp:50
cl_px4_mr::CbObstacleGuard::onStateOrthogonalAllocation
void onStateOrthogonalAllocation()
Definition
cb_obstacle_guard.hpp:44
cl_px4_mr::CbObstacleGuard::postCleared_
std::function< void()> postCleared_
Definition
cb_obstacle_guard.hpp:59
cl_px4_mr::CpForwardObstacleGuard
Definition
cp_forward_obstacle_guard.hpp:86
smacc2::ISmaccClientBehavior::postEvent
void postEvent()
Definition
smacc_client_behavior_impl.hpp:45
smacc2::SmaccClientBehavior
Definition
smacc_client_behavior.hpp:27
cp_forward_obstacle_guard.hpp
cl_px4_mr
Definition
cl_px4_mr.hpp:30
smacc_client_behavior.hpp
Generated by
1.12.0