Robowflex
v0.1
Making MoveIt Easy
|
Robowflex Tesseract TrajOpt Planner. More...
#include <trajopt_planner.h>
Classes | |
struct | Options |
Options structure with parameter values for TrajOpt planner. More... | |
Public Types | |
typedef std::pair< bool, bool > | PlannerResult |
Planner result: first->converged, second->collision_free. More... | |
Public Types inherited from robowflex::Planner | |
using | ProgressProperty = std::function< std::string()> |
A function that returns the value of a planner property over the course of a run. More... | |
Public Member Functions | |
TrajOptPlanner (const RobotPtr &robot, const std::string &group_name, const std::string &name="trajopt") | |
Constructor. More... | |
bool | initialize (const std::string &manip) |
Initialize planner. The user must specify a chain group defined in the robot's srdf that contains all the links of the manipulator. More... | |
bool | initialize (const std::string &base_link, const std::string &tip_link) |
Initialize planner. All links between base_link and tip_link will be added to the manipulator. More... | |
Set and get TrajOpt parameters | |
void | setInitialTrajectory (const robot_trajectory::RobotTrajectoryPtr &init_trajectory) |
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ. More... | |
void | setInitialTrajectory (const trajopt::TrajArray &init_trajectory) |
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ. More... | |
void | setInitType (const trajopt::InitInfo::Type &init_type) |
Set type of initialization to use for the trajectory optimization. Current options are: STATIONARY JOINT_INTERPOLATED The user can also provide their own trajectory using setInitialTrajectory(). In such case, there is no need to call setInitType(). More... | |
const robot_trajectory::RobotTrajectoryPtr & | getTrajectory () const |
Get the trajectory that resulted in the last call to plan(). More... | |
const trajopt::TrajArray & | getTesseractTrajectory () const |
Get the trajectory that resulted in the last call to plan() in Tesseract format. More... | |
const std::vector< std::string > & | getEnvironmentLinks () const |
Get the link names in the tesseract KDL environment. More... | |
const std::vector< std::string > & | getManipulatorLinks () const |
Get the link names of the env manipulator. More... | |
const std::vector< std::string > & | getManipulatorJoints () const |
Get the joint names of the env manipulator. More... | |
double | getPlanningTime () const |
Get the time spent by the planner the last time it was called. More... | |
void | fixJoints (const std::vector< std::string > &joints) |
Constrain certain joints during optimization to their initial value. More... | |
Planning functions | |
planning_interface::MotionPlanResponse | plan (const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override |
Plan a motion given a request and a scene. More... | |
PlannerResult | plan (const SceneConstPtr &scene, const robot_state::RobotStatePtr &start_state, const robot_state::RobotStatePtr &goal_state) |
Plan a motion using a scene from start_state to a goal_state. More... | |
PlannerResult | plan (const SceneConstPtr &scene, const robot_state::RobotStatePtr &start_state, const RobotPose &goal_pose, const std::string &link) |
Plan a motion given a start_state, a goal_pose for a link and a scene. More... | |
PlannerResult | plan (const SceneConstPtr &scene, const std::unordered_map< std::string, double > &start_state, const RobotPose &goal_pose, const std::string &link) |
Plan a motion given a start_state, a goal_pose for a link and a scene. More... | |
PlannerResult | plan (const SceneConstPtr &scene, const RobotPose &start_pose, const std::string &start_link, const RobotPose &goal_pose, const std::string &goal_link) |
Plan a motion given a start_pose for start_link and a goal_pose for goal_link. More... | |
virtual PlannerResult | plan (const SceneConstPtr &scene, const robot_state::RobotStatePtr &start_state) |
Plan a motion using custom terms specified by the user. More... | |
std::vector< std::string > | getPlannerConfigs () const override |
Get planner configurations offered by this planner. Any of the configurations returned can be set as the planner for a motion planning query sent to plan(). More... | |
Debugging 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. More... | |
Public Member Functions inherited from robowflex::Planner | |
Planner (const RobotPtr &robot, const std::string &name="") | |
Constructor. Takes in a robot description and an optional namespace name. If name is specified, planner parameters are namespaced under the namespace of robot. More... | |
Planner (Planner const &)=delete | |
void | operator= (Planner const &)=delete |
virtual std::map< std::string, ProgressProperty > | getProgressProperties (const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const |
Retrieve the planner progress property map for this planner given a specific request. More... | |
const RobotPtr | getRobot () const |
Return the robot for this planner. More... | |
const std::string & | getName () const |
Get the name of the planner. More... | |
virtual void | preRun (const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) |
This function is called before benchmarking. More... | |
Public Attributes | |
struct robowflex::TrajOptPlanner::Options | options |
Protected Member Functions | |
void | problemConstructionInfo (std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const |
Create a TrajOpt problem construction info object with default values. More... | |
void | addVelocityCost (std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const |
Add velocity cost to the trajectory optimization. More... | |
void | addCollisionAvoidance (std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const |
Add collision avoidance cost to the trajectory optimization for all waypoints. More... | |
void | addStartState (const MotionRequestBuilderPtr &request, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) |
Add a (joint) configuration constraint in the first waypoint taken from request. More... | |
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. More... | |
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. More... | |
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. More... | |
void | addGoalState (const MotionRequestBuilderPtr &request, std::shared_ptr< trajopt::ProblemConstructionInfo > pci) const |
Add a (joint) configuration constraint in the last waypoint taken from request. More... | |
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. More... | |
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. More... | |
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. More... | |
PlannerResult | solve (const SceneConstPtr &scene, const std::shared_ptr< trajopt::ProblemConstructionInfo > &pci) |
Solve SQP optimization problem. More... | |
sco::BasicTrustRegionSQPParameters | getTrustRegionSQPParameters () const |
Get parameters of the SQP. More... | |
Protected Attributes | |
robot_trajectory::RobotTrajectoryPtr | trajectory_ |
trajopt::TrajArray | tesseract_trajectory_ |
tesseract::tesseract_ros::KDLEnvPtr | env_ |
KDL environment. More... | |
std::string | group_ |
Name of group to plan for. More... | |
std::string | manip_ |
Name of manipulator chain to check for collisions. More... | |
bool | cont_cc_ {true} |
Use continuous collision checking. More... | |
std::shared_ptr< std::ofstream > | stream_ptr_ |
Debug file stream. More... | |
std::string | file_path_ |
Path of debug file. More... | |
bool | file_write_cb_ {false} |
Whether to write a debug file or not. More... | |
trajopt::InitInfo::Type | init_type_ {trajopt::InitInfo::Type::STATIONARY} |
trajopt::TrajArray | initial_trajectory_ |
Initial trajectory (if any). More... | |
double | time_ {0.0} |
Time taken by the optimizer the last time it was called. More... | |
std::vector< int > | fixed_joints_ |
robot_state::RobotStatePtr | ref_state_ |
Reference state to build moveit trajectory waypoints. More... | |
Protected Attributes inherited from robowflex::Planner | |
RobotPtr | robot_ |
The robot to plan for. More... | |
IO::Handler | handler_ |
The parameter handler for the planner. More... | |
const std::string | name_ |
Namespace for the planner. More... | |
Robowflex Tesseract TrajOpt Planner.
Definition at line 33 of file trajopt_planner.h.
typedef std::pair<bool, bool> robowflex::TrajOptPlanner::PlannerResult |
Planner result: first->converged, second->collision_free.
Definition at line 96 of file trajopt_planner.h.
TrajOptPlanner::TrajOptPlanner | ( | const RobotPtr & | robot, |
const std::string & | group_name, | ||
const std::string & | name = "trajopt" |
||
) |
Constructor.
[in] | robot | Robot to plan for. |
[in] | group_name | Name of the (joint) group to plan for. |
[in] | name | Name of planner. |
Definition at line 24 of file trajopt_planner.cpp.
|
protected |
Add collision avoidance cost to the trajectory optimization for all waypoints.
[out] | pci | Pointer to problem construction info with collision avoidance added. |
Definition at line 478 of file trajopt_planner.cpp.
|
protected |
Add a cartesian pose constraint goal_pose for link in the last waypoint.
[in] | goal_pose | Desired goal cartesian pose of link. |
[in] | link | Link that will be constrained to be in goal_pose in the last waypoint. |
[out] | pci | Pointer to problem construction info with goal pose constraint added. |
Definition at line 572 of file trajopt_planner.cpp.
|
protected |
Add a (joint) configuration constraint in the last waypoint taken from request.
[in] | request | Request motion planning problem. |
[out] | pci | Pointer to problem construction info with goal state constraint added. |
|
protected |
Add a (joint) configuration constraint goal_state in the last waypoint.
[in] | goal_state | Desired robot's goal state. |
[out] | pci | Pointer to problem construction info with goal state constraint added. |
|
protected |
Add a (joint) configuration constraint goal_state in the last waypoint.
[in] | goal_state | Desired goal manipulator's joint values. |
[out] | pci | Pointer to problem construction info with goal state constraint added. |
|
protected |
Add a cartesian pose constraint start_pose for link in the first waypoint.
[in] | start_pose | Desired start cartesian pose of link. |
[in] | link | Link that will be constrained to be in start_pose in the first waypoint. |
[out] | pci | Pointer to problem construction info with start pose constraint added. |
Definition at line 519 of file trajopt_planner.cpp.
|
protected |
Add a (joint) configuration constraint in the first waypoint taken from request.
[in] | request | Request motion planning problem. |
[out] | pci | Pointer to problem construction info with start state constraint added. |
|
protected |
Add a (joint) configuration constraint start_state in the first waypoint.
[in] | start_state | Desired robot's start state. |
[out] | pci | Pointer to problem construction info with start state constraint added. |
|
protected |
Add a (joint) configuration constraint start_state in the first waypoint.
[in] | start_state | Desired start manipulator's joint names/values. |
[out] | pci | Pointer to problem construction info with start state constraint added. |
|
protected |
Add velocity cost to the trajectory optimization.
[out] | pci | Pointer to problem construction info with velocity cost added. |
Definition at line 465 of file trajopt_planner.cpp.
void TrajOptPlanner::fixJoints | ( | const std::vector< std::string > & | joints | ) |
Constrain certain joints during optimization to their initial value.
[in] | joints | Vector of joints to freeze. |
Definition at line 173 of file trajopt_planner.cpp.
const std::vector< std::string > & TrajOptPlanner::getEnvironmentLinks | ( | ) | const |
Get the link names in the tesseract KDL environment.
Definition at line 144 of file trajopt_planner.cpp.
const std::vector< std::string > & TrajOptPlanner::getManipulatorJoints | ( | ) | const |
Get the joint names of the env manipulator.
Definition at line 160 of file trajopt_planner.cpp.
const std::vector< std::string > & TrajOptPlanner::getManipulatorLinks | ( | ) | const |
Get the link names of the env manipulator.
Definition at line 152 of file trajopt_planner.cpp.
|
overridevirtual |
Get planner configurations offered by this planner. Any of the configurations returned can be set as the planner for a motion planning query sent to plan().
Implements robowflex::Planner.
Definition at line 427 of file trajopt_planner.cpp.
double TrajOptPlanner::getPlanningTime | ( | ) | const |
Get the time spent by the planner the last time it was called.
Definition at line 168 of file trajopt_planner.cpp.
const trajopt::TrajArray & TrajOptPlanner::getTesseractTrajectory | ( | ) | const |
Get the trajectory that resulted in the last call to plan() in Tesseract format.
Definition at line 139 of file trajopt_planner.cpp.
const robot_trajectory::RobotTrajectoryPtr & TrajOptPlanner::getTrajectory | ( | ) | const |
Get the trajectory that resulted in the last call to plan().
Definition at line 134 of file trajopt_planner.cpp.
|
protected |
Get parameters of the SQP.
Definition at line 701 of file trajopt_planner.cpp.
bool TrajOptPlanner::initialize | ( | const std::string & | base_link, |
const std::string & | tip_link | ||
) |
Initialize planner. All links between base_link and tip_link will be added to the manipulator.
[in] | base_link | Base link of the manip. |
[in] | tip_link | Tip link of the manip. |
Definition at line 56 of file trajopt_planner.cpp.
bool TrajOptPlanner::initialize | ( | const std::string & | manip | ) |
Initialize planner. The user must specify a chain group defined in the robot's srdf that contains all the links of the manipulator.
[in] | manip | Name of chain group with all the links of the manipulator. |
Definition at line 29 of file trajopt_planner.cpp.
|
overridevirtual |
Plan a motion given a request and a scene.
[in] | scene | A planning scene to compute the plan in. |
[in] | request | The motion planning request to solve. |
Implements robowflex::Planner.
Definition at line 195 of file trajopt_planner.cpp.
|
virtual |
Plan a motion using custom terms specified by the user.
[in] | scene | A planning scene to compute the plan in. |
[in] | start_state | Start state for the robot. |
Reimplemented in CustomTrajOptPlanner.
Definition at line 421 of file trajopt_planner.cpp.
TrajOptPlanner::PlannerResult TrajOptPlanner::plan | ( | const SceneConstPtr & | scene, |
const robot_state::RobotStatePtr & | start_state, | ||
const robot_state::RobotStatePtr & | goal_state | ||
) |
Plan a motion using a scene from start_state to a goal_state.
[in] | scene | Scene to plan for. |
[in] | start_state | Start state for the robot. |
[in] | goal_state | Goal state for the robot. |
Definition at line 249 of file trajopt_planner.cpp.
TrajOptPlanner::PlannerResult TrajOptPlanner::plan | ( | const SceneConstPtr & | scene, |
const robot_state::RobotStatePtr & | start_state, | ||
const RobotPose & | goal_pose, | ||
const std::string & | link | ||
) |
Plan a motion given a start_state, a goal_pose for a link and a scene.
[in] | scene | A planning scene for the same robot to compute the plan in. |
[in] | start_state | Start state for the robot. |
[in] | goal_pose | Cartesian goal pose for link. |
[in] | link | Link to find pose for. |
Definition at line 282 of file trajopt_planner.cpp.
TrajOptPlanner::PlannerResult TrajOptPlanner::plan | ( | const SceneConstPtr & | scene, |
const RobotPose & | start_pose, | ||
const std::string & | start_link, | ||
const RobotPose & | goal_pose, | ||
const std::string & | goal_link | ||
) |
Plan a motion given a start_pose for start_link and a goal_pose for goal_link.
[in] | scene | A planning scene to compute the plan in. |
[in] | start_pose | Cartesian start pose for start_link. |
[in] | start_link | Robot's link with start_pose. |
[in] | goal_pose | Cartesian goal pose for goal_link. |
[in] | goal_link | Robot's link with goal_pose. |
Definition at line 376 of file trajopt_planner.cpp.
TrajOptPlanner::PlannerResult TrajOptPlanner::plan | ( | const SceneConstPtr & | scene, |
const std::unordered_map< std::string, double > & | start_state, | ||
const RobotPose & | goal_pose, | ||
const std::string & | link | ||
) |
Plan a motion given a start_state, a goal_pose for a link and a scene.
[in] | scene | A planning scene for the same robot to compute the plan in. |
[in] | start_state | Start state for the robot. |
[in] | goal_pose | Cartesian goal pose for link. |
[in] | link | Link to find pose for. |
Definition at line 332 of file trajopt_planner.cpp.
|
protected |
Create a TrajOpt problem construction info object with default values.
[out] | pci | Pointer to problem construction info initialized. |
Definition at line 445 of file trajopt_planner.cpp.
void TrajOptPlanner::setInitialTrajectory | ( | const robot_trajectory::RobotTrajectoryPtr & | init_trajectory | ) |
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ.
[in] | init_trajectory | Trajectory to initialize TrajOpt. |
Definition at line 114 of file trajopt_planner.cpp.
void robowflex::TrajOptPlanner::setInitialTrajectory | ( | const trajopt::TrajArray & | init_trajectory | ) |
Set initial trajectory for TrajOpt and set init_type to GIVEN_TRAJ.
[in] | init_trajectory | Trajectory to initialize TrajOpt. |
void TrajOptPlanner::setInitType | ( | const trajopt::InitInfo::Type & | init_type | ) |
Set type of initialization to use for the trajectory optimization. Current options are: STATIONARY JOINT_INTERPOLATED The user can also provide their own trajectory using setInitialTrajectory(). In such case, there is no need to call setInitType().
[in] | init_type | Type of initial trajectory to be used. |
Definition at line 126 of file trajopt_planner.cpp.
void TrajOptPlanner::setWriteFile | ( | bool | file_write_cb, |
const std::string & | file_path = "" |
||
) |
Set whether a report file (for the optimization) should be written or not.
[in] | file_write_cb | Whether to write the file or not. |
[in] | file_path | File path |
Definition at line 434 of file trajopt_planner.cpp.
|
protected |
Solve SQP optimization problem.
[in] | scene | Scene to plan for. |
[in] | pci | Pointer to problem construction info initialized. |
Definition at line 588 of file trajopt_planner.cpp.
|
protected |
Use continuous collision checking.
Definition at line 358 of file trajopt_planner.h.
|
protected |
KDL environment.
Definition at line 355 of file trajopt_planner.h.
|
protected |
Path of debug file.
Definition at line 360 of file trajopt_planner.h.
|
protected |
Whether to write a debug file or not.
Definition at line 361 of file trajopt_planner.h.
|
protected |
List of joints that need to be fixed, indexed in the order they appear in the manipulator.
Definition at line 366 of file trajopt_planner.h.
|
protected |
Name of group to plan for.
Definition at line 356 of file trajopt_planner.h.
|
protected |
Type of initial trajectory.
Definition at line 362 of file trajopt_planner.h.
|
protected |
Initial trajectory (if any).
Definition at line 364 of file trajopt_planner.h.
|
protected |
Name of manipulator chain to check for collisions.
Definition at line 357 of file trajopt_planner.h.
struct robowflex::TrajOptPlanner::Options robowflex::TrajOptPlanner::options |
|
protected |
Reference state to build moveit trajectory waypoints.
Definition at line 368 of file trajopt_planner.h.
|
protected |
Debug file stream.
Definition at line 359 of file trajopt_planner.h.
|
protected |
Last successful trajectory generated by the planner in Tesseract format.
Definition at line 353 of file trajopt_planner.h.
|
protected |
Time taken by the optimizer the last time it was called.
Definition at line 365 of file trajopt_planner.h.
|
protected |
Last successful trajectory generated by the planner.
Definition at line 351 of file trajopt_planner.h.