SMACC2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cl_nav2z::PlannerSwitcher Class Reference

#include <planner_switcher.hpp>

Inheritance diagram for cl_nav2z::PlannerSwitcher:
Inheritance graph
Collaboration diagram for cl_nav2z::PlannerSwitcher:
Collaboration graph

Public Member Functions

 PlannerSwitcher ()
 
void setBackwardPlanner ()
 
void setUndoPathBackwardPlanner ()
 
void setForwardPlanner ()
 
void setPureSpinningPlanner ()
 
void onInitialize () override
 
void setDefaultPlanners ()
 
- Public Member Functions inherited from smacc2::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Private Member Functions

void updatePlanners ()
 

Private Attributes

std::string desired_global_planner_
 
std::string desired_local_planner_
 
bool set_planners_mode_flag_
 
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr planner_selector_pub_
 
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr controller_selector_pub_
 
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr goal_checker_selector_pub_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccComponent
virtual void onInitialize ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger ()
 
ISmaccStateMachinegetStateMachine ()
 
- Protected Attributes inherited from smacc2::ISmaccComponent
ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Detailed Description

Definition at line 31 of file planner_switcher.hpp.

Constructor & Destructor Documentation

◆ PlannerSwitcher()

cl_nav2z::PlannerSwitcher::PlannerSwitcher ( )

Definition at line 27 of file planner_switcher.cpp.

27{}

Member Function Documentation

◆ onInitialize()

void cl_nav2z::PlannerSwitcher::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccComponent.

Definition at line 29 of file planner_switcher.cpp.

30{
31 rclcpp::QoS qos(rclcpp::KeepLast(1));
32 qos.transient_local().reliable();
33
35 getNode()->create_publisher<std_msgs::msg::String>("planner_selector", qos);
37 getNode()->create_publisher<std_msgs::msg::String>("controller_selector", qos);
38}
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr controller_selector_pub_
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr planner_selector_pub_
rclcpp::Node::SharedPtr getNode()

References controller_selector_pub_, smacc2::ISmaccComponent::getNode(), and planner_selector_pub_.

Here is the call graph for this function:

◆ setBackwardPlanner()

void cl_nav2z::PlannerSwitcher::setBackwardPlanner ( )

Definition at line 50 of file planner_switcher.cpp.

51{
52 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set BackwardPlanner");
53
54 desired_global_planner_ = "BackwardGlobalPlanner";
55 desired_local_planner_ = "BackwardLocalPlanner";
57}
rclcpp::Logger getLogger()

References desired_global_planner_, desired_local_planner_, smacc2::ISmaccComponent::getLogger(), and updatePlanners().

Referenced by cl_nav2z::CbNavigateBackwards::onEntry().

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

◆ setDefaultPlanners()

void cl_nav2z::PlannerSwitcher::setDefaultPlanners ( )

Definition at line 77 of file planner_switcher.cpp.

78{
79 desired_global_planner_ = "GridBased";
80 desired_local_planner_ = "FollowPath";
81
83}

References desired_global_planner_, desired_local_planner_, and updatePlanners().

Referenced by cl_nav2z::WaypointNavigator::sendNextGoal().

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

◆ setForwardPlanner()

void cl_nav2z::PlannerSwitcher::setForwardPlanner ( )

Definition at line 59 of file planner_switcher.cpp.

60{
61 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set ForwardPlanner");
62
63 desired_global_planner_ = "ForwardGlobalPlanner";
64 desired_local_planner_ = "ForwardLocalPlanner";
66}

References desired_global_planner_, desired_local_planner_, smacc2::ISmaccComponent::getLogger(), and updatePlanners().

Referenced by cl_nav2z::CbNavigateForward::onEntry().

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

◆ setPureSpinningPlanner()

void cl_nav2z::PlannerSwitcher::setPureSpinningPlanner ( )

Definition at line 68 of file planner_switcher.cpp.

69{
70 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set PureSpinningPlanner");
71
72 desired_global_planner_ = "ForwardGlobalPlanner";
73 desired_local_planner_ = "PureSpinningLocalPlanner";
75}

References desired_global_planner_, desired_local_planner_, smacc2::ISmaccComponent::getLogger(), and updatePlanners().

Referenced by cl_nav2z::CbAbsoluteRotate::onEntry(), and cl_nav2z::CbRotate::onEntry().

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

◆ setUndoPathBackwardPlanner()

void cl_nav2z::PlannerSwitcher::setUndoPathBackwardPlanner ( )

Definition at line 40 of file planner_switcher.cpp.

41{
42 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set BackwardPlanner");
43
44 desired_global_planner_ = "UndoPathGlobalPlanner";
45 desired_local_planner_ = "BackwardLocalPlanner";
46
48}

References desired_global_planner_, desired_local_planner_, smacc2::ISmaccComponent::getLogger(), and updatePlanners().

Here is the call graph for this function:

◆ updatePlanners()

void cl_nav2z::PlannerSwitcher::updatePlanners ( )
private

Definition at line 85 of file planner_switcher.cpp.

86{
87 std_msgs::msg::String planner_msg;
88 planner_msg.data = desired_global_planner_;
89 this->planner_selector_pub_->publish(planner_msg);
90
91 std_msgs::msg::String controller_msg;
92 controller_msg.data = desired_local_planner_;
93 this->controller_selector_pub_->publish(controller_msg);
94}

References controller_selector_pub_, desired_global_planner_, desired_local_planner_, and planner_selector_pub_.

Referenced by setBackwardPlanner(), setDefaultPlanners(), setForwardPlanner(), setPureSpinningPlanner(), and setUndoPathBackwardPlanner().

Here is the caller graph for this function:

Member Data Documentation

◆ controller_selector_pub_

rclcpp::Publisher<std_msgs::msg::String>::SharedPtr cl_nav2z::PlannerSwitcher::controller_selector_pub_
private

Definition at line 60 of file planner_switcher.hpp.

Referenced by onInitialize(), and updatePlanners().

◆ desired_global_planner_

std::string cl_nav2z::PlannerSwitcher::desired_global_planner_
private

◆ desired_local_planner_

std::string cl_nav2z::PlannerSwitcher::desired_local_planner_
private

◆ goal_checker_selector_pub_

rclcpp::Publisher<std_msgs::msg::String>::SharedPtr cl_nav2z::PlannerSwitcher::goal_checker_selector_pub_
private

Definition at line 62 of file planner_switcher.hpp.

◆ planner_selector_pub_

rclcpp::Publisher<std_msgs::msg::String>::SharedPtr cl_nav2z::PlannerSwitcher::planner_selector_pub_
private

Definition at line 58 of file planner_switcher.hpp.

Referenced by onInitialize(), and updatePlanners().

◆ set_planners_mode_flag_

bool cl_nav2z::PlannerSwitcher::set_planners_mode_flag_
private

Definition at line 54 of file planner_switcher.hpp.


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