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>();
45 actionClient->actionServerName = actionServerName_;
46
47 // Create nav2-specific interface component (requires actionClient)
49
50 RCLCPP_INFO_STREAM(
51 this->getLogger(), "[ClNav2Z] Components created for action server: " << actionServerName_);
52 }
53
54private:
55 std::string actionServerName_;
56
57 // ✅ PURE ORCHESTRATOR PATTERN - ALL LEGACY METHODS REMOVED:
58 //
59 // ❌ REMOVED: sendGoal() methods - use CpNav2ActionInterface::sendGoal()
60 // ❌ REMOVED: signal connection proxy methods - use CpNav2ActionInterface::onNavigationSucceeded()
61 // ❌ REMOVED: signal getter methods - signals owned by components
62 // ❌ REMOVED: component accessor methods - use requiresComponent()
63 // ❌ REMOVED: convenience wrapper methods - use component APIs directly
64 // ❌ REMOVED: type aliases - use component types directly
65 //
66 // ✅ NEW BEHAVIOR PATTERN:
67 // class CbNavigateForward : public CbNav2ZClientBehaviorBase {
68 // void onEntry() override {
69 // CpNav2ActionInterface* navInterface;
70 // this->requiresComponent(navInterface);
71 // navInterface->onNavigationSucceeded(&CbNavigateForward::onSuccess, this);
72 // Goal goal = createForwardGoal();
73 // navInterface->sendGoal(goal);
74 // }
75 // };
76 //
77 // ✅ SMACC2 SIGNAL COMPLIANCE: All signal connections use createSignalConnection()
78 // ✅ FRAMEWORK CONSISTENCY: Matches cl_keyboard pure component pattern
79 // ✅ CLEAN SEPARATION: Client orchestrates, components implement, behaviors consume
80};
81
82} // namespace cl_nav2z
void onComponentInitialization()
Definition cl_nav2z.hpp:39
std::string actionServerName_
Definition cl_nav2z.hpp:55
ClNav2Z(std::string actionServerName="/navigate_to_pose")
Definition cl_nav2z.hpp:31
virtual ~ClNav2Z()=default
rclcpp::Logger getLogger()
SmaccComponentType * createComponent(TArgs... targs)