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

#include <or_navigation.hpp>

Inheritance diagram for sm_dance_bot::OrNavigation:
Inheritance graph
Collaboration diagram for sm_dance_bot::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 39 of file or_navigation.hpp.

Member Function Documentation

◆ loadWaypointsFromYaml()

void sm_dance_bot::OrNavigation::loadWaypointsFromYaml ( WaypointNavigator waypointsNavigator)
inline

Definition at line 69 of file or_navigation.hpp.

70 {
71 // if it is the first time and the waypoints navigator is not configured
72 std::string planfilepath;
73 getNode()->declare_parameter("waypoints_plan", planfilepath);
74 if (getNode()->get_parameter("waypoints_plan", planfilepath))
75 {
76 std::string package_share_directory =
77 ament_index_cpp::get_package_share_directory("sm_dance_bot");
78 boost::replace_all(planfilepath, "$(pkg_share)", package_share_directory);
79 waypointsNavigator->loadWayPointsFromFile(planfilepath);
80 RCLCPP_INFO(getLogger(), "waypoints plan: %s", planfilepath.c_str());
81 }
82 else
83 {
84 RCLCPP_ERROR(getLogger(), "waypoints plan file not found: NONE");
85 }
86 }
rclcpp::Node::SharedPtr getNode()
Definition: orthogonal.cpp:47

References smacc2::ISmaccOrthogonal::getLogger(), smacc2::ISmaccOrthogonal::getNode(), and cl_nav2z::WaypointNavigator::loadWayPointsFromFile().

Referenced by onInitialize().

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

◆ onInitialize()

void sm_dance_bot::OrNavigation::onInitialize ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccOrthogonal.

Definition at line 42 of file or_navigation.hpp.

43 {
44 auto movebaseClient = this->createClient<ClNav2Z>();
45
46 // create pose component
47 movebaseClient->createComponent<cl_nav2z::Pose>();
48
49 // create planner switcher
50 movebaseClient->createComponent<PlannerSwitcher>();
51
52 // create goal checker switcher
53 movebaseClient->createComponent<cl_nav2z::GoalCheckerSwitcher>();
54
55 // create odom tracker
56 movebaseClient->createComponent<cl_nav2z::odom_tracker::OdomTracker>();
57
58 // create odom tracker
59 movebaseClient->createComponent<cl_nav2z::CpSlamToolbox>();
60
61 // create waypoints navigator component
62 auto waypointsNavigator = movebaseClient->createComponent<WaypointNavigator>();
63 loadWaypointsFromYaml(waypointsNavigator);
64
65 // change this to skip some points of the yaml file, default = 0
66 waypointsNavigator->currentWaypoint_ = 0;
67 }
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: