Skip to main content

PlanToJointGoal Class

Given a joint-space goal, plan a joint-space trajectory to reach the goal. More...

Declaration​

class moveit_pro::behaviors::PlanToJointGoal { ... }

Included Headers​

#include <plan_to_joint_goal.hpp>

Base class​

classServiceClientBehaviorBase<ServiceT>

A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...

Public Member Typedefs Index​

usingExtraValidator = std::function< bool(const moveit_pro::base::JointModelGroup &group, const Eigen::VectorXd &positions)>

Additional validation of every joint-space configuration the planner considers, on top of the built-in collision and constraint checks. Returns false to reject the configuration. Supply one through the constructor to reject configurations no per-joint limit can express, such as a coupled bound over several joints. More...

Public Constructors Index​

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

Constructor for PlanToJointGoal behavior. More...

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

Constructor for a derived Behavior that applies extra_validator to every configuration the planner considers. An empty function means no additional validation. More...

PlanToJointGoal (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< moveit_pro::behaviors::BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< GetPlanningScene > > client_interface, ExtraValidator extra_validator={})

Constructor for PlanToJointGoal behavior that allows for mocking of the rclcpp service client. More...

Public Destructor Index​

~PlanToJointGoal () override

Private Member Functions Index​

tl::expected< std::string, std::string >getServiceName () override

User-provided function to get the name of the service when initializing the service client. More...

tl::expected< GetPlanningScene::Request, std::string >createRequest () override

User-provided function to create the service request. More...

tl::expected< bool, std::string >processResponse (const GetPlanningScene::Response &response) override
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 >::SharedPtrcontacts_publisher_
std::stringlast_link_padding_deprecation_warning_
std::set< std::string >contact_namespaces_

Where the previous attempt drew contact spheres, so this one can retract them. More...

std::unique_ptr< scenario_logging::ScenarioWriter >scenario_writer_
std::shared_future< tl::expected< bool, std::string > >future_
boolwarned_scenario_tolerance_collapse_ = false
ExtraValidatorextra_validator_
boolwarned_scenario_extra_validator_ = false

Public Static Functions Index​

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

Description​

Given a joint-space goal, plan a joint-space trajectory to reach the goal.

A custom Behavior that must reject joint-space configurations the built-in collision and constraint checks accept derives from this class and passes an ExtraValidator to the constructor; it inherits the whole port contract, planning-scene setup, constraint resolution, and contact visualization below:

 class PlanToJointGoalAvoidingHoseWrap final : public moveit_pro::behaviors::PlanToJointGoal
 {
 public:
  PlanToJointGoalAvoidingHoseWrap(const std::string& name, const BT::NodeConfiguration& config,
  const std::shared_ptr<BehaviorContext>& shared_resources)
  : PlanToJointGoal(name, config, shared_resources, rejectHoseWrap)
  {
  }
  static BT::KeyValueVector metadata();
 };

It inherits providedPorts() as-is and must define its own static metadata(): registration reads T::metadata(), which is not virtual, so a subclass without one is listed with this Behavior's description and category.

Data Port NamePort TypeObject Type
joint_goalInputmoveit_msgs::msg::RobotState
planning_group_nameInputstd::string
velocity_scale_factorInputdouble
acceleration_scale_factorInputdouble
max_iterationsInputunsigned int
trajectory_sampling_rateInputunsigned int
link_paddingInputdouble (deprecated)
seedInputint
orientation_constraintInputmoveit_studio_msgs::msg::OrientationConstraint
joint_range_constraintInputmoveit_studio_msgs::msg::JointRangeConstraint
optimization_paramsInputmoveit_studio_msgs::msg::ProRRTOptimizationParams
collision_check_paramsInputmoveit_studio_msgs::msg::CollisionCheckParams
joint_costsInputstd::vector<double>
capture_scenarioInputbool
joint_trajectory_msgOutputtrajectory_msgs::msg::JointTrajectory

Definition at line 79 of file plan_to_joint_goal.hpp.

Public Member Typedefs​

ExtraValidator​

using moveit_pro::behaviors::PlanToJointGoal::ExtraValidator = std::function<bool(const moveit_pro::base::JointModelGroup& group, const Eigen::VectorXd& positions)>

Additional validation of every joint-space configuration the planner considers, on top of the built-in collision and constraint checks. Returns false to reject the configuration. Supply one through the constructor to reject configurations no per-joint limit can express, such as a coupled bound over several joints.

Receives the planning group resolved from the planning_group_name port and one value per active variable of that group, in active-variable order with mimic joints excluded. It is passed to pro_rrt::planTrajectoryToJointGoal as its ConfigurationValidator, so it applies to tree extension, refinement, and shortcutting at the planner's validation resolution. It runs on every sampled configuration and every subdivision sample of every transition, from one thread at a time, so keep it cheap and free of side effects. It must not throw. A start or goal it rejects fails the Behavior with the planner's refusal message. Scenario capture cannot record it, so a plan that uses one is not captured.

The group is passed because planning_group_name is a port: a validator written for one group must reject every configuration of any other group rather than accept it, so a misbound port fails the plan visibly instead of planning unconstrained. Resolve joint offsets into the vector once per group and cache them keyed on &group, which is stable for the lifetime of the robot model (reachable through group.getParentModel()), never per sample. A joint's offset is the sum of getVariableCount() over group.getActiveJointModels() up to that joint; JointModelGroup::getVariableGroupIndex() counts mimic joints and is not that offset.

Definition at line 101 of file plan_to_joint_goal.hpp.

Public Constructors​

PlanToJointGoal()​

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

Constructor for PlanToJointGoal behavior.

Declaration at line 107 of file plan_to_joint_goal.hpp, definition at line 261 of file plan_to_joint_goal.cpp.

PlanToJointGoal()​

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

Constructor for a derived Behavior that applies extra_validator to every configuration the planner considers. An empty function means no additional validation.

Declaration at line 114 of file plan_to_joint_goal.hpp, definition at line 267 of file plan_to_joint_goal.cpp.

PlanToJointGoal()​

moveit_pro::behaviors::PlanToJointGoal::PlanToJointGoal (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< moveit_pro::behaviors::BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< GetPlanningScene > > client_interface, ExtraValidator extra_validator={})

Constructor for PlanToJointGoal behavior that allows for mocking of the rclcpp service client.

Declaration at line 120 of file plan_to_joint_goal.hpp, definition at line 276 of file plan_to_joint_goal.cpp.

Public Destructor​

~PlanToJointGoal()​

moveit_pro::behaviors::PlanToJointGoal::~PlanToJointGoal ()

Definition at line 128 of file plan_to_joint_goal.hpp.

Private Member Functions​

createRequest()​

tl::expected< GetPlanningScene::Request, std::string > moveit_pro::behaviors::PlanToJointGoal::createRequest ()
virtual

User-provided function to create the service request.

Returns

Returns a service request message. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 139 of file plan_to_joint_goal.hpp, definition at line 360 of file plan_to_joint_goal.cpp.

getFuture()​

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::PlanToJointGoal::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 146 of file plan_to_joint_goal.hpp.

getServiceName()​

tl::expected< std::string, std::string > moveit_pro::behaviors::PlanToJointGoal::getServiceName ()
virtual

User-provided function to get the name of the service when initializing the service client.

Returns

Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 136 of file plan_to_joint_goal.hpp, definition at line 355 of file plan_to_joint_goal.cpp.

processResponse()​

tl::expected< bool, std::string > moveit_pro::behaviors::PlanToJointGoal::processResponse (const GetPlanningScene::Response & response)

Declaration at line 143 of file plan_to_joint_goal.hpp, definition at line 365 of file plan_to_joint_goal.cpp.

Private Member Attributes​

contact_namespaces_​

std::set<std::string> moveit_pro::behaviors::PlanToJointGoal::contact_namespaces_

Where the previous attempt drew contact spheres, so this one can retract them.

Definition at line 163 of file plan_to_joint_goal.hpp.

contacts_publisher_​

rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr moveit_pro::behaviors::PlanToJointGoal::contacts_publisher_

Definition at line 155 of file plan_to_joint_goal.hpp.

extra_validator_​

ExtraValidator moveit_pro::behaviors::PlanToJointGoal::extra_validator_

Definition at line 179 of file plan_to_joint_goal.hpp.

future_​

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::PlanToJointGoal::future_

Definition at line 170 of file plan_to_joint_goal.hpp.

last_link_padding_deprecation_warning_​

std::string moveit_pro::behaviors::PlanToJointGoal::last_link_padding_deprecation_warning_

Definition at line 160 of file plan_to_joint_goal.hpp.

scenario_writer_​

std::unique_ptr<scenario_logging::ScenarioWriter> moveit_pro::behaviors::PlanToJointGoal::scenario_writer_

Definition at line 168 of file plan_to_joint_goal.hpp.

warned_scenario_extra_validator_​

bool moveit_pro::behaviors::PlanToJointGoal::warned_scenario_extra_validator_ = false

Definition at line 183 of file plan_to_joint_goal.hpp.

warned_scenario_tolerance_collapse_​

bool moveit_pro::behaviors::PlanToJointGoal::warned_scenario_tolerance_collapse_ = false

Definition at line 175 of file plan_to_joint_goal.hpp.

Public Static Functions​

metadata()​

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

Declaration at line 132 of file plan_to_joint_goal.hpp, definition at line 350 of file plan_to_joint_goal.cpp.

providedPorts()​

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

Declaration at line 130 of file plan_to_joint_goal.hpp, definition at line 289 of file plan_to_joint_goal.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.