Accepts a JointTrajectory message via an input data port, and executes it by sending a goal to either a standard FollowJointTrajectory action server (JTC) or a Joint Trajectory Admittance Controller (JTAC) action server, depending on the value of the execution_pipeline input port. More...
Declaration
class moveit_pro::behaviors::ExecuteTrajectory { ... }
#include <execute_trajectory.hpp>
Base class
| class | AsyncBehaviorBase |
|
A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More...
|
|
Public Constructors Index
| ExecuteTrajectory (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) |
|
|
|
Public Member Functions Index
| std::shared_future< tl::expected< bool, std::string > > & | getFuture () override |
|
Gets the shared future which is used to monitor the progress of the async process. More...
|
|
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
User-implemented function which handles executing the potentially-long-running process. More...
|
|
| tl::expected< void, std::string > | doHalt () override |
|
Optionally implement additional work needed to cleanly interrupt the async process. More...
|
|
Private Member Attributes Index
Public Static Functions Index
Private Static Attributes Index
Description
Accepts a JointTrajectory message via an input data port, and executes it by sending a goal to either a standard FollowJointTrajectory action server (JTC) or a Joint Trajectory Admittance Controller (JTAC) action server, depending on the value of the execution_pipeline input port.
The execution_pipeline input port selects between the JTC and JTAC action interfaces at runtime.
| Data Port Name | Port Type | Object Type |
|---|
| execution_pipeline | Input | std::string |
| controller_action_name | Input | std::string |
| joint_trajectory_msg | Input | trajectory_msgs::msg::JointTrajectory |
| goal_position_tolerance | Input | double |
| path_position_tolerance | Input | double |
| absolute_force_torque_threshold | Input | std::vector<double> |
| admittance_parameters_msg | Input | moveit_pro_controllers_msgs::msg::AdmittanceParameters |
| goal_duration_tolerance | Input | double |
Definition at line 37 of file execute_trajectory.hpp.
Public Constructors
ExecuteTrajectory()
| moveit_pro::behaviors::ExecuteTrajectory::ExecuteTrajectory (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources) |
|
Public Member Functions
getFuture()
| std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::ExecuteTrajectory::getFuture () |
|
virtual
|
Gets the shared future which is used to monitor the progress of the async process.
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
This exists to prevent destruction of the derived class while the async process is still in-progress. If the derived class is destroyed, the definitions of the functions used within doWork() will be destroyed too, which will result in the virtual functions in the base class being called instead and cause a fault.
This function will force derived classes to add an instance of this type and return a reference to it. The base class can then use this virtual function to access the shared future in functions like onStart.
By adding this virtual function we're properly demonstrating how this future depends on things from the derived class and the natural flow of object lifetimes will do the hard work for us. The std::shared_future destructor will get the value of the future before the derived class is destructed assuming it's the last reference to the shared state. Doing it this way means neither the base nor derived class should need to implement a destructor which is a nice property to have.
- Returns
Returns the shared_future, which should be owned by the child class.
Declaration at line 47 of file execute_trajectory.hpp, definition at line 62 of file execute_trajectory.cpp.
Private Member Functions
doHalt()
| tl::expected< void, std::string > moveit_pro::behaviors::ExecuteTrajectory::doHalt () |
|
virtual
|
Optionally implement additional work needed to cleanly interrupt the async process.
The default implementation of this function is a no-op which will not interrupt the async process. This will mean that onHalted will wait until the process finishes before returning.
- Returns
Return an empty tl::expected<void, std::string> if the additional work to halt was successful. Return an error message if something failed while doing additional work to halt.
Declaration at line 52 of file execute_trajectory.hpp, definition at line 160 of file execute_trajectory.cpp.
doWork()
| tl::expected< bool, std::string > moveit_pro::behaviors::ExecuteTrajectory::doWork () |
|
virtual
|
User-implemented function which handles executing the potentially-long-running process.
This function is called within an async process in a separate thread.
- Returns
A tl::expected which contains a bool indicating task success if the process completed successfully or was canceled, or an error message if the process failed unexpectedly.
Declaration at line 50 of file execute_trajectory.hpp, definition at line 67 of file execute_trajectory.cpp.
Private Member Attributes
current_execution_pipeline_
| std::string moveit_pro::behaviors::ExecuteTrajectory::current_execution_pipeline_ |
|
future_
| std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::ExecuteTrajectory::future_ |
|
goal_active_
| bool moveit_pro::behaviors::ExecuteTrajectory::goal_active_ = false |
|
goal_mutex_
| std::mutex moveit_pro::behaviors::ExecuteTrajectory::goal_mutex_ |
|
halt_requested_
| std::atomic<bool> moveit_pro::behaviors::ExecuteTrajectory::halt_requested_ = false |
|
trajectory_executor_
| std::unique_ptr<TrajectoryExecutionPipeline> moveit_pro::behaviors::ExecuteTrajectory::trajectory_executor_ |
|
Public Static Functions
metadata()
| BT::KeyValueVector moveit_pro::behaviors::ExecuteTrajectory::metadata () |
|
static
|
providedPorts()
| BT::PortsList moveit_pro::behaviors::ExecuteTrajectory::providedPorts () |
|
static
|
Private Static Attributes
kDescriptionExecuteTrajectory
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kDescriptionExecuteTrajectory |
|
constexpr
static
|
- Initialiser
-
= R"(
<p>Execute a given joint trajectory by sending a
request to either a standard FollowJointTrajectory action server (JTC)
or a Joint Trajectory Admittance Controller (JTAC) action server, depending on the value of the execution_pipeline input port.</p>
<p>The corresponding controller needs to be active, which can be done with the <code>ActivateControllers</code> Behavior.</p>
<p>If execution_pipeline is set to 'jtc', this Behavior sends the trajectory to a standard
<code>control_msgs::action::FollowJointTrajectory</code> action server (e.g., JTC or other controllers with that interface).</p>
<p>If execution_pipeline is set to 'jtac', this Behavior sends the trajectory to a
<code>moveit_pro_controllers_msgs::action::FollowJointTrajectoryWithAdmittance</code> action server (e.g., JTAC).</p>
<p>If the server completes the action successfully, this Behavior succeeds.</p>
<p>If any of the following failure states occur, this Behavior will exit with a FAILURE status code:</p>
<ul>
<li>No action server is available with the specified name.</li>
<li>The joint trajectory message has no data.</li>
<li>absolute_force_torque_threshold is set without admittance_parameters_msg, since the threshold is a field of the admittance parameters and has no effect on its own.</li>
<li>The action result is received, but its contents indicate that the action server failed to execute the trajectory.</li>
</ul>
)"
Definition at line 54 of file execute_trajectory.hpp.
kPortAbsoluteForceTorqueThreshold
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortAbsoluteForceTorqueThreshold = "absolute_force_torque_threshold" |
|
constexpr
static
|
kPortAdmittanceParameters
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortAdmittanceParameters = "admittance_parameters_msg" |
|
constexpr
static
|
kPortControllerActionName
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortControllerActionName = "controller_action_name" |
|
constexpr
static
|
kPortExecutionPipeline
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortExecutionPipeline = "execution_pipeline" |
|
constexpr
static
|
kPortGoalDurationTolerance
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortGoalDurationTolerance = "goal_duration_tolerance" |
|
constexpr
static
|
kPortGoalPositionTolerance
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortGoalPositionTolerance = "goal_position_tolerance" |
|
constexpr
static
|
kPortJointTrajectoryMsg
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortJointTrajectoryMsg = "joint_trajectory_msg" |
|
constexpr
static
|
kPortPathPositionTolerance
| constexpr auto moveit_pro::behaviors::ExecuteTrajectory::kPortPathPositionTolerance = "path_position_tolerance" |
|
constexpr
static
|
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.