Common
common packages for kyubic
 
Loading...
Searching...
No Matches
behavior_tree::UpdateMode Class Reference

Action node to update the robot's operation mode based on Joystick input. More...

#include <update_mode.hpp>

+ Inheritance diagram for behavior_tree::UpdateMode:
+ Collaboration diagram for behavior_tree::UpdateMode:

Public Member Functions

 UpdateMode (const std::string &name, const BT::NodeConfig &config, rclcpp::Publisher< std_msgs::msg::String >::SharedPtr logger_pub, rclcpp::Node::SharedPtr ros_node, uint64_t timeout_ms)
 Constructor for the UpdateMode node.
 
BT::NodeStatus tick () override
 Checks joystick state and updates the mode.
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 Defines the input and output ports for this node.
 

Detailed Description

Action node to update the robot's operation mode based on Joystick input.

This node subscribes to a joystick topic and checks specific buttons defined in the input ports. It switches the mode between "manual" and "auto".

Constructor & Destructor Documentation

◆ UpdateMode()

behavior_tree::UpdateMode::UpdateMode ( const std::string &  name,
const BT::NodeConfig &  config,
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr  logger_pub,
rclcpp::Node::SharedPtr  ros_node,
uint64_t  timeout_ms 
)

Constructor for the UpdateMode node.

Parameters
nameThe name of the node in the behavior tree.
configThe configuration of the node.
ros_nodeShared pointer to the ROS 2 node used for subscription.
timeout_msjoy topic timeout [ms]

Member Function Documentation

◆ providedPorts()

BT::PortsList behavior_tree::UpdateMode::providedPorts ( )
static

Defines the input and output ports for this node.

Returns
A list containing:
  • InputPort "joy_topic": Topic name for the joystick. default is "/joy_common/joy_common".
  • InputPort "manual_button": Name of the button to switch to manual mode.
  • InputPort "auto_button": Name of the button to switch to auto mode.
  • OutputPort "mode": The current mode ("manual" or "auto").

◆ tick()

BT::NodeStatus behavior_tree::UpdateMode::tick ( )
override

Checks joystick state and updates the mode.

Returns
BT::NodeStatus::SUCCESS if executed correctly. BT::NodeStatus::FAILURE if Joy message is missing, ports are invalid, or buttons map is invalid.

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