cartesian_interpolator.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Ioan A. Sucan
5  * Copyright (c) 2013, Willow Garage, Inc.
6  * Copyright (c) 2019, PickNik LLC.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *********************************************************************/
36 
37 /* Author: Ioan Sucan, Mike Lautman */
38 
39 #pragma once
40 
42 
43 #include <boost/assert.hpp>
44 
45 namespace moveit
46 {
47 namespace core
48 {
50 struct CartesianPrecision
51 {
52  double translational = 0.001; //< max deviation in translation (meters)
53  double rotational = 0.01; //< max deviation in rotation (radians)
54  double max_resolution = 1e-5; //< max resolution for waypoints (fraction of total path)
55 };
56 
62 struct JumpThreshold
63 {
64  double factor;
65  double revolute; // Radians
66  double prismatic; // Meters
67 
68  explicit JumpThreshold() : factor(0.0), revolute(0.0), prismatic(0.0)
69  {
70  }
71 
72  explicit JumpThreshold(double jt_factor) : JumpThreshold()
73  {
74  factor = jt_factor;
75  }
76 
77  explicit JumpThreshold(double jt_revolute, double jt_prismatic) : JumpThreshold()
78  {
79  revolute = jt_revolute; // Radians
80  prismatic = jt_prismatic; // Meters
81  }
82 };
83 
89 struct MaxEEFStep
90 {
92  {
93  }
94 
95  MaxEEFStep(double step_size) : translation(step_size), rotation(3.5 * step_size) // 0.035 rad = 2 deg
96  {
97  }
98 
99  double translation; // Meters
100  double rotation; // Radians
101 };
102 
103 class CartesianInterpolator
104 {
105  // TODO(mlautman): Eventually, this planner should be moved out of robot_state
106 
107 public:
124  static double
125  computeCartesianPath(const RobotState* start_state, const JointModelGroup* group,
126  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
127  const Eigen::Vector3d& translation, bool global_reference_frame, const MaxEEFStep& max_step,
128  const CartesianPrecision& precision,
131 
136  static double
137  computeCartesianPath(const RobotState* start_state, const JointModelGroup* group,
138  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
139  const Eigen::Vector3d& direction, bool global_reference_frame, double distance,
140  const MaxEEFStep& max_step, const CartesianPrecision& precision,
143  {
144  return computeCartesianPath(start_state, group, traj, link, distance * direction, global_reference_frame, max_step,
145  precision, validCallback, options);
146  }
147 
154  static double computeCartesianPath(const RobotState* start_state, const JointModelGroup* group,
155  std::vector<RobotStatePtr>& traj, const LinkModel* link,
156  const Eigen::Isometry3d& target, bool global_reference_frame,
157  const MaxEEFStep& max_step, const CartesianPrecision& precision,
158  const GroupStateValidityCallbackFn& validCallback,
160  const Eigen::Isometry3d& link_offset = Eigen::Isometry3d::Identity());
161 
168  static double
169  computeCartesianPath(const RobotState* start_state, const JointModelGroup* group,
170  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
171  const EigenSTL::vector_Isometry3d& waypoints, bool global_reference_frame,
172  const MaxEEFStep& max_step, const CartesianPrecision& precision,
175  const Eigen::Isometry3d& link_offset = Eigen::Isometry3d::Identity());
176 
205  [[deprecated("Replace JumpThreshold with CartesianPrecision")]] static double
206  computeCartesianPath(RobotState* start_state, const JointModelGroup* group,
207  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
208  const Eigen::Vector3d& translation, bool global_reference_frame, const MaxEEFStep& max_step,
209  const JumpThreshold& jump_threshold,
212 
217  [[deprecated("Replace JumpThreshold with CartesianPrecision")]] static double
218  computeCartesianPath(RobotState* start_state, const JointModelGroup* group,
219  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
220  const Eigen::Vector3d& direction, bool global_reference_frame, double distance,
221  const MaxEEFStep& max_step, const JumpThreshold& jump_threshold,
224  {
225 #pragma GCC diagnostic push
226 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
227  return computeCartesianPath(start_state, group, traj, link, distance * direction, global_reference_frame, max_step,
228  jump_threshold, validCallback, options);
229 #pragma GCC diagnostic pop
230  }
231 
238  [[deprecated("Replace JumpThreshold with CartesianPrecision")]] static double
239  computeCartesianPath(RobotState* start_state, const JointModelGroup* group,
240  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
241  const Eigen::Isometry3d& target, bool global_reference_frame, const MaxEEFStep& max_step,
242  const JumpThreshold& jump_threshold,
245  const Eigen::Isometry3d& link_offset = Eigen::Isometry3d::Identity());
246 
253  [[deprecated("Replace JumpThreshold with CartesianPrecision")]] static double
254  computeCartesianPath(RobotState* start_state, const JointModelGroup* group,
255  std::vector<std::shared_ptr<RobotState>>& traj, const LinkModel* link,
256  const EigenSTL::vector_Isometry3d& waypoints, bool global_reference_frame,
257  const MaxEEFStep& max_step, const JumpThreshold& jump_threshold,
260  const Eigen::Isometry3d& link_offset = Eigen::Isometry3d::Identity());
261 
279  static double checkJointSpaceJump(const JointModelGroup* group, std::vector<std::shared_ptr<RobotState>>& traj,
280  const JumpThreshold& jump_threshold);
281 
294  static double checkRelativeJointSpaceJump(const JointModelGroup* group,
295  std::vector<std::shared_ptr<RobotState>>& traj,
296  double jump_threshold_factor);
297 
312  static double checkAbsoluteJointSpaceJump(const JointModelGroup* group,
313  std::vector<std::shared_ptr<RobotState>>& traj,
314  double revolute_jump_threshold, double prismatic_jump_threshold);
315 };
316 
317 } // end of namespace core
318 } // end of namespace moveit
moveit::core::LinkModel
A link from the robot. Contains the constant transform applied to the link and its geometry.
Definition: link_model.h:71
moveit::core::GroupStateValidityCallbackFn
boost::function< bool(RobotState *robot_state, const JointModelGroup *joint_group, const double *joint_group_variable_values)> GroupStateValidityCallbackFn
Signature for functions that can verify that if the group joint_group in robot_state is set to joint_...
Definition: robot_state.h:136
EigenSTL::vector_Isometry3d
std::vector< Eigen::Isometry3d, Eigen::aligned_allocator< Eigen::Isometry3d > > vector_Isometry3d
moveit::core::JumpThreshold
Struct for containing jump_threshold.
Definition: cartesian_interpolator.h:130
moveit::core::JointModelGroup
Definition: joint_model_group.h:134
moveit::core::JumpThreshold::revolute
double revolute
Definition: cartesian_interpolator.h:133
moveit::core::CartesianInterpolator::checkRelativeJointSpaceJump
static double checkRelativeJointSpaceJump(const JointModelGroup *group, std::vector< std::shared_ptr< RobotState >> &traj, double jump_threshold_factor)
Tests for relative joint space jumps of the trajectory traj.
Definition: cartesian_interpolator.cpp:466
moveit::core::CartesianPrecision::translational
double translational
Definition: cartesian_interpolator.h:154
moveit::core::CartesianPrecision::rotational
double rotational
Definition: cartesian_interpolator.h:155
moveit::core::JumpThreshold::prismatic
double prismatic
Definition: cartesian_interpolator.h:134
moveit::core::MaxEEFStep::MaxEEFStep
MaxEEFStep(double translation, double rotation)
Definition: cartesian_interpolator.h:159
moveit::core::RobotState
Representation of a robot's state. This includes position, velocity, acceleration and effort.
Definition: robot_state.h:155
moveit::core::CartesianInterpolator::computeCartesianPath
static double computeCartesianPath(const RobotState *start_state, const JointModelGroup *group, std::vector< std::shared_ptr< RobotState >> &traj, const LinkModel *link, const Eigen::Vector3d &translation, bool global_reference_frame, const MaxEEFStep &max_step, const CartesianPrecision &precision, const GroupStateValidityCallbackFn &validCallback=GroupStateValidityCallbackFn(), const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions())
Compute the sequence of joint values that correspond to a straight Cartesian path for a particular li...
moveit::core::MaxEEFStep
Struct for containing max_step for computeCartesianPath.
Definition: cartesian_interpolator.h:157
moveit::core::CartesianInterpolator::checkJointSpaceJump
static double checkJointSpaceJump(const JointModelGroup *group, std::vector< std::shared_ptr< RobotState >> &traj, const JumpThreshold &jump_threshold)
Tests joint space jumps of a trajectory.
Definition: cartesian_interpolator.cpp:448
moveit::core::CartesianInterpolator::checkAbsoluteJointSpaceJump
static double checkAbsoluteJointSpaceJump(const JointModelGroup *group, std::vector< std::shared_ptr< RobotState >> &traj, double revolute_jump_threshold, double prismatic_jump_threshold)
Tests for absolute joint space jumps of the trajectory traj.
Definition: cartesian_interpolator.cpp:503
moveit::core::JumpThreshold::factor
double factor
Definition: cartesian_interpolator.h:132
moveit::core::MaxEEFStep::translation
double translation
Definition: cartesian_interpolator.h:167
moveit
Main namespace for MoveIt.
Definition: background_processing.h:46
kinematics::KinematicsQueryOptions
A set of options for the kinematics solver.
Definition: kinematics_base.h:109
moveit::core::MaxEEFStep::rotation
double rotation
Definition: cartesian_interpolator.h:168
moveit::core::CartesianPrecision
Definition: cartesian_interpolator.h:118
pr2_arm_kinematics::distance
double distance(const urdf::Pose &transform)
Definition: pr2_arm_ik.h:86
robot_state.h
moveit::core::CartesianPrecision::max_resolution
double max_resolution
Definition: cartesian_interpolator.h:156
moveit::core::JumpThreshold::JumpThreshold
JumpThreshold()
Definition: cartesian_interpolator.h:136
fcl::Vector3d
Vec3fX< details::Vec3Data< double > > Vector3d
Definition: fcl_compat.h:89


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Thu Nov 21 2024 03:23:41