SMACC2
Loading...
Searching...
No Matches
Public 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 onInitialize () override
 
void setDesiredGlobalPlanner (std::string)
 
void setDesiredController (std::string)
 
void commitPublish ()
 
void setBackwardPlanner (bool commit=true)
 
void setUndoPathBackwardPlanner (bool commit=true)
 
void setForwardPlanner (bool commit=true)
 
void setPureSpinningPlanner (bool commit=true)
 
void setDefaultPlanners (bool commit=true)
 
- Public Member Functions inherited from smacc2::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Private Attributes

std::string desired_planner_
 
std::string desired_controller_
 
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, bool throwExceptionIfNotExist=false)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
 
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 () const
 
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

◆ commitPublish()

void cl_nav2z::PlannerSwitcher::commitPublish ( )

Definition at line 98 of file planner_switcher.cpp.

99{
100 std_msgs::msg::String planner_msg;
101 planner_msg.data = desired_planner_;
102 this->planner_selector_pub_->publish(planner_msg);
103
104 std_msgs::msg::String controller_msg;
105 controller_msg.data = desired_controller_;
106 this->controller_selector_pub_->publish(controller_msg);
107}
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr controller_selector_pub_
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr planner_selector_pub_

References controller_selector_pub_, desired_controller_, desired_planner_, and planner_selector_pub_.

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

Here is the caller graph for this function:

◆ 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::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 ( bool  commit = true)

Definition at line 60 of file planner_switcher.cpp.

61{
62 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set BackwardPlanner");
63
64 desired_planner_ = "BackwardGlobalPlanner";
65 desired_controller_ = "BackwardLocalPlanner";
66
67 if (commit) commitPublish();
68}
rclcpp::Logger getLogger() const

References commitPublish(), desired_controller_, desired_planner_, and smacc2::ISmaccComponent::getLogger().

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 ( bool  commit = true)

Definition at line 90 of file planner_switcher.cpp.

91{
92 desired_planner_ = "GridBased";
93 desired_controller_ = "FollowPath";
94
95 if (commit) commitPublish();
96}

References commitPublish(), desired_controller_, and desired_planner_.

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

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

◆ setDesiredController()

void cl_nav2z::PlannerSwitcher::setDesiredController ( std::string  controllerName)

Definition at line 45 of file planner_switcher.cpp.

46{
47 desired_controller_ = controllerName;
48}

References desired_controller_.

◆ setDesiredGlobalPlanner()

void cl_nav2z::PlannerSwitcher::setDesiredGlobalPlanner ( std::string  plannerName)

Definition at line 40 of file planner_switcher.cpp.

41{
42 desired_planner_ = plannerName;
43}

References desired_planner_.

◆ setForwardPlanner()

void cl_nav2z::PlannerSwitcher::setForwardPlanner ( bool  commit = true)

Definition at line 70 of file planner_switcher.cpp.

71{
72 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set ForwardPlanner");
73
74 desired_planner_ = "ForwardGlobalPlanner";
75 desired_controller_ = "ForwardLocalPlanner";
76
77 if (commit) commitPublish();
78}

References commitPublish(), desired_controller_, desired_planner_, and smacc2::ISmaccComponent::getLogger().

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 ( bool  commit = true)

Definition at line 80 of file planner_switcher.cpp.

81{
82 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set PureSpinningPlanner");
83
84 desired_planner_ = "ForwardGlobalPlanner";
85 desired_controller_ = "PureSpinningLocalPlanner";
86
87 if (commit) commitPublish();
88}

References commitPublish(), desired_controller_, desired_planner_, and smacc2::ISmaccComponent::getLogger().

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 ( bool  commit = true)

Definition at line 50 of file planner_switcher.cpp.

51{
52 RCLCPP_INFO(getLogger(), "[PlannerSwitcher] Planner Switcher: Trying to set BackwardPlanner");
53
54 desired_planner_ = "UndoPathGlobalPlanner";
55 desired_controller_ = "BackwardLocalPlanner";
56
57 if (commit) commitPublish();
58}

References commitPublish(), desired_controller_, desired_planner_, and smacc2::ISmaccComponent::getLogger().

Here is the call 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 66 of file planner_switcher.hpp.

Referenced by commitPublish(), and onInitialize().

◆ desired_controller_

std::string cl_nav2z::PlannerSwitcher::desired_controller_
private

◆ desired_planner_

std::string cl_nav2z::PlannerSwitcher::desired_planner_
private

◆ goal_checker_selector_pub_

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

Definition at line 68 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 64 of file planner_switcher.hpp.

Referenced by commitPublish(), and onInitialize().

◆ set_planners_mode_flag_

bool cl_nav2z::PlannerSwitcher::set_planners_mode_flag_
private

Definition at line 62 of file planner_switcher.hpp.


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