SMACC2
Loading...
Searching...
No Matches
cl_nav2z.hpp
Go to the documentation of this file.
1// Copyright 2024 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#pragma once
16
19#include <nav2_msgs/action/navigate_to_pose.hpp>
21#include <smacc2/smacc.hpp>
22
23namespace cl_nav2z
24{
25
26// Pure component-based ClNav2Z - No legacy support
27// Follows cl_keyboard pattern: orchestrator only, behaviors use requiresComponent()
29{
30public:
31 // Type aliases required for event system (TSource::WrappedResult in smacc_default_events.hpp)
32 using ActionType = nav2_msgs::action::NavigateToPose;
33 using GoalHandle = rclcpp_action::ClientGoalHandle<ActionType>;
34 using WrappedResult = typename GoalHandle::WrappedResult;
35 using Feedback = typename ActionType::Feedback;
36
37 // Constructor
38 ClNav2Z(std::string actionServerName = "/navigate_to_pose")
39 : actionServerName_(std::move(actionServerName))
40 {
41 }
42
43 ~ClNav2Z() override = default;
44
45 // Component composition during orthogonal initialization
46 template <typename TOrthogonal, typename TClient>
48 {
49 // Create core action client component
50 this->createComponent<
52 TOrthogonal, ClNav2Z>(actionServerName_);
53
54 // Create nav2-specific interface component (requires actionClient)
56
57 // The nav2 bond heartbeat subscription CbWaitNav2Nodes listens to, for the life of the state machine
59
60 RCLCPP_INFO_STREAM(
61 this->getLogger(), "[ClNav2Z] Components created for action server: " << actionServerName_);
62 }
63
64private:
65 std::string actionServerName_;
66};
67
68} // namespace cl_nav2z
typename GoalHandle::WrappedResult WrappedResult
Definition cl_nav2z.hpp:34
typename ActionType::Feedback Feedback
Definition cl_nav2z.hpp:35
void onComponentInitialization()
Definition cl_nav2z.hpp:47
std::string actionServerName_
Definition cl_nav2z.hpp:65
ClNav2Z(std::string actionServerName="/navigate_to_pose")
Definition cl_nav2z.hpp:38
~ClNav2Z() override=default
rclcpp_action::ClientGoalHandle< ActionType > GoalHandle
Definition cl_nav2z.hpp:33
nav2_msgs::action::NavigateToPose ActionType
Definition cl_nav2z.hpp:32
rclcpp::Logger getLogger()
SmaccComponentType * createComponent(const TArgs &... targs)