35 #include <gtest/gtest.h> 
   42 #include <Eigen/Geometry> 
   43 #include <kdl/frames.hpp> 
   44 #include <kdl/path_roundedcomposite.hpp> 
   45 #include <kdl/rotational_interpolation_sa.hpp> 
   46 #include <kdl/trajectory.hpp> 
   47 #include <kdl/trajectory_segment.hpp> 
   48 #include <kdl/velocityprofile_trap.hpp> 
   53 #include <tf2_eigen/tf2_eigen.hpp> 
   54 #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp> 
   62 #define _USE_MATH_DEFINES 
   64 static constexpr 
double EPSILON{ 1.0e-6 };
 
   65 static constexpr 
double IK_SEED_OFFSET{ 0.1 };
 
   66 static constexpr 
double L0{ 0.2604 };  
 
   67 static constexpr 
double L1{ 0.3500 };  
 
   68 static constexpr 
double L2{ 0.3070 };  
 
   69 static constexpr 
double L3{ 0.0840 };  
 
   90     rclcpp::NodeOptions node_options;
 
   91     node_options.automatically_declare_parameters_from_overrides(
true);
 
   92     node_ = rclcpp::Node::make_shared(
"unittest_trajectory_functions", node_options);
 
   95     rm_loader_ = std::make_unique<robot_model_loader::RobotModelLoader>(
node_);
 
   97     ASSERT_TRUE(
bool(
robot_model_)) << 
"Failed to load robot model";
 
  102     ASSERT_TRUE(
node_->has_parameter(
"planning_group"));
 
  104     ASSERT_TRUE(
node_->has_parameter(
"group_tip_link"));
 
  106     ASSERT_TRUE(
node_->has_parameter(
"tcp_link"));
 
  108     ASSERT_TRUE(
node_->has_parameter(
"ik_fast_link"));
 
  110     ASSERT_TRUE(
node_->has_parameter(
"random_test_number"));
 
  136   bool tfNear(
const Eigen::Isometry3d& pose1, 
const Eigen::Isometry3d& pose2, 
const double& epsilon);
 
  145   bool jointsNear(
const std::vector<double>& joints1, 
const std::vector<double>& joints2, 
double epsilon);
 
  164                     const std::string& object_name, 
const Eigen::Isometry3d& object_pose,
 
  172   std::unique_ptr<robot_model_loader::RobotModelLoader> 
rm_loader_;
 
  187                                          const double& epsilon)
 
  189   for (std::size_t i = 0; i < 3; ++i)
 
  190     for (std::size_t j = 0; j < 4; ++j)
 
  192       if (fabs(pose1(i, j) - pose2(i, j)) > fabs(epsilon))
 
  201   if (joints1.size() != joints2.size())
 
  205   for (std::size_t i = 0; i < joints1.size(); ++i)
 
  207     if (fabs(joints1.at(i) - joints2.at(i)) > fabs(epsilon))
 
  218   std::vector<double> joints;
 
  227                                                const std::string& object_name, 
const Eigen::Isometry3d& object_pose,
 
  230   state.
attachBody(std::make_unique<moveit::core::AttachedBody>(
 
  231       link, object_name, object_pose, std::vector<shapes::ShapeConstPtr>{}, EigenSTL::vector_Isometry3d{},
 
  232       std::set<std::string>{}, trajectory_msgs::msg::JointTrajectory{}, subframes));
 
  257   Eigen::Isometry3d tip_pose;
 
  258   std::map<std::string, double> test_state = zero_state_;
 
  260   EXPECT_NEAR(tip_pose(0, 3), 0, 
EPSILON);
 
  261   EXPECT_NEAR(tip_pose(1, 3), 0, 
EPSILON);
 
  262   EXPECT_NEAR(tip_pose(2, 3), L0 + L1 + L2 + L3, 
EPSILON);
 
  264   test_state[joint_names_.at(1)] = M_PI_2;
 
  266   EXPECT_NEAR(tip_pose(0, 3), L1 + L2 + L3, 
EPSILON);
 
  267   EXPECT_NEAR(tip_pose(1, 3), 0, 
EPSILON);
 
  268   EXPECT_NEAR(tip_pose(2, 3), L0, 
EPSILON);
 
  270   test_state[joint_names_.at(1)] = -M_PI_2;
 
  271   test_state[joint_names_.at(2)] = M_PI_2;
 
  273   EXPECT_NEAR(tip_pose(0, 3), -L1, 
EPSILON);
 
  274   EXPECT_NEAR(tip_pose(1, 3), 0, 
EPSILON);
 
  275   EXPECT_NEAR(tip_pose(2, 3), L0 - L2 - L3, 
EPSILON);
 
  278   std::string link_name = 
"wrong_link_name";
 
  293     throw(
"No IK solver configured for group '" + planning_group_ + 
"'");
 
  298   while (random_test_number_ > 0)
 
  303     geometry_msgs::msg::Pose pose_expect = tf2::toMsg(rstate.
getFrameTransform(ik_fast_link_));
 
  306     std::vector<geometry_msgs::msg::Pose> ik_poses;
 
  307     ik_poses.push_back(pose_expect);
 
  308     std::vector<double> ik_seed, ik_expect, ik_actual;
 
  318     std::vector<std::vector<double>> ik_solutions;
 
  320     moveit_msgs::msg::MoveItErrorCodes err_code;
 
  324     EXPECT_TRUE(solver->getPositionIK(ik_poses, ik_seed, ik_solutions, ik_result, 
options));
 
  327     EXPECT_TRUE(solver->getPositionIK(pose_expect, ik_seed, ik_actual, err_code));
 
  329     ASSERT_EQ(ik_expect.size(), ik_actual.size());
 
  331     for (std::size_t i = 0; i < ik_expect.size(); ++i)
 
  333       EXPECT_NEAR(ik_actual.at(i), ik_expect.at(i), 4 * IK_SEED_OFFSET);
 
  336     --random_test_number_;
 
  350   while (random_test_number_ > 0)
 
  358     std::map<std::string, double> ik_seed, ik_expect;
 
  359     for (
const auto& joint_name : joint_names_)
 
  372     std::map<std::string, double> ik_actual;
 
  374     EXPECT_TRUE(rstate.
setFromIK(robot_model_->getJointModelGroup(planning_group_), pose_expect, tcp_link_));
 
  376     for (
const auto& joint_name : joint_names_)
 
  382     for (
const auto& joint_pair : ik_actual)
 
  384       EXPECT_NEAR(joint_pair.second, ik_expect.at(joint_pair.first), 4 * IK_SEED_OFFSET);
 
  392     EXPECT_TRUE(tfNear(pose_expect, pose_actual, 
EPSILON));
 
  394     --random_test_number_;
 
  405   std::vector<double> default_joints = getJoints(jmg, state);
 
  410   Eigen::Isometry3d object_pose_in_tip = Eigen::Isometry3d::Identity();
 
  412   attachToLink(state, tip_link, 
"object", object_pose_in_tip, subframes);
 
  415   Eigen::Isometry3d object_pose_in_base = tip_pose_in_base * object_pose_in_tip;
 
  416   bool success = state.
setFromIK(jmg, object_pose_in_base, 
"object");
 
  417   EXPECT_TRUE(success);
 
  420   std::vector<double> ik_joints = getJoints(jmg, state);
 
  421   EXPECT_TRUE(jointsNear(ik_joints, default_joints, 4 * IK_SEED_OFFSET));
 
  431   std::vector<double> default_joints = getJoints(jmg, state);
 
  436   Eigen::Isometry3d object_pose_in_tip;
 
  437   object_pose_in_tip = Eigen::Translation3d(1, 2, 3);
 
  438   object_pose_in_tip *= Eigen::AngleAxis(M_PI_2, Eigen::Vector3d::UnitX());
 
  440   attachToLink(state, tip_link, 
"object", object_pose_in_tip, subframes);
 
  443   Eigen::Isometry3d object_pose_in_base = tip_pose_in_base * object_pose_in_tip;
 
  444   bool success = state.
setFromIK(jmg, object_pose_in_base, 
"object");
 
  445   EXPECT_TRUE(success);
 
  448   std::vector<double> ik_joints = getJoints(jmg, state);
 
  449   EXPECT_TRUE(jointsNear(ik_joints, default_joints, 4 * IK_SEED_OFFSET));
 
  459   std::vector<double> default_joints = getJoints(jmg, state);
 
  464   Eigen::Isometry3d object_pose_in_tip = Eigen::Isometry3d::Identity();
 
  465   Eigen::Isometry3d subframe_pose_in_object = Eigen::Isometry3d::Identity();
 
  467   attachToLink(state, tip_link, 
"object", object_pose_in_tip, subframes);
 
  470   Eigen::Isometry3d subframe_pose_in_base = tip_pose_in_base * object_pose_in_tip * subframe_pose_in_object;
 
  471   bool success = state.
setFromIK(jmg, subframe_pose_in_base, 
"object/subframe");
 
  472   EXPECT_TRUE(success);
 
  475   std::vector<double> ik_joints = getJoints(jmg, state);
 
  476   EXPECT_TRUE(jointsNear(ik_joints, default_joints, 4 * IK_SEED_OFFSET));
 
  486   std::vector<double> default_joints = getJoints(jmg, state);
 
  491   Eigen::Isometry3d object_pose_in_tip;
 
  492   object_pose_in_tip = Eigen::Translation3d(1, 2, 3);
 
  493   object_pose_in_tip *= Eigen::AngleAxis(M_PI_2, Eigen::Vector3d::UnitX());
 
  495   Eigen::Isometry3d subframe_pose_in_object;
 
  496   subframe_pose_in_object = Eigen::Translation3d(4, 5, 6);
 
  497   subframe_pose_in_object *= Eigen::AngleAxis(M_PI_2, Eigen::Vector3d::UnitY());
 
  500   attachToLink(state, tip_link, 
"object", object_pose_in_tip, subframes);
 
  503   Eigen::Isometry3d subframe_pose_in_base = tip_pose_in_base * object_pose_in_tip * subframe_pose_in_object;
 
  504   bool success = state.
setFromIK(jmg, subframe_pose_in_base, 
"object/subframe");
 
  505   EXPECT_TRUE(success);
 
  508   std::vector<double> ik_joints = getJoints(jmg, state);
 
  509   EXPECT_TRUE(jointsNear(ik_joints, default_joints, 4 * IK_SEED_OFFSET));
 
  521   const std::string 
frame_id = robot_model_->getModelFrame();
 
  524   while (random_test_number_ > 0)
 
  532     std::map<std::string, double> ik_seed, ik_expect;
 
  533     for (
const auto& joint_name : robot_model_->getJointModelGroup(planning_group_)->getActiveJointModelNames())
 
  547     std::map<std::string, double> ik_actual;
 
  549                                                               frame_id, ik_seed, ik_actual, 
false));
 
  552     for (
const auto& joint_pair : ik_actual)
 
  554       EXPECT_NEAR(joint_pair.second, ik_expect.at(joint_pair.first), 4 * IK_SEED_OFFSET);
 
  557     --random_test_number_;
 
  566   const std::string 
frame_id = robot_model_->getModelFrame();
 
  567   Eigen::Isometry3d pose_expect;
 
  569   std::map<std::string, double> ik_seed;
 
  572   std::map<std::string, double> ik_actual;
 
  574                                                              pose_expect, 
frame_id, ik_seed, ik_actual, 
false));
 
  582   const std::string 
frame_id = robot_model_->getModelFrame();
 
  583   Eigen::Isometry3d pose_expect;
 
  585   std::map<std::string, double> ik_seed;
 
  588   std::map<std::string, double> ik_actual;
 
  590                                                              frame_id, ik_seed, ik_actual, 
false));
 
  600   Eigen::Isometry3d pose_expect;
 
  602   std::map<std::string, double> ik_seed;
 
  605   std::map<std::string, double> ik_actual;
 
  607                                                              "InvalidFrameId", ik_seed, ik_actual, 
false));
 
  692   const std::string 
frame_id = robot_model_->getModelFrame();
 
  696   std::map<std::string, double> ik_seed;
 
  699     ik_seed[joint_name] = 0;
 
  703   std::vector<double> ik_goal = { 0, 2.3, -2.3, 0, 0, 0 };
 
  710   std::map<std::string, double> ik_actual;
 
  712                                                             frame_id, ik_seed, ik_actual, 
false));
 
  716                                                              frame_id, ik_seed, ik_actual, 
true));
 
  731   const std::map<std::string, double> position_last, velocity_last, position_current;
 
  732   double duration_last{ 0.0 };
 
  735   double duration_current = 10e-7;
 
  753   const std::string test_joint_name{ 
"joint" };
 
  755   std::map<std::string, double> position_last{ { test_joint_name, 2.0 } };
 
  756   std::map<std::string, double> position_current{ { test_joint_name, 10.0 } };
 
  757   std::map<std::string, double> velocity_last;
 
  758   double duration_current{ 1.0 };
 
  759   double duration_last{ 0.0 };
 
  766       ((position_current.at(test_joint_name) - position_last.at(test_joint_name)) / duration_current) - 1.0;
 
  768   joint_limits.addLimit(test_joint_name, test_joint_limits);
 
  786   const std::string test_joint_name{ 
"joint" };
 
  788   double duration_current = 1.0;
 
  789   double duration_last = 1.0;
 
  791   std::map<std::string, double> position_last{ { test_joint_name, 2.0 } };
 
  792   std::map<std::string, double> position_current{ { test_joint_name, 20.0 } };
 
  793   double velocity_current =
 
  794       ((position_current.at(test_joint_name) - position_last.at(test_joint_name)) / duration_current);
 
  795   std::map<std::string, double> velocity_last{ { test_joint_name, 9.0 } };
 
  801   test_joint_limits.
max_velocity = velocity_current + 1.0;
 
  804   double acceleration_current =
 
  805       (velocity_current - velocity_last.at(test_joint_name)) / (duration_last + duration_current) * 2;
 
  811   joint_limits.addLimit(test_joint_name, test_joint_limits);
 
  829   const std::string test_joint_name{ 
"joint" };
 
  831   double duration_current = 1.0;
 
  832   double duration_last = 1.0;
 
  834   std::map<std::string, double> position_last{ { test_joint_name, 20.0 } };
 
  835   std::map<std::string, double> position_current{ { test_joint_name, 2.0 } };
 
  836   double velocity_current =
 
  837       ((position_current.at(test_joint_name) - position_last.at(test_joint_name)) / duration_current);
 
  838   std::map<std::string, double> velocity_last{ { test_joint_name, 19.0 } };
 
  844   test_joint_limits.
max_velocity = fabs(velocity_current) + 1.0;
 
  847   double acceleration_current =
 
  848       (velocity_current - velocity_last.at(test_joint_name)) / (duration_last + duration_current) * 2;
 
  854   joint_limits.addLimit(test_joint_name, test_joint_limits);
 
  878   KDL::Path_RoundedComposite* path =
 
  879       new KDL::Path_RoundedComposite(0.2, 0.01, 
new KDL::RotationalInterpolation_SingleAxis());
 
  880   path->Add(KDL::Frame(KDL::Rotation::RPY(0, 0, 0), KDL::Vector(-1, 0, 0)));
 
  883   KDL::VelocityProfile* vel_prof = 
new KDL::VelocityProfile_Trap(0.5, 0.1);
 
  884   vel_prof->SetProfile(0, path->PathLength());
 
  885   KDL::Trajectory_Segment kdl_trajectory(path, vel_prof);
 
  888   std::string group_name{ 
"invalid_group_name" };
 
  889   std::map<std::string, double> initial_joint_position;
 
  890   double sampling_time{ 0.1 };
 
  891   trajectory_msgs::msg::JointTrajectory joint_trajectory;
 
  892   moveit_msgs::msg::MoveItErrorCodes error_code;
 
  893   bool check_self_collision{ 
false };
 
  896       planning_scene_, 
joint_limits, kdl_trajectory, group_name, tcp_link_, initial_joint_position, sampling_time,
 
  897       joint_trajectory, error_code, check_self_collision));
 
  899   std::map<std::string, double> initial_joint_velocity;
 
  905   cart_traj.
points.push_back(cart_traj_point);
 
  908       planning_scene_, 
joint_limits, cart_traj, group_name, tcp_link_, initial_joint_position, initial_joint_velocity,
 
  909       joint_trajectory, error_code, check_self_collision));
 
  925   robot_trajectory::RobotTrajectoryPtr first_trajectory =
 
  926       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  927   robot_trajectory::RobotTrajectoryPtr second_trajectory =
 
  928       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  929   double epsilon{ 0.0 };
 
  930   double sampling_time{ 0.0 };
 
  933   first_trajectory->insertWayPoint(0, rstate, 0.1);
 
  934   second_trajectory->insertWayPoint(0, rstate, 0.1);
 
  937                                                                              epsilon, sampling_time));
 
  953   robot_trajectory::RobotTrajectoryPtr first_trajectory =
 
  954       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  955   robot_trajectory::RobotTrajectoryPtr second_trajectory =
 
  956       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  957   double epsilon{ 0.0001 };
 
  958   double sampling_time{ 0.0 };
 
  959   double expected_sampling_time{ 0.1 };
 
  962   first_trajectory->insertWayPoint(0, rstate, expected_sampling_time);
 
  963   first_trajectory->insertWayPoint(1, rstate, expected_sampling_time);
 
  965   second_trajectory->insertWayPoint(0, rstate, expected_sampling_time);
 
  966   second_trajectory->insertWayPoint(1, rstate, expected_sampling_time);
 
  967   second_trajectory->insertWayPoint(2, rstate, expected_sampling_time);
 
  970                                                                             epsilon, sampling_time));
 
  971   EXPECT_EQ(expected_sampling_time, sampling_time);
 
  987   robot_trajectory::RobotTrajectoryPtr first_trajectory =
 
  988       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  989   robot_trajectory::RobotTrajectoryPtr second_trajectory =
 
  990       std::make_shared<robot_trajectory::RobotTrajectory>(robot_model_, planning_group_);
 
  991   double epsilon{ 0.0001 };
 
  992   double sampling_time{ 0.0 };
 
  993   double expected_sampling_time{ 0.1 };
 
  996   first_trajectory->insertWayPoint(0, rstate, expected_sampling_time);
 
  997   first_trajectory->insertWayPoint(1, rstate, expected_sampling_time);
 
  998   first_trajectory->insertWayPoint(2, rstate, expected_sampling_time);
 
 1000   first_trajectory->insertWayPoint(2, rstate, expected_sampling_time + 1.0);
 
 1001   first_trajectory->insertWayPoint(3, rstate, expected_sampling_time);
 
 1003   second_trajectory->insertWayPoint(0, rstate, expected_sampling_time);
 
 1004   second_trajectory->insertWayPoint(1, rstate, expected_sampling_time);
 
 1005   second_trajectory->insertWayPoint(2, rstate, expected_sampling_time);
 
 1006   second_trajectory->insertWayPoint(3, rstate, expected_sampling_time);
 
 1009                                                                              epsilon, sampling_time));
 
 1010   EXPECT_EQ(expected_sampling_time, sampling_time);
 
 1029   double default_joint_position[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1032   default_joint_position[0] = default_joint_position[0] + 70.0;
 
 1035   double epsilon{ 0.0001 };
 
 1056   double default_joint_position[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1060   double default_joint_velocity[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1063   default_joint_velocity[1] = default_joint_velocity[1] + 10.0;
 
 1066   double epsilon{ 0.0001 };
 
 1087   double default_joint_position[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1092   double default_joint_velocity[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1096   double default_joint_acceleration[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1099   default_joint_acceleration[1] = default_joint_acceleration[1] + 10.0;
 
 1102   double epsilon{ 0.0001 };
 
 1122   double default_joint_velocity[6] = { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1125   double epsilon{ 0.0001 };
 
 1145   double default_joint_velocity[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1149   double default_joint_acceleration[6] = { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
 1152   double epsilon{ 0.0001 };
 
 1158   rclcpp::init(argc, argv);
 
 1159   testing::InitGoogleTest(&argc, argv);
 
 1160   return RUN_ALL_TESTS();
 
std::unique_ptr< robot_model_loader::RobotModelLoader > rm_loader_
 
std::vector< double > getJoints(const moveit::core::JointModelGroup *jmg, const moveit::core::RobotState &state)
get the current joint values of the robot state
 
void SetUp() override
Create test scenario for trajectory functions.
 
std::string group_tip_link_
 
rclcpp::Node::SharedPtr node_
 
std::string planning_group_
 
random_numbers::RandomNumberGenerator rng_
 
void attachToLink(moveit::core::RobotState &state, const moveit::core::LinkModel *link, const std::string &object_name, const Eigen::Isometry3d &object_pose, const moveit::core::FixedTransformsMap &subframes)
attach a collision object and subframes to a link
 
std::string ik_fast_link_
 
moveit::core::RobotModelConstPtr robot_model_
 
std::map< std::string, double > zero_state_
 
planning_scene::PlanningSceneConstPtr planning_scene_
 
bool tfNear(const Eigen::Isometry3d &pose1, const Eigen::Isometry3d &pose2, const double &epsilon)
check if two transformations are close
 
bool jointsNear(const std::vector< double > &joints1, const std::vector< double > &joints2, double epsilon)
check if two sets of joint positions are close
 
std::vector< std::string > joint_names_
 
moveit::core::RobotStatePtr robot_state_
 
Parametrized class for tests with and without gripper.
 
const kinematics::KinematicsBaseConstPtr getSolverInstance() const
 
const std::vector< std::string > & getActiveJointModelNames() const
Get the names of the active joints in this group. These are the names of the joints returned by getJo...
 
A link from the robot. Contains the constant transform applied to the link and its geometry.
 
Representation of a robot's state. This includes position, velocity, acceleration and effort.
 
void setVariablePositions(const double *position)
It is assumed positions is an array containing the new positions for all variables in this state....
 
void attachBody(std::unique_ptr< AttachedBody > attached_body)
Add an attached body to this state.
 
void setJointGroupAccelerations(const std::string &joint_group_name, const double *gstate)
Given accelerations for the variables that make up a group, in the order found in the group (includin...
 
void setJointGroupVelocities(const std::string &joint_group_name, const double *gstate)
Given velocities for the variables that make up a group, in the order found in the group (including v...
 
void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
Given positions for the variables that make up a group, in the order found in the group (including va...
 
const Eigen::Isometry3d & getFrameTransform(const std::string &frame_id, bool *frame_found=nullptr)
Get the transformation matrix from the model frame (root of model) to the frame identified by frame_i...
 
void setToRandomPositions()
Set all joints to random values. Values will be within default bounds.
 
double getVariablePosition(const std::string &variable) const
Get the position of a particular variable. An exception is thrown if the variable is not known.
 
void update(bool force=false)
Update all transforms.
 
void setToDefaultValues()
Set all joints to their default positions. The default position is 0, or if that is not within bounds...
 
bool setFromIK(const JointModelGroup *group, const geometry_msgs::msg::Pose &pose, double timeout=0.0, const GroupStateValidityCallbackFn &constraint=GroupStateValidityCallbackFn(), const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions(), const kinematics::KinematicsBase::IKCostFn &cost_function=kinematics::KinematicsBase::IKCostFn())
If the group this state corresponds to is a chain and a solver is available, then the joint values ca...
 
Container for JointLimits, essentially a map with convenience functions. Adds the ability to as for l...
 
std::map< std::string, Eigen::Isometry3d, std::less< std::string >, Eigen::aligned_allocator< std::pair< const std::string, Eigen::Isometry3d > > > FixedTransformsMap
Map frame names to the transformation matrix that can transform objects from the frame name to the pl...
 
bool computeLinkFK(moveit::core::RobotState &robot_state, const std::string &link_name, const std::map< std::string, double > &joint_state, Eigen::Isometry3d &pose)
compute the pose of a link at a given robot state
 
bool generateJointTrajectory(const planning_scene::PlanningSceneConstPtr &scene, const JointLimitsContainer &joint_limits, const KDL::Trajectory &trajectory, const std::string &group_name, const std::string &link_name, const std::map< std::string, double > &initial_joint_position, const double &sampling_time, trajectory_msgs::msg::JointTrajectory &joint_trajectory, moveit_msgs::msg::MoveItErrorCodes &error_code, bool check_self_collision=false)
Generate joint trajectory from a KDL Cartesian trajectory.
 
bool isRobotStateStationary(const moveit::core::RobotState &state, const std::string &group, double EPSILON)
check if the robot state have zero velocity/acceleration
 
bool determineAndCheckSamplingTime(const robot_trajectory::RobotTrajectoryPtr &first_trajectory, const robot_trajectory::RobotTrajectoryPtr &second_trajectory, double EPSILON, double &sampling_time)
Determines the sampling time and checks that both trajectroies use the same sampling time.
 
bool verifySampleJointLimits(const std::map< std::string, double > &position_last, const std::map< std::string, double > &velocity_last, const std::map< std::string, double > &position_current, double duration_last, double duration_current, const JointLimitsContainer &joint_limits)
verify the velocity/acceleration limits of current sample (based on backward difference computation) ...
 
bool computePoseIK(const planning_scene::PlanningSceneConstPtr &scene, const std::string &group_name, const std::string &link_name, const Eigen::Isometry3d &pose, const std::string &frame_id, const std::map< std::string, double > &seed, std::map< std::string, double > &solution, bool check_self_collision=true, const double timeout=0.0)
compute the inverse kinematics of a given pose, also check robot self collision
 
bool isRobotStateEqual(const moveit::core::RobotState &state1, const moveit::core::RobotState &state2, const std::string &joint_group_name, double epsilon)
Check if the two robot states have the same joint position/velocity/acceleration.
 
void checkRobotModel(const moveit::core::RobotModelConstPtr &robot_model, const std::string &group_name, const std::string &link_name)
 
bool has_acceleration_limits
 
A set of options for the kinematics solver.
 
std::vector< CartesianTrajectoryPoint > points
 
Extends joint_limits_interface::JointLimits with a deceleration parameter.
 
bool has_deceleration_limits
 
double max_deceleration
maximum deceleration MUST(!) be negative
 
const std::string PARAM_PLANNING_GROUP_NAME("planning_group")
 
const std::string RANDOM_TEST_NUMBER("random_test_number")
 
int main(int argc, char **argv)
 
const std::string IK_FAST_LINK_NAME("ik_fast_link")
 
TEST_F(TrajectoryFunctionsTestFlangeAndGripper, TipLinkFK)
Test the forward kinematics function with simple robot poses for robot tip link using robot model wit...
 
const std::string ROBOT_TCP_LINK_NAME("tcp_link")
 
const std::string GROUP_TIP_LINK_NAME("group_tip_link")