Action node to update the robot's operation mode based on Joystick input.
More...
#include <update_mode.hpp>
|
| | 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 BT::PortsList | providedPorts () |
| | Defines the input and output ports for this node.
|
| |
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".
◆ 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
-
| name | The name of the node in the behavior tree. |
| config | The configuration of the node. |
| ros_node | Shared pointer to the ROS 2 node used for subscription. |
| timeout_ms | joy topic timeout [ms] |
◆ 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: