SMACC2
Public Member Functions | List of all members
sm_dance_bot_warehouse_2::OrNavigation Class Reference

#include <or_navigation.hpp>

Inheritance diagram for sm_dance_bot_warehouse_2::OrNavigation:
Inheritance graph
Collaboration diagram for sm_dance_bot_warehouse_2::OrNavigation:
Collaboration graph

Public Member Functions

void onInitialize () override
 
void loadWaypointsFromYaml (WaypointNavigator *waypointsNavigator)
 
- Public Member Functions inherited from smacc2::Orthogonal< OrNavigation >
std::shared_ptr< ClientHandler< OrNavigation, TClient > > createClient (TArgs... args)
 
- Public Member Functions inherited from smacc2::ISmaccOrthogonal
void setStateMachine (ISmaccStateMachine *value)
 
ISmaccStateMachinegetStateMachine ()
 
void addClientBehavior (std::shared_ptr< smacc2::ISmaccClientBehavior > clientBehavior)
 
void runtimeConfigure ()
 
void onEntry ()
 
void onExit ()
 
virtual std::string getName () const
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 
template<typename SmaccClientType >
bool requiresClient (SmaccClientType *&storage)
 
const std::vector< std::shared_ptr< smacc2::ISmaccClient > > & getClients ()
 
const std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > & getClientBehaviors () const
 
template<typename T >
void setGlobalSMData (std::string name, T value)
 
template<typename T >
bool getGlobalSMData (std::string name, T &ret)
 
template<typename TClientBehavior >
TClientBehavior * getClientBehavior ()
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger ()
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccOrthogonal
virtual void onInitialize ()
 
void initializeClients ()
 
template<typename TOrthogonal , typename TClient >
void assignClientToOrthogonal (TClient *client)
 
- Protected Attributes inherited from smacc2::ISmaccOrthogonal
std::vector< std::shared_ptr< smacc2::ISmaccClient > > clients_
 

Detailed Description

Definition at line 47 of file or_navigation.hpp.

Member Function Documentation

◆ loadWaypointsFromYaml()

void sm_dance_bot_warehouse_2::OrNavigation::loadWaypointsFromYaml ( WaypointNavigator *  waypointsNavigator)
inline

Definition at line 79 of file or_navigation.hpp.

80 {
81 // if it is the first time and the waypoints navigator is not configured
82 std::string planfilepath;
83 getNode()->declare_parameter("waypoints_plan", planfilepath);
84 if (getNode()->get_parameter("waypoints_plan", planfilepath))
85 {
86 std::string package_share_directory =
87 ament_index_cpp::get_package_share_directory("sm_dance_bot_warehouse_2");
88 boost::replace_all(planfilepath, "$(pkg_share)", package_share_directory);
89 waypointsNavigator->loadWayPointsFromFile(planfilepath);
90 RCLCPP_INFO(getLogger(), "waypoints plan: %s", planfilepath.c_str());
91 }
92 else
93 {
94 RCLCPP_ERROR(getLogger(), "waypoints plan file not found: NONE");
95 }
96 }
rclcpp::Node::SharedPtr getNode()
Definition: orthogonal.cpp:47

References smacc2::ISmaccOrthogonal::getLogger(), and smacc2::ISmaccOrthogonal::getNode().

Referenced by onInitialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onInitialize()

void sm_dance_bot_warehouse_2::OrNavigation::onInitialize ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccOrthogonal.

Definition at line 50 of file or_navigation.hpp.

51 {
52 auto movebaseClient = this->createClient<ClNav2Z>();
53
54 // create pose component
55 movebaseClient->createComponent<Pose>();
56
57 // create planner switcher
58 movebaseClient->createComponent<PlannerSwitcher>();
59
60 // create goal checker switcher
61 movebaseClient->createComponent<GoalCheckerSwitcher>();
62
63 // create odom tracker
64 movebaseClient->createComponent<OdomTracker>();
65
66 // create odom tracker
67 movebaseClient->createComponent<CpSlamToolbox>();
68
69 // create waypoints navigator component
70 auto waypointsNavigator = movebaseClient->createComponent<WaypointNavigator>();
71 loadWaypointsFromYaml(waypointsNavigator);
72
73 // change this to skip some points of the yaml file, default = 0
74 waypointsNavigator->currentWaypoint_ = 0;
75
76 movebaseClient->createComponent<CpSquareShapeBoundary>(2.5);
77 }
void loadWaypointsFromYaml(WaypointNavigator *waypointsNavigator)

References loadWaypointsFromYaml().

Here is the call graph for this function:

The documentation for this class was generated from the following file: