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
18#include <nav2_msgs/action/navigate_to_pose.hpp>
20#include <smacc2/smacc.hpp>
21
22namespace cl_nav2z
23{
24
25// Pure component-based ClNav2Z - No legacy support
26// Follows cl_keyboard pattern: orchestrator only, behaviors use requiresComponent()
27class ClNav2Z : public smacc2::ISmaccClient
28{
29public:
30 // Constructor
31 ClNav2Z(std::string actionServerName = "/navigate_to_pose") : actionServerName_(actionServerName)
32 {
33 }
34
35 virtual ~ClNav2Z() = default;
36
37 // Component composition during orthogonal initialization
38 template <typename TOrthogonal, typename TClient>
40 {
41 // Create core action client component
42 auto actionClient = this->createComponent<
44 TOrthogonal, ClNav2Z>(actionServerName_);
45
46 // Create nav2-specific interface component (requires actionClient)
48
49 RCLCPP_INFO_STREAM(
50 this->getLogger(), "[ClNav2Z] Components created for action server: " << actionServerName_);
51 }
52
53private:
54 std::string actionServerName_;
55
56 // ✅ PURE ORCHESTRATOR PATTERN - ALL LEGACY METHODS REMOVED:
57 //
58 // ❌ REMOVED: sendGoal() methods - use CpNav2ActionInterface::sendGoal()
59 // ❌ REMOVED: signal connection proxy methods - use CpNav2ActionInterface::onNavigationSucceeded()
60 // ❌ REMOVED: signal getter methods - signals owned by components
61 // ❌ REMOVED: component accessor methods - use requiresComponent()
62 // ❌ REMOVED: convenience wrapper methods - use component APIs directly
63 // ❌ REMOVED: type aliases - use component types directly
64 //
65 // ✅ NEW BEHAVIOR PATTERN:
66 // class CbNavigateForward : public CbNav2ZClientBehaviorBase {
67 // void onEntry() override {
68 // CpNav2ActionInterface* navInterface;
69 // this->requiresComponent(navInterface);
70 // navInterface->onNavigationSucceeded(&CbNavigateForward::onSuccess, this);
71 // Goal goal = createForwardGoal();
72 // navInterface->sendGoal(goal);
73 // }
74 // };
75 //
76 // ✅ SMACC2 SIGNAL COMPLIANCE: All signal connections use createSignalConnection()
77 // ✅ FRAMEWORK CONSISTENCY: Matches cl_keyboard pure component pattern
78 // ✅ CLEAN SEPARATION: Client orchestrates, components implement, behaviors consume
79};
80
81} // namespace cl_nav2z
void onComponentInitialization()
Definition cl_nav2z.hpp:39
std::string actionServerName_
Definition cl_nav2z.hpp:54
ClNav2Z(std::string actionServerName="/navigate_to_pose")
Definition cl_nav2z.hpp:31
virtual ~ClNav2Z()=default
rclcpp::Logger getLogger()
SmaccComponentType * createComponent(TArgs... targs)