MoveIt Studio Behavior Interface
2.11.0
Library for developing custom behaviors for use in MoveIt Studio
|
Classes | |
class | ActionClientBehaviorBase |
A base class for behaviors which need to send a goal to a ROS action client and wait for a result. If the behavior is halted before the action result is received, the action goal will be canceled. More... | |
class | AsyncBehaviorBase |
A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More... | |
struct | BehaviorContext |
The BehaviorContext struct contains shared resources that are common between all instances of Behaviors that inherit from moveit_studio::behaviors::SharedResourcesNode. More... | |
class | ClockInterfaceBase |
A base class which provides an interface for retrieving timepoints from a monotonic clock. More... | |
class | SteadyClockInterface |
Implementation of ClockInterfaceBase for std::chrono::steady_clock. More... | |
class | ForEach |
A class template for creating a behavior tree decorator node to help iterate through a vector of items. More... | |
class | GetMessageFromTopicBehaviorBase |
Base class for Behaviors that get the latest message from a topic specified on an input data port and set that message to an output data port. More... | |
class | LoadFromYaml |
Loads types from a YAML file, and returns them in an output port. More... | |
class | ServiceClientBehaviorBase |
A base class for behaviors which need to send a request to a ROS service client and wait for a result. More... | |
class | SharedResourcesNode |
The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More... | |
class | SharedResourcesNodeLoaderBase |
The SharedResourcesNodeLoaderBase class is a base class for Behavior loader plugins that register Behaviors inheriting from SharedResourcesNode. More... | |
Functions | |
template<typename... Args> | |
std::optional< std::string > | maybe_error (BT::Expected< Args >... args) |
Check if any of the provided inputs represent error states and, if so, return their error messages. More... | |
template<typename T > | |
BT::NodeBuilder | getDefaultNodeBuilder () |
Helper function to create a BT::NodeBuilder for a behavior tree node with the default constructor signature. More... | |
template<typename T > | |
BT::NodeBuilder | getSharedResourcesNodeBuilder (const std::shared_ptr< moveit_studio::behaviors::BehaviorContext > &shared_resources) |
Helper function to create a BT::NodeBuilder for a behavior tree node which takes shared_ptr<BehaviorContext> as an additional constructor parameter. More... | |
template<typename T > | |
void | registerBehavior (BT::BehaviorTreeFactory &factory, const std::string &name) |
Helper function to register a behavior with the default constructor signature with a BT::BehaviorTreeFactory. More... | |
template<typename T > | |
void | registerBehavior (BT::BehaviorTreeFactory &factory, const std::string &name, const std::shared_ptr< moveit_studio::behaviors::BehaviorContext > &shared_resources) |
Helper function to register a behavior derived from SharedResourcesNode with a BT::BehaviorTreeFactory. More... | |
template<class T > | |
void | parseROSMessage (const YAML::Node &node, const InterfaceTypeName &interface_type, T &rhs) |
Templated function to parse any ROS message from a YAML Node. More... | |
template<typename T > | |
fp::Result< T > | parseParameter (const YAML::Node &yaml, const std::string ¶meter_name) |
Helper function for parsing a parameter from a YAML::Node. More... | |
|
inline |
Helper function to create a BT::NodeBuilder for a behavior tree node with the default constructor signature.
T | Create a builder for this type of node. Must be derived from BT::TreeNode. |
|
inline |
Helper function to create a BT::NodeBuilder for a behavior tree node which takes shared_ptr<BehaviorContext> as an additional constructor parameter.
shared_resources | A shared_ptr to an instance of BehaviorContext, which will be provided when creating the behaviors registered by this function. |
T | Create a builder for this type of node. Must be derived from moveit_studio::behaviors::SharedResourcesNode. |
|
inline |
Check if any of the provided inputs represent error states and, if so, return their error messages.
This was inspired by fp's maybe_error function: https://github.com/tylerjw/fp/blob/b4bf17c2f7a99c07b6ab9b8706357572e960d638/include/fp/result.hpp#L216-L236
args | One or more BT::Expecteds (i.e., results from getInput) |
fp::Result<T> moveit_studio::behaviors::parseParameter | ( | const YAML::Node & | yaml, |
const std::string & | parameter_name | ||
) |
Helper function for parsing a parameter from a YAML::Node.
T | Type of the parameter. |
yaml | Parsed YAML file for an objective containing the parameters for every parameterized behavior in the objective. |
parameter_name | Parameter name within the YAML file. |
void moveit_studio::behaviors::parseROSMessage | ( | const YAML::Node & | node, |
const InterfaceTypeName & | interface_type, | ||
T & | rhs | ||
) |
Templated function to parse any ROS message from a YAML Node.
the | ROS message type to load. |
This uses the dynamic_message_introspection
package to parse any given ROS message from a YAML file. Throws an exception if the message can't be parsed, e.g. if the YAML contains fields not corresponding to the given message type. Example of use: geometry_msgs::msg::Pose pose; parseROSMessage(yaml_node, InterfaceTypeName{"geometry_msgs", "Pose"}, pose);
|
inline |
Helper function to register a behavior with the default constructor signature with a BT::BehaviorTreeFactory.
factory | Register behaviors with this factory. |
name | The name to use when registering this type of behavior. It is good practice to make this name match the name of the class (e.g., moveit_studio::behaviors::PlanMTCTask is registered as "PlanMTCTask"). |
T | Register a behavior of this type. |
|
inline |
Helper function to register a behavior derived from SharedResourcesNode with a BT::BehaviorTreeFactory.
factory | Register behaviors with this factory. |
name | The name to use when registering this type of behavior. It is good practice to make this name match the name of the class (e.g., moveit_studio::behaviors::PlanMTCTask is registered as "PlanMTCTask"). |
shared_resources | A shared_ptr to an instance of BehaviorContext, which will be provided when creating the behaviors registered by this function. |
T | Register a behavior of this type. |