SMACC2
Loading...
Searching...
No Matches
cb_nav2z_client_behavior_base.hpp
Go to the documentation of this file.
1// Copyright 2025 Robosoft 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: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20#pragma once
21
22#include <cl_nav2z/cl_nav2z.hpp>
26
27namespace cl_nav2z
28{
29using namespace smacc2;
30
31// Navigation behavior base, built on the generic action-client behavior
32// template: goal sending (server-ready guard + rejection watchdog), result
33// signal wiring (state machine thread), in-flight goal cancellation on early
34// state exit and EvCbSuccess/EvCbFailure termination all come from
35// CbActionClientBehaviorBase<NavigateToPose>. This class adds the
36// nav-domain component (CpNav2ActionInterface, which posts the machine-scoped
37// EvAction* navigation events) and keeps the historical nav-named result
38// virtuals for existing overriders.
40 nav2_msgs::action::NavigateToPose>
41{
44
45public:
47
48 template <typename TOrthogonal, typename TSourceObject>
50 {
51 this->requiresComponent(nav2ActionInterface_, ComponentRequirement::HARD);
52
53 // resolves actionClient_ and wires the result signals (see the template
54 // header for the threading rationale); chain-break => bad_function_call
56 }
57
58protected:
59 // Result handlers dispatched by the template. The base implementations
60 // record the result code and post the behavior success/failure events;
61 // derived classes may override to customize result handling (see
62 // CbNavigateNextWaypointUntilReached).
65
66 // route the template's result handlers into the nav-named virtuals
67 void onActionSuccess(const WrappedResult & result) override;
68 void onActionAbort(const WrappedResult & result) override;
69
71
72 rclcpp_action::ResultCode navigationResult_ = rclcpp_action::ResultCode::UNKNOWN;
73};
74
76{
77 Default,
80};
81} // namespace cl_nav2z
virtual void onNavigationActionAbort(const components::CpNav2ActionInterface::WrappedResult &)
components::CpNav2ActionInterface * nav2ActionInterface_
virtual void onNavigationActionSuccess(const components::CpNav2ActionInterface::WrappedResult &)
void onActionSuccess(const WrappedResult &result) override
void onActionAbort(const WrappedResult &result) override
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)