MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_studio::behaviors::SwitchController Class Referencefinal

A Behavior to call the ros2_control switch_controllers service. More...

#include <switch_controller.hpp>

Inheritance diagram for moveit_studio::behaviors::SwitchController:
Collaboration diagram for moveit_studio::behaviors::SwitchController:

Public Member Functions

 SwitchController (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
 SwitchController (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< SwitchControllerSrv > > client_interface)
 
- Public Member Functions inherited from moveit_studio::behaviors::ServiceClientBehaviorBase< SwitchControllerSrv >
 ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructs ServiceClientBehaviorBase using the RclcppClientInterface.
 
 ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< SwitchControllerSrv > > client_interface)
 Constructs ServiceClientBehaviorBase using a user-provided implementation of ClientInterfaceBase.
 
virtual ~ServiceClientBehaviorBase ()=default
 
- Public Member Functions inherited from moveit_studio::behaviors::AsyncBehaviorBase
 AsyncBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
virtual ~AsyncBehaviorBase ()=default
 
BT::NodeStatus onStart () override
 Required implementation of BT::StatefulActionNode::onStart().
 
BT::NodeStatus onRunning () override
 Required implementation of BT::StatefulActionNode::onRunning().
 
void onHalted () override
 Required implementation of BT::StatefulActionNode::onHalted().
 
void resetStatus ()
 Resets the internal status of this node.
 
- Public Member Functions inherited from moveit_studio::behaviors::SharedResourcesNode< BT::StatefulActionNode >
 SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 
static BT::KeyValueVector metadata ()
 

Static Public Attributes

static constexpr auto kPortActivateControllers = "activate_controllers"
 
static constexpr auto kPortDeactivateControllers = "deactivate_controllers"
 
static constexpr auto kPortStrictness = "strictness"
 
static constexpr auto kPortActivateAsap = "activate_asap"
 
static constexpr auto kPortTimeout = "timeout"
 
static constexpr auto kPortServiceName = "controller_switch_action_name"
 
- Static Public Attributes inherited from moveit_studio::behaviors::ServiceClientBehaviorBase< SwitchControllerSrv >
static constexpr std::chrono::seconds kTimeoutWaitForServiceServer
 

Additional Inherited Members

- Protected Member Functions inherited from moveit_studio::behaviors::ServiceClientBehaviorBase< SwitchControllerSrv >
virtual tl::expected< std::chrono::duration< double >, std::string > getResponseTimeout ()
 Optional user-provided function to set the timeout used when waiting for the service response.
 
virtual tl::expected< bool, std::string > processResponse (const typename ServiceT::Response &)
 Optional user-provided function to process the service response after the service has finished.
 
- Protected Member Functions inherited from moveit_studio::behaviors::AsyncBehaviorBase
void notifyCanHalt ()
 Called when runAsync() finishes to notify onHalted() that the async process has finished.
 
- Protected Attributes inherited from moveit_studio::behaviors::SharedResourcesNode< BT::StatefulActionNode >
std::shared_ptr< BehaviorContextshared_resources_
 

Detailed Description

A Behavior to call the ros2_control switch_controllers service.

This behavior switches controllers in a ros2_control controller manager. Given a list of controllers to activate/deactivate, a service request is dispatched to switch the active ros2_control controllers accordingly. The behavior will wait for the service response and return success or failure based on the response.

Data Port Name Port Type Object Type
activate_controllers input std::vector<std::string>
deactivate_controllers input std::vector<std::string>
strictness input int
activate_asap input bool
timeout input std::chrono::duration<double>
controller_switch_action_name input std::string

Constructor & Destructor Documentation

◆ SwitchController() [1/2]

moveit_studio::behaviors::SwitchController::SwitchController ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources 
)
explicit

◆ SwitchController() [2/2]

moveit_studio::behaviors::SwitchController::SwitchController ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources,
std::unique_ptr< ClientInterfaceBase< SwitchControllerSrv > >  client_interface 
)
explicit

Member Function Documentation

◆ metadata()

BT::KeyValueVector moveit_studio::behaviors::SwitchController::metadata ( )
static

◆ providedPorts()

BT::PortsList moveit_studio::behaviors::SwitchController::providedPorts ( )
static

Member Data Documentation

◆ kPortActivateAsap

constexpr auto moveit_studio::behaviors::SwitchController::kPortActivateAsap = "activate_asap"
staticconstexpr

◆ kPortActivateControllers

constexpr auto moveit_studio::behaviors::SwitchController::kPortActivateControllers = "activate_controllers"
staticconstexpr

◆ kPortDeactivateControllers

constexpr auto moveit_studio::behaviors::SwitchController::kPortDeactivateControllers = "deactivate_controllers"
staticconstexpr

◆ kPortServiceName

constexpr auto moveit_studio::behaviors::SwitchController::kPortServiceName = "controller_switch_action_name"
staticconstexpr

◆ kPortStrictness

constexpr auto moveit_studio::behaviors::SwitchController::kPortStrictness = "strictness"
staticconstexpr

◆ kPortTimeout

constexpr auto moveit_studio::behaviors::SwitchController::kPortTimeout = "timeout"
staticconstexpr

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