Skip to main content

BaseJog Class

Drives a mobile base's velocity command topic from the base jog commands the MoveIt Pro Desktop App publishes during teleoperation. More...

Declaration​

class moveit_pro::behaviors::BaseJog { ... }

Included Headers​

#include <base_jog.hpp>

Base class​

classSharedResourcesNode<BehaviorTreeNodeT>

The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More...

Public Constructors Index​

BaseJog (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)

Constructor for the BaseJog Behavior. More...

Public Member Functions Index​

BT::NodeStatusonStart () override

Reads the base_jog settings, then creates the jog command subscription and, unless the topic is unchanged, the twist publisher. More...

BT::NodeStatusonRunning () override

Publishes the latest command, restamped and clamped, when a new one arrived since the last tick, or one zero twist when commands stopped while the base was moving. More...

voidonHalted () override

Drops the subscription and publishes one zero twist. More...

Private Member Functions Index​

voidpublishTwist (const geometry_msgs::msg::Twist &twist) const

Publishes a twist on the output topic, stamped now. More...

Private Member Attributes Index​

doublemax_linear_velocity_ = 0.0
doublemax_angular_velocity_ = 0.0
std::stringcmd_vel_topic_
rclcpp::Publisher< geometry_msgs::msg::TwistStamped >::SharedPtrcmd_vel_publisher_
boolwarned_no_subscriber_ = false
boolbase_moving_ = false
std::chrono::steady_clock::time_pointlast_command_time_
std::shared_ptr< CommandSlot >command_slot_
rclcpp::Subscription< geometry_msgs::msg::TwistStamped >::SharedPtrcommand_subscription_

Public Static Functions Index​

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description​

Drives a mobile base's velocity command topic from the base jog commands the MoveIt Pro Desktop App publishes during teleoperation.

Reads the base's planning group and speed limits from the robot config's moveit_params.base_jog file, which the objective server holds as its base_jog.* parameters. Subscribes to /base_jog/<planning_group> (geometry_msgs::msg::TwistStamped) and, for every new command, publishes linear x and angular z clamped by internal::clampPlanarTwist() as a geometry_msgs::msg::TwistStamped on cmd_vel_topic, in the base's body frame (header.frame_id left empty) and stamped with the current time (the browser's stamp is not forwarded, because base controllers drop commands older than their timeout). It publishes nothing until a command arrives and does not repeat a command. When commands stop for 0.25 s while the base is moving, it publishes one zero twist, and halting publishes one too. It does no collision checking, does not activate the base controller (run SwitchController first), and warns once per run when nothing subscribes to cmd_vel_topic.

Returns RUNNING until halted; it never returns SUCCESS. Returns FAILURE when the port is missing, the robot config defines no complete base_jog file, a velocity limit is not finite and greater than 0, or a topic name is invalid.

Data Port NamePort TypeObject Type
cmd_vel_topicinputstd::string

Definition at line 77 of file base_jog.hpp.

Public Constructors​

BaseJog()​

moveit_pro::behaviors::BaseJog::BaseJog (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)

Constructor for the BaseJog Behavior.

Parameters
name

Name of the node. Must match the name used for this node in the behavior tree definition file (the .xml file).

config

Node configuration. Only used here because the BehaviorTree.CPP expects constructor signature with name and config first before custom constructor parameters.

shared_resources

Provides access to common resources such as the node handle and failure logger that are shared between all the behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode.

Declaration at line 89 of file base_jog.hpp, definition at line 160 of file base_jog.cpp.

Public Member Functions​

onHalted()​

void moveit_pro::behaviors::BaseJog::onHalted ()

Drops the subscription and publishes one zero twist.

Declaration at line 109 of file base_jog.hpp, definition at line 260 of file base_jog.cpp.

onRunning()​

BT::NodeStatus moveit_pro::behaviors::BaseJog::onRunning ()

Publishes the latest command, restamped and clamped, when a new one arrived since the last tick, or one zero twist when commands stopped while the base was moving.

Declaration at line 106 of file base_jog.hpp, definition at line 227 of file base_jog.cpp.

onStart()​

BT::NodeStatus moveit_pro::behaviors::BaseJog::onStart ()

Reads the base_jog settings, then creates the jog command subscription and, unless the topic is unchanged, the twist publisher.

Declaration at line 100 of file base_jog.hpp, definition at line 180 of file base_jog.cpp.

Private Member Functions​

publishTwist()​

void moveit_pro::behaviors::BaseJog::publishTwist (const geometry_msgs::msg::Twist & twist)

Publishes a twist on the output topic, stamped now.

Declaration at line 123 of file base_jog.hpp, definition at line 270 of file base_jog.cpp.

Private Member Attributes​

base_moving_​

bool moveit_pro::behaviors::BaseJog::base_moving_ = false

Definition at line 132 of file base_jog.hpp.

cmd_vel_publisher_​

rclcpp::Publisher<geometry_msgs::msg::TwistStamped>::SharedPtr moveit_pro::behaviors::BaseJog::cmd_vel_publisher_

Definition at line 129 of file base_jog.hpp.

cmd_vel_topic_​

std::string moveit_pro::behaviors::BaseJog::cmd_vel_topic_

Definition at line 128 of file base_jog.hpp.

command_slot_​

std::shared_ptr<CommandSlot> moveit_pro::behaviors::BaseJog::command_slot_

Definition at line 135 of file base_jog.hpp.

command_subscription_​

rclcpp::Subscription<geometry_msgs::msg::TwistStamped>::SharedPtr moveit_pro::behaviors::BaseJog::command_subscription_

Definition at line 136 of file base_jog.hpp.

last_command_time_​

std::chrono::steady_clock::time_point moveit_pro::behaviors::BaseJog::last_command_time_

Definition at line 133 of file base_jog.hpp.

max_angular_velocity_​

double moveit_pro::behaviors::BaseJog::max_angular_velocity_ = 0.0

Definition at line 126 of file base_jog.hpp.

max_linear_velocity_​

double moveit_pro::behaviors::BaseJog::max_linear_velocity_ = 0.0

Definition at line 125 of file base_jog.hpp.

warned_no_subscriber_​

bool moveit_pro::behaviors::BaseJog::warned_no_subscriber_ = false

Definition at line 130 of file base_jog.hpp.

Public Static Functions​

metadata()​

BT::KeyValueVector moveit_pro::behaviors::BaseJog::metadata ()
static

Declaration at line 94 of file base_jog.hpp, definition at line 175 of file base_jog.cpp.

providedPorts()​

BT::PortsList moveit_pro::behaviors::BaseJog::providedPorts ()
static

Declaration at line 92 of file base_jog.hpp, definition at line 166 of file base_jog.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.