Robowflex
v0.1
Making MoveIt Easy
|
Robot IK Query options. IK queries in Robowflex consist of: a) A position specified by some geometric region (a robowflex::Geometry) at a pose. b) An orientation specified by some base orientation with allowable deviations specified by tolerances on the XYZ Euler axes. It is recommended to use the provided constructors to specify a query, or to use the addRequest() function. Multiple target tips can be specified, but note that not all kinematics solvers support multi-tip IK. Additionally, a robowflex::Scene can be specified to do collision-aware IK. More...
#include <robot.h>
Public Types | |
using | Metric = std::function< double(const robot_state::RobotState &state, const SceneConstPtr &scene, const kinematic_constraints::ConstraintEvaluationResult &result)> |
Metric for evaluating states within an IK query. More... | |
Public Member Functions | |
IKQuery (const std::string &group) | |
Constructor. Empty for fine control. More... | |
Directional Offset Constructors | |
IKQuery (const std::string &group, const std::string &tip, const robot_state::RobotState &start, const Eigen::Vector3d &direction, double distance) | |
Constructor. Initialize an IK query based on offsets from an initial robot state. More... | |
IKQuery (const std::string &group, const std::string &tip, const robot_state::RobotState &start, const Eigen::Vector3d &position_offset, const Eigen::Quaterniond &rotation_offset=Eigen::Quaterniond::Identity()) | |
Constructor. Initialize an IK query based on offsets from an initial robot state. More... | |
IKQuery (const std::string &group, const std::string &tip, const robot_state::RobotState &start, const RobotPose &offset) | |
Constructor. Initialize an IK query based on an offset from an initial robot state. Only for single-tip systems. More... | |
Single Target Constructors | |
IKQuery (const std::string &group, const RobotPose &pose, double radius=constants::ik_tolerance, const Eigen::Vector3d &tolerance=constants::ik_vec_tolerance) | |
Constructor. Initialize a basic IK query to reach the desired pose. More... | |
IKQuery (const std::string &group, const Eigen::Vector3d &position, const Eigen::Quaterniond &orientation, double radius=constants::ik_tolerance, const Eigen::Vector3d &tolerance=constants::ik_vec_tolerance) | |
Constructor. Initialize a basic IK query to reach the desired position and orientation. More... | |
IKQuery (const std::string &group, const GeometryConstPtr ®ion, const RobotPose &pose, const Eigen::Quaterniond &orientation, const Eigen::Vector3d &tolerance=constants::ik_vec_tolerance, const ScenePtr &scene=nullptr, bool verbose=false) | |
Constructor. Initialize an IK query to reach somewhere in the provided region (at a pose) and orientation. More... | |
IKQuery (const std::string &group, const RobotPose &offset, const ScenePtr &scene, const std::string &object, const Eigen::Vector3d &tolerances=constants::ik_vec_tolerance, bool verbose=false) | |
IKQuery (const std::string &group, const moveit_msgs::PositionConstraint &pc, const moveit_msgs::OrientationConstraint &oc) | |
Constructor. Initialize an IK query from MoveIt message constraints. More... | |
Multiple Target Constructors | |
IKQuery (const std::string &group, const RobotPoseVector &poses, const std::vector< std::string > &input_tips, double radius=constants::ik_tolerance, const Eigen::Vector3d &tolerance=constants::ik_vec_tolerance, const ScenePtr &scene=nullptr, bool verbose=false) | |
Constructor. Initialize a basic multi-target IK query so that each of the tips reach their desired poses. More... | |
IKQuery (const std::string &group, const std::vector< std::string > &input_tips, const std::vector< GeometryConstPtr > ®ions, const RobotPoseVector &poses, const std::vector< Eigen::Quaterniond > &orientations, const EigenSTL::vector_Vector3d &tolerances, const ScenePtr &scene=nullptr, bool verbose=false) | |
Other Setters | |
void | addRequest (const std::string &tip, const GeometryConstPtr ®ion, const RobotPose &pose, const Eigen::Quaterniond &orientation, const Eigen::Vector3d &tolerance=constants::ik_vec_tolerance) |
Add a request for a tip. More... | |
void | setScene (const ScenePtr &scene, bool verbose=false) |
Set a scene to use for collision checking for this IK request. More... | |
void | addMetric (const Metric &metric_function) |
Add a metric to this IK query. More... | |
void | addDistanceMetric (double weight=1.) |
Add a metric to the query to evaluate distance to constraint. More... | |
void | addCenteringMetric (double weight=1.) |
Add a metric to the query to evaluate how "centered" the joints of the robot are (from their 0 position). More... | |
void | addClearanceMetric (double weight=1.) |
Add a metric to the query to evaluate clearance from provided scene. More... | |
Sampling Region | |
bool | sampleRegion (RobotPose &pose, std::size_t index) const |
Sample desired end-effector pose for region at index. More... | |
bool | sampleRegions (RobotPoseVector &poses) const |
Sample desired end-effector pose for each region. More... | |
Other Functions | |
void | getMessage (const std::string &base_frame, moveit_msgs::Constraints &msg) const |
Get this IK query as a constraint message. More... | |
kinematic_constraints::KinematicConstraintSetPtr | getAsConstraints (const Robot &robot) const |
Get this IK query as a kinematic constraint set. More... | |
double | getMetricValue (const robot_state::RobotState &state, const kinematic_constraints::ConstraintEvaluationResult &result) const |
Get the value of the metrics assigned to this query for a given state and result. More... | |
Public Attributes | |
ROBOWFLEX_EIGEN | |
Query Targets | |
std::string | group |
Target joint group to do IK for. More... | |
std::vector< std::string > | tips |
List of end-effectors. More... | |
std::vector< GeometryConstPtr > | regions |
Regions to sample target positions from. More... | |
RobotPoseVector | region_poses |
Poses of regions. More... | |
std::vector< Eigen::Quaterniond > | orientations |
Target orientations. More... | |
EigenSTL::vector_Vector3d | tolerances |
XYZ Euler orientation tolerances. More... | |
Additional Solver Options | |
SceneConstPtr | scene |
If provided, use this scene for collision checking. More... | |
bool | verbose {false} |
Verbose output of collision checking. More... | |
bool | random_restart {true} |
Randomly reset joint states. More... | |
kinematics::KinematicsQueryOptions | options |
Other query options. More... | |
std::size_t | attempts {constants::ik_attempts} |
IK attempts (samples within regions). More... | |
double | timeout {0.} |
Timeout for each query. More... | |
bool | validate {false} |
double | valid_distance {0.} |
std::vector< Metric > | metrics |
Robot IK Query options. IK queries in Robowflex consist of: a) A position specified by some geometric region (a robowflex::Geometry) at a pose. b) An orientation specified by some base orientation with allowable deviations specified by tolerances on the XYZ Euler axes. It is recommended to use the provided constructors to specify a query, or to use the addRequest() function. Multiple target tips can be specified, but note that not all kinematics solvers support multi-tip IK. Additionally, a robowflex::Scene can be specified to do collision-aware IK.
Definition at line 374 of file robowflex_library/include/robowflex_library/robot.h.
using robowflex::Robot::IKQuery::Metric = std::function<double(const robot_state::RobotState &state, const SceneConstPtr &scene, const kinematic_constraints::ConstraintEvaluationResult &result)> |
Metric for evaluating states within an IK query.
[in] | state | Resulting state from query. |
[in] | scene | Input scene for query, if available. Nullptr otherwise. |
[in] | result | Result of evaluating validity of constraint. |
Definition at line 384 of file robowflex_library/include/robowflex_library/robot.h.
Robot::IKQuery::IKQuery | ( | const std::string & | group | ) |
Constructor. Empty for fine control.
[in] | group | Group to set. |
Definition at line 607 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const std::string & | tip, | ||
const robot_state::RobotState & | start, | ||
const Eigen::Vector3d & | direction, | ||
double | distance | ||
) |
Constructor. Initialize an IK query based on offsets from an initial robot state.
[in] | group | Group to set. |
[in] | tip | Tip frame to apply offset to. |
[in] | start | Initial robot state to compute offset for. |
[in] | direction | Vector direction of end-effector motion. Will be used as unit vector. |
[in] | distance | Distance to travel in that direction. |
Definition at line 611 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const std::string & | tip, | ||
const robot_state::RobotState & | start, | ||
const Eigen::Vector3d & | position_offset, | ||
const Eigen::Quaterniond & | rotation_offset = Eigen::Quaterniond::Identity() |
||
) |
Constructor. Initialize an IK query based on offsets from an initial robot state.
[in] | group | Group to set. |
[in] | tip | Tip frame to apply offset to. |
[in] | start | Initial robot state to compute offset for. |
[in] | position_offset | Position offset to apply from current tip position. |
[in] | rotation_offset | Rotational offset to apply from current tip position. |
Definition at line 618 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const std::string & | tip, | ||
const robot_state::RobotState & | start, | ||
const RobotPose & | offset | ||
) |
Constructor. Initialize an IK query based on an offset from an initial robot state. Only for single-tip systems.
[in] | group | Group to set. |
[in] | tip | Tip frame to apply offset to. |
[in] | start | Initial robot state to compute offset for. |
[in] | offset | Offset to apply from current tip position. |
Definition at line 625 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const RobotPose & | pose, | ||
double | radius = constants::ik_tolerance , |
||
const Eigen::Vector3d & | tolerance = constants::ik_vec_tolerance |
||
) |
Constructor. Initialize a basic IK query to reach the desired pose.
[in] | group | Group to set. |
[in] | pose | Desired pose of end-effector. |
[in] | radius | Radius tolerance around position. |
[in] | tolerances | Tolerance about orientation. |
Definition at line 646 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const Eigen::Vector3d & | position, | ||
const Eigen::Quaterniond & | orientation, | ||
double | radius = constants::ik_tolerance , |
||
const Eigen::Vector3d & | tolerance = constants::ik_vec_tolerance |
||
) |
Constructor. Initialize a basic IK query to reach the desired position and orientation.
[in] | group | Group to set. |
[in] | position | Position to achieve. |
[in] | orientation | Mean orientation. |
[in] | radius | Radius tolerance around position. |
[in] | tolerances | Tolerance about orientation. |
Definition at line 656 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const GeometryConstPtr & | region, | ||
const RobotPose & | pose, | ||
const Eigen::Quaterniond & | orientation, | ||
const Eigen::Vector3d & | tolerance = constants::ik_vec_tolerance , |
||
const ScenePtr & | scene = nullptr , |
||
bool | verbose = false |
||
) |
Constructor. Initialize an IK query to reach somewhere in the provided region (at a pose) and orientation.
[in] | group | Group to set. |
[in] | region | Region of points for position. |
[in] | pose | Pose of the region. |
[in] | orientation | Mean orientation. |
[in] | tolerances | Tolerance about orientation. |
[in] | scene | Optional scene to do collision checking against. |
[in] | verbose | If true, will give verbose collision checking output. |
Definition at line 667 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const RobotPose & | offset, | ||
const ScenePtr & | scene, | ||
const std::string & | object, | ||
const Eigen::Vector3d & | tolerances = constants::ik_vec_tolerance , |
||
bool | verbose = false |
||
) |
Constructor. Initialize a basic IK query to grasp an object.
[in] | group | Group to set. |
[in] | offset | Offset of end-effector from object frame. |
[in] | scene | Scene that object is in. |
[in] | object | Name of object to grasp. |
[in] | tolerances | Position tolerances on the XYZ axes for the grasp. |
[in] | verbose | If true, will give verbose collision checking output. |
Definition at line 631 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const moveit_msgs::PositionConstraint & | pc, | ||
const moveit_msgs::OrientationConstraint & | oc | ||
) |
Constructor. Initialize an IK query from MoveIt message constraints.
[in] | group | Group to set. |
[in] | pc | Position constraint. |
[in] | oc | Orientation constraint. |
Definition at line 675 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const RobotPoseVector & | poses, | ||
const std::vector< std::string > & | input_tips, | ||
double | radius = constants::ik_tolerance , |
||
const Eigen::Vector3d & | tolerance = constants::ik_vec_tolerance , |
||
const ScenePtr & | scene = nullptr , |
||
bool | verbose = false |
||
) |
Constructor. Initialize a basic multi-target IK query so that each of the tips reach their desired poses.
[in] | group | Group to set. |
[in] | poses | Desired poses of end-effector tips. |
[in] | input_tips | End-effector tips to target. |
[in] | radius | Radius tolerance around position. |
[in] | tolerances | Tolerance about orientation. |
[in] | scene | Optional scene to do collision checking against. |
[in] | verbose | If true, will give verbose collision checking output. |
Definition at line 705 of file robowflex_library/src/robot.cpp.
Robot::IKQuery::IKQuery | ( | const std::string & | group, |
const std::vector< std::string > & | input_tips, | ||
const std::vector< GeometryConstPtr > & | regions, | ||
const RobotPoseVector & | poses, | ||
const std::vector< Eigen::Quaterniond > & | orientations, | ||
const EigenSTL::vector_Vector3d & | tolerances, | ||
const ScenePtr & | scene = nullptr , |
||
bool | verbose = false |
||
) |
Constructor. Initialize a multi-target IK query so that each of the tips reach somewhere in the provided region (at a pose) and orientation.
[in] | group | Group to set. |
[in] | input_tips | End-effector tips to target. |
[in] | regions | Region of points for position for each tip. |
[in] | poses | Pose of the region for each tip. |
[in] | orientations | Mean orientation for each tip. |
[in] | tolerances | Tolerance about orientation for each tip. |
[in] | scene | Optional scene to do collision checking against. |
[in] | verbose | If true, will give verbose collision checking output. |
Definition at line 721 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::addCenteringMetric | ( | double | weight = 1. | ) |
Add a metric to the query to evaluate how "centered" the joints of the robot are (from their 0 position).
[in] | weight | Multiplicative weight to metric value. |
Definition at line 766 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::addClearanceMetric | ( | double | weight = 1. | ) |
Add a metric to the query to evaluate clearance from provided scene.
[in] | weight | Multiplicative weight to metric value. |
Definition at line 777 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::addDistanceMetric | ( | double | weight = 1. | ) |
Add a metric to the query to evaluate distance to constraint.
[in] | weight | Multiplicative weight to metric value. |
Definition at line 758 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::addMetric | ( | const Metric & | metric_function | ) |
Add a metric to this IK query.
[in] | metric_function | Metric to add to query. |
Definition at line 753 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::addRequest | ( | const std::string & | tip, |
const GeometryConstPtr & | region, | ||
const RobotPose & | pose, | ||
const Eigen::Quaterniond & | orientation, | ||
const Eigen::Vector3d & | tolerance = constants::ik_vec_tolerance |
||
) |
Add a request for a tip.
[in] | tip | Tip for the request. |
[in] | region | Region of points for position. |
[in] | pose | Pose of the region. |
[in] | orientation | Mean orientation. |
[in] | tolerances | Tolerance about orientation. |
Definition at line 737 of file robowflex_library/src/robot.cpp.
kinematic_constraints::KinematicConstraintSetPtr Robot::IKQuery::getAsConstraints | ( | const Robot & | robot | ) | const |
Get this IK query as a kinematic constraint set.
[in] | robot | Robot this IK query is for. |
Definition at line 834 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::getMessage | ( | const std::string & | base_frame, |
moveit_msgs::Constraints & | msg | ||
) | const |
Get this IK query as a constraint message.
[in] | base_frame | Base frame of the IK solver used. Can be obtained with Robot::getSolverBaseFrame(). |
[out] | msg | Message to fill. |
Definition at line 816 of file robowflex_library/src/robot.cpp.
double Robot::IKQuery::getMetricValue | ( | const robot_state::RobotState & | state, |
const kinematic_constraints::ConstraintEvaluationResult & | result | ||
) | const |
Get the value of the metrics assigned to this query for a given state and result.
[in] | state | The state to evaluate. |
[in] | result | The result of evaluating this state against the kinematic constraint set. |
Definition at line 848 of file robowflex_library/src/robot.cpp.
bool Robot::IKQuery::sampleRegion | ( | RobotPose & | pose, |
std::size_t | index | ||
) | const |
Sample desired end-effector pose for region at index.
[out] | pose | The sampled pose. |
[in] | index | The index of the region to sample. |
Definition at line 791 of file robowflex_library/src/robot.cpp.
bool Robot::IKQuery::sampleRegions | ( | RobotPoseVector & | poses | ) | const |
Sample desired end-effector pose for each region.
[out] | poses | The sampled poses. |
Definition at line 804 of file robowflex_library/src/robot.cpp.
void Robot::IKQuery::setScene | ( | const ScenePtr & | scene, |
bool | verbose = false |
||
) |
Set a scene to use for collision checking for this IK request.
[in] | scene | Scene to check collision against. |
[in] | verbose | If true, will output verbose collision checking output. |
Definition at line 747 of file robowflex_library/src/robot.cpp.
std::size_t robowflex::Robot::IKQuery::attempts {constants::ik_attempts} |
IK attempts (samples within regions).
Definition at line 407 of file robowflex_library/include/robowflex_library/robot.h.
std::string robowflex::Robot::IKQuery::group |
Target joint group to do IK for.
Definition at line 391 of file robowflex_library/include/robowflex_library/robot.h.
std::vector<Metric> robowflex::Robot::IKQuery::metrics |
Metrics used to evaluate configurations. If metrics are added, solver will use all allotted resources to search for the best configuration. If there are multiple metrics, metric values will be added together.
Definition at line 415 of file robowflex_library/include/robowflex_library/robot.h.
kinematics::KinematicsQueryOptions robowflex::Robot::IKQuery::options |
Other query options.
Definition at line 406 of file robowflex_library/include/robowflex_library/robot.h.
std::vector<Eigen::Quaterniond> robowflex::Robot::IKQuery::orientations |
Target orientations.
Definition at line 395 of file robowflex_library/include/robowflex_library/robot.h.
bool robowflex::Robot::IKQuery::random_restart {true} |
Randomly reset joint states.
Definition at line 405 of file robowflex_library/include/robowflex_library/robot.h.
RobotPoseVector robowflex::Robot::IKQuery::region_poses |
Poses of regions.
Definition at line 394 of file robowflex_library/include/robowflex_library/robot.h.
std::vector<GeometryConstPtr> robowflex::Robot::IKQuery::regions |
Regions to sample target positions from.
Definition at line 393 of file robowflex_library/include/robowflex_library/robot.h.
robowflex::Robot::IKQuery::ROBOWFLEX_EIGEN |
Definition at line 376 of file robowflex_library/include/robowflex_library/robot.h.
SceneConstPtr robowflex::Robot::IKQuery::scene |
If provided, use this scene for collision checking.
Definition at line 403 of file robowflex_library/include/robowflex_library/robot.h.
double robowflex::Robot::IKQuery::timeout {0.} |
Timeout for each query.
Definition at line 408 of file robowflex_library/include/robowflex_library/robot.h.
std::vector<std::string> robowflex::Robot::IKQuery::tips |
List of end-effectors.
Definition at line 392 of file robowflex_library/include/robowflex_library/robot.h.
EigenSTL::vector_Vector3d robowflex::Robot::IKQuery::tolerances |
XYZ Euler orientation tolerances.
Definition at line 396 of file robowflex_library/include/robowflex_library/robot.h.
double robowflex::Robot::IKQuery::valid_distance {0.} |
If positive and validate = true, will return success if result is within distance of kinematic constraint set.
Definition at line 412 of file robowflex_library/include/robowflex_library/robot.h.
bool robowflex::Robot::IKQuery::validate {false} |
If true, double check if result is valid and use this rather than validity reported by the solver.
Definition at line 410 of file robowflex_library/include/robowflex_library/robot.h.
bool robowflex::Robot::IKQuery::verbose {false} |
Verbose output of collision checking.
Definition at line 404 of file robowflex_library/include/robowflex_library/robot.h.