ValidateTrajectory Class
Checks if a joint trajectory is valid, given a PlanningScene. More...
Declaration
Included Headers
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
| ValidateTrajectory (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
User-implemented function which handles executing the potentially-long-running process. More... | |
| 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 Attributes Index
| rclcpp::Publisher< visualization_msgs::msg::MarkerArray >::SharedPtr | markers_publisher_ |
| std::set< std::string > | contact_namespaces_ |
| std::shared_future< tl::expected< bool, std::string > > | future_ |
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member. More... | |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
Checks if a joint trajectory is valid, given a PlanningScene.
This behavior just checks that the joint trajectory is collision-free at a given density (joint_space_step and cartesian_space_step).
The planning scene is taken as input (instead of querying the current planning scene) to enable the user to set arbitrary planning scenes. Combine with the GetCurrentPlanningScene behavior to use the current planning scene.
The given trajectory must contain exclusively the planning group joints, otherwise an error will be returned.
The debug_solution port holds an MTC Solution message for visualization and approval with WaitForMTCSolutionApproval: the whole trajectory when it is valid, otherwise the trajectory truncated so that its last waypoint is the colliding one. Executing a truncated solution drives the robot into that collision.
A trajectory that collides also draws the offending waypoint in the 3D Visualizer, as a translucent robot beside the spheres marking where it touches.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| planning_scene_msg | Input | moveit_msgs::msg::PlanningScene |
| planning_group_name | Input | std::string |
| joint_trajectory_msg | Input | trajectory_msgs::msg::JointTrajectory |
| joint_space_step | Input | double |
| cartesian_space_step | Input | double |
| debug_solution | Output | moveit_task_constructor_msgs::msg::Solution |
Definition at line 87 of file validate_trajectory.hpp.
Public Constructors
ValidateTrajectory()
|
Declaration at line 90 of file validate_trajectory.hpp, definition at line 126 of file validate_trajectory.cpp.
Private Member Functions
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 98 of file validate_trajectory.hpp, definition at line 162 of file validate_trajectory.cpp.
getFuture()
| inline 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.
Definition at line 100 of file validate_trajectory.hpp.
Private Member Attributes
contact_namespaces_
|
Where the previous attempt drew contact spheres, so this one can retract them. Declared before future_ so it outlives the worker that touches it.
Definition at line 111 of file validate_trajectory.hpp.
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 114 of file validate_trajectory.hpp.
markers_publisher_
|
Definition at line 107 of file validate_trajectory.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 95 of file validate_trajectory.hpp, definition at line 156 of file validate_trajectory.cpp.
providedPorts()
| static |
Declaration at line 93 of file validate_trajectory.hpp, definition at line 134 of file validate_trajectory.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.