3 #ifndef ROBOWFLEX_TRAJOPT_PLANNER_
4 #define ROBOWFLEX_TRAJOPT_PLANNER_
9 #include <tesseract_planning/trajopt/trajopt_planner.h>
10 #include <tesseract_ros/kdl/kdl_env.h>
142 void setInitType(
const trajopt::InitInfo::Type &init_type);
147 const robot_trajectory::RobotTrajectoryPtr &
getTrajectory()
const;
200 const robot_state::RobotStatePtr &goal_state);
355 tesseract::tesseract_ros::KDLEnvPtr
env_;
362 trajopt::InitInfo::Type
init_type_{trajopt::InitInfo::Type::STATIONARY};
#define ROBOWFLEX_CLASS_FORWARD(C)
Macro that forward declares a class and defines two shared ptrs types:
A shared pointer wrapper for robowflex::MotionRequestBuilder.
An abstract interface to a motion planning algorithm.
A shared pointer wrapper for robowflex::Robot.
A const shared pointer wrapper for robowflex::Scene.
Robowflex Tesseract TrajOpt Planner.
const trajopt::TrajArray & getTesseractTrajectory() const
Get the trajectory that resulted in the last call to plan() in Tesseract format.
void addGoalState(const MotionRequestBuilderPtr &request, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add a (joint) configuration constraint in the last waypoint taken from request.
trajopt::TrajArray tesseract_trajectory_
std::shared_ptr< std::ofstream > stream_ptr_
Debug file stream.
std::string manip_
Name of manipulator chain to check for collisions.
void addGoalState(const robot_state::RobotStatePtr &goal_state, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add a (joint) configuration constraint goal_state in the last waypoint.
robot_state::RobotStatePtr ref_state_
Reference state to build moveit trajectory waypoints.
double getPlanningTime() const
Get the time spent by the planner the last time it was called.
const std::vector< std::string > & getManipulatorJoints() const
Get the joint names of the env manipulator.
const std::vector< std::string > & getEnvironmentLinks() const
Get the link names in the tesseract KDL environment.
sco::BasicTrustRegionSQPParameters getTrustRegionSQPParameters() const
Get parameters of the SQP.
double time_
Time taken by the optimizer the last time it was called.
void addCollisionAvoidance(std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add collision avoidance cost to the trajectory optimization for all waypoints.
struct robowflex::TrajOptPlanner::Options options
void setWriteFile(bool file_write_cb, const std::string &file_path="")
Set whether a report file (for the optimization) should be written or not.
void setInitialTrajectory(const robot_trajectory::RobotTrajectoryPtr &init_trajectory)
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ.
void addGoalPose(const RobotPose &goal_pose, const std::string &link, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add a cartesian pose constraint goal_pose for link in the last waypoint.
void addVelocityCost(std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add velocity cost to the trajectory optimization.
const std::vector< std::string > & getManipulatorLinks() const
Get the link names of the env manipulator.
std::vector< std::string > getPlannerConfigs() const override
Get planner configurations offered by this planner. Any of the configurations returned can be set as ...
bool file_write_cb_
Whether to write a debug file or not.
bool cont_cc_
Use continuous collision checking.
void addStartState(const robot_state::RobotStatePtr &start_state, std::shared_ptr< trajopt::ProblemConstructionInfo > pci)
Add a (joint) configuration constraint start_state in the first waypoint.
void problemConstructionInfo(std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Create a TrajOpt problem construction info object with default values.
void setInitialTrajectory(const trajopt::TrajArray &init_trajectory)
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ.
trajopt::TrajArray initial_trajectory_
Initial trajectory (if any).
void fixJoints(const std::vector< std::string > &joints)
Constrain certain joints during optimization to their initial value.
std::pair< bool, bool > PlannerResult
Planner result: first->converged, second->collision_free.
void addStartState(const std::unordered_map< std::string, double > &start_state, std::shared_ptr< trajopt::ProblemConstructionInfo > pci)
Add a (joint) configuration constraint start_state in the first waypoint.
PlannerResult solve(const SceneConstPtr &scene, const std::shared_ptr< trajopt::ProblemConstructionInfo > &pci)
Solve SQP optimization problem.
trajopt::InitInfo::Type init_type_
robot_trajectory::RobotTrajectoryPtr trajectory_
const robot_trajectory::RobotTrajectoryPtr & getTrajectory() const
Get the trajectory that resulted in the last call to plan().
std::string group_
Name of group to plan for.
std::string file_path_
Path of debug file.
void addStartState(const MotionRequestBuilderPtr &request, std::shared_ptr< trajopt::ProblemConstructionInfo > pci)
Add a (joint) configuration constraint in the first waypoint taken from request.
void addStartPose(const RobotPose &start_pose, const std::string &link, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add a cartesian pose constraint start_pose for link in the first waypoint.
planning_interface::MotionPlanResponse plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override
Plan a motion given a request and a scene.
bool initialize(const std::string &manip)
Initialize planner. The user must specify a chain group defined in the robot's srdf that contains all...
void setInitType(const trajopt::InitInfo::Type &init_type)
Set type of initialization to use for the trajectory optimization. Current options are: STATIONARY JO...
std::vector< int > fixed_joints_
TrajOptPlanner(const RobotPtr &robot, const std::string &group_name, const std::string &name="trajopt")
Constructor.
tesseract::tesseract_ros::KDLEnvPtr env_
KDL environment.
void addGoalState(const std::vector< double > goal_state, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const
Add a (joint) configuration constraint goal_state in the last waypoint.
moveit_msgs::MotionPlanRequest MotionPlanRequest
Functions for loading and animating robots in Blender.
Main namespace. Contains all library classes and functions.
std::decay< decltype(std::declval< moveit::core::Transforms >().getTransform("")) >::type RobotPose
A pose (point in SE(3)) used in various functions. Defined from what MoveIt! uses.
Functions for loading and animating scenes in Blender.
Options structure with parameter values for TrajOpt planner.
double pose_cnt_rot_coeffs
Coefficients for pose constraints (rotation).
bool use_time
Whether any cost/cnt use time.
bool use_cont_col_avoid
Whether to use continuous collision avoidance or not.
double merit_coeff_increase_ratio
Ratio that we increate coeff each time.
double improve_ratio_threshold
double min_approx_improve
sco::ModelType backend_optimizer
Optimizer to use.
double joint_vel_coeffs
Coefficients for joint_vel costs.
double dt_lower_lim
1/max_dt.
double max_merit_coeff_increases
Number of times that we jack up penalty coefficient.
double joint_pos_cnt_coeffs
Coefficients for joint position constraints.
double default_safety_margin
Default safety margin for collision avoidance.
bool return_after_timeout
double merit_error_coeff
Initial penalty coefficient.
double trust_expand_ratio
double joint_pose_safety_margin_coeffs
double dt_upper_lim
1/min_dt.
double init_info_dt
Value of dt in init_info.
bool start_fixed
Whether to use the current env state as a fixed initial state.
int num_waypoints
Number of waypoints.
double joint_state_safety_margin_coeffs
double min_approx_improve_frac
double trust_box_size
Current size of trust region (component-wise).
double max_iter
The max number of iterations.
double min_trust_box_size
double trust_shrink_ratio
double pose_cnt_pos_coeffs
Coefficients for pose constraints (position).
double default_safety_margin_coeffs
Coefficients for safety margin.