SMACC2
st_navigate_forward_1.hpp
Go to the documentation of this file.
1// Copyright 2021 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: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
21#pragma once
22
24#include <smacc2/smacc.hpp>
25
27{
28// STATE DECLARATION
29struct StNavigateForward1 : smacc2::SmaccState<StNavigateForward1, MsDanceBotRunMode>
30{
31 using SmaccState::SmaccState;
32
33 // TRANSITION TABLE
34 typedef mpl::list<
35
36 Transition<EvCbSuccess<CbNavigateForward, OrNavigation>, StRotateDegrees2>,
37 Transition<EvCbFailure<CbNavigateForward, OrNavigation>, StNavigateForward1, ABORT>
38 //, Transition<EvActionPreempted<ClNav2Z, OrNavigation>, StNavigateToWaypointsX, PREEMPT>
39
41
42 // STATE FUNCTIONS
43 static void staticConfigure()
44 {
45 configure_orthogonal<OrNavigation, CbNavigateForward>(1);
46 configure_orthogonal<OrNavigation, CbPauseSlam>();
47 configure_orthogonal<OrLED, CbLEDOff>();
48 configure_orthogonal<OrObstaclePerception, CbLidarSensor>();
49
50 }
51
53 {
54 ClNav2Z * move_base_action_client;
55 this->requiresClient(move_base_action_client);
56
57 // we careful with the lifetime of the callbac, us a scoped connection if is not forever
58 move_base_action_client->onSucceeded(&StNavigateForward1::onActionClientSucceeded, this);
59 }
60
62 {
63 RCLCPP_INFO_STREAM(
64 getLogger(),
65 " [Callback SmaccSignal] Success Detected from StAcquireSensors (connected to client signal), "
66 "result data: "
67 << msg.result);
68 }
69};
70} // namespace sm_dance_bot_strikes_back
rclcpp::Logger getLogger()
Definition: smacc_state.hpp:36
void requiresClient(SmaccClientType *&storage)
boost::signals2::connection onSucceeded(void(T::*callback)(WrappedResult &), T *object)
void onActionClientSucceeded(cl_nav2z::ClNav2Z::WrappedResult &msg)
mpl::list< Transition< EvCbSuccess< CbNavigateForward, OrNavigation >, StRotateDegrees2 >, Transition< EvCbFailure< CbNavigateForward, OrNavigation >, StNavigateForward1, ABORT > > reactions