1#ifndef TESSERACT_STATE_SOLVER_STATE_SOLVER_TEST_SUITE_H
2#define TESSERACT_STATE_SOLVER_STATE_SOLVER_TEST_SUITE_H
6#include <gtest/gtest.h>
22 std::string
path = std::string(TESSERACT_SUPPORT_DIR) +
"/urdf/lbr_iiwa_14_r820.urdf";
30 auto subgraph = std::make_unique<SceneGraph>();
31 subgraph->setName(
"subgraph");
34 auto visual = std::make_shared<Visual>();
35 visual->geometry = std::make_shared<tesseract_geometry::Box>(1, 1, 1);
36 auto collision = std::make_shared<Collision>();
37 collision->geometry = std::make_shared<tesseract_geometry::Box>(1, 1, 1);
39 const std::string link_name1 =
"subgraph_base_link";
40 const std::string link_name2 =
"subgraph_link_1";
41 const std::string joint_name1 =
"subgraph_joint1";
43 link_1.visual.push_back(visual);
48 joint_1.parent_to_joint_origin_transform.translation()(0) = 1.25;
49 joint_1.parent_link_name = link_name1;
50 joint_1.child_link_name = link_name2;
66 for (
const auto& pair : base_state.
joints)
102 for (
int i = 0; i < 10; ++i)
110 comp_state_const = comp_solver.
getState(base_random_state.
joints);
117 comp_state_const = comp_solver.
getState(base_random_state.
joints);
120 Eigen::VectorXd joint_values(base_random_state.
joints.size());
122 for (
const auto& joint : base_random_state.
joints)
125 joint_values(
static_cast<Eigen::Index
>(
j)) = joint.second;
133 comp_state_const = comp_solver.
getState(base_random_state.
joints);
151 std::vector<std::string> comp_link_names = comp_solver.
getLinkNames();
153 for (std::size_t
j = 0;
j < comp_link_names.size(); ++
j)
158 for (
const auto& from_link_name : comp_link_names)
160 for (
const auto& to_link_name : comp_link_names)
163 Eigen::Isometry3d base_tf = base_random_state.
link_transforms[from_link_name].inverse() *
176 for (Eigen::Index i = 0; i < static_cast<Eigen::Index>(comp_joint_names.size()); ++i)
178 const auto& scene_joint =
scene_graph.getJoint(comp_joint_names[
static_cast<std::size_t
>(i)]);
182 EXPECT_NEAR(
limits.acceleration_limits(i), scene_joint->limits->acceleration, 1e-5);
195 const Eigen::Isometry3d& change_base,
198 const Eigen::Ref<const Eigen::VectorXd>& joint_values,
199 const std::string& link_name,
200 const Eigen::Ref<const Eigen::Vector3d>& link_point)
202 Eigen::VectorXd njvals;
203 double delta = 0.001;
210 Eigen::Isometry3d
pose = poses[link_name];
213 for (
int i = 0; i < static_cast<int>(joint_values.size()); ++i)
215 njvals = joint_values;
223 Eigen::Isometry3d updated_pose = updated_poses[link_name];
224 updated_pose = change_base * updated_pose;
226 Eigen::Vector3d temp =
pose * link_point;
227 Eigen::Vector3d temp2 = updated_pose * link_point;
228 jacobian(0, i) = (temp2.x() - temp.x()) / delta;
229 jacobian(1, i) = (temp2.y() - temp.y()) / delta;
230 jacobian(2, i) = (temp2.z() - temp.z()) / delta;
232 Eigen::AngleAxisd r12(
pose.rotation().transpose() * updated_pose.rotation());
233 double theta = r12.angle();
234 theta = copysign(fmod(fabs(theta), 2.0 * M_PI), theta);
236 theta = theta + 2. * M_PI;
238 theta = theta - 2. * M_PI;
239 Eigen::VectorXd omega = (
pose.rotation() * r12.axis() * theta) / delta;
258 const Eigen::VectorXd& jvals,
259 const std::string& link_name,
260 const Eigen::Vector3d& link_point,
261 const Eigen::Isometry3d& change_base)
263 Eigen::MatrixXd
jacobian, numerical_jacobian;
271 std::vector<long> order;
272 order.reserve(solver_jn.size());
275 for (
int i = 0; i < static_cast<int>(solver_jn.size()); ++i)
294 numerical_jacobian.resize(6, jvals.size());
297 for (
int i = 0; i < 6; ++i)
299 for (
int j = 0; j < static_cast<int>(jvals.size()); ++
j)
307 const std::unordered_map<std::string, double>& joints_values,
308 const std::string& link_name,
309 const Eigen::Vector3d& link_point,
310 const Eigen::Isometry3d& change_base)
312 Eigen::MatrixXd
jacobian, numerical_jacobian;
313 jacobian.resize(6,
static_cast<Eigen::Index
>(joints_values.size()));
316 Eigen::VectorXd jvals(joints_values.size());
318 for (
const auto&
jv : joints_values)
321 jvals(
j++) =
jv.second;
329 std::vector<long> order;
330 order.reserve(solver_jn.size());
340 numerical_jacobian.resize(6,
static_cast<Eigen::Index
>(joints_values.size()));
343 for (
int i = 0; i < 6; ++i)
345 for (
int j = 0; j < static_cast<int>(jvals.size()); ++
j)
360 std::vector<std::string> joint_names_empty;
361 std::vector<std::string>
link_names = {
"base_link",
"link_1",
"link_2",
"link_3",
"link_4",
362 "link_5",
"link_6",
"link_7",
"tool0" };
367 Eigen::VectorXd jvals;
385 std::unordered_map<std::string, double> jv_map;
386 for (Eigen::Index i = 0; i < jvals.rows(); ++i)
387 jv_map[
"joint_a" + std::to_string(i + 1)] = jvals(i);
393 Eigen::Vector3d link_point(0, 0, 0);
396 runCompareJacobian(state_solver, joint_names_empty, jvals, link_name, link_point, Eigen::Isometry3d::Identity());
398 *state_solver_clone, joint_names_empty, jvals, link_name, link_point, Eigen::Isometry3d::Identity());
403 state_solver, joint_names_empty, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
407 *state_solver_clone, joint_names_empty, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
413 for (
int k = 0; k < 3; ++k)
415 Eigen::Vector3d link_point(0, 0, 0);
420 runCompareJacobian(state_solver, joint_names_empty, jvals, link_name, link_point, Eigen::Isometry3d::Identity());
422 *state_solver_clone, joint_names_empty, jvals, link_name, link_point, Eigen::Isometry3d::Identity());
427 state_solver, joint_names_empty, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
431 *state_solver_clone, joint_names_empty, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
437 for (
int k = 0; k < 3; ++k)
439 Eigen::Vector3d link_point(0, 0, 0);
440 Eigen::Isometry3d change_base;
441 change_base.setIdentity();
442 change_base(0, 0) = 0;
443 change_base(1, 0) = 1;
444 change_base(0, 1) = -1;
445 change_base(1, 1) = 0;
446 change_base.translation() = Eigen::Vector3d(0, 0, 0);
447 change_base.translation()[k] = 1;
451 runCompareJacobian(state_solver, joint_names_empty, jvals, link_name, link_point, change_base);
452 runCompareJacobian(*state_solver_clone, joint_names_empty, jvals, link_name, link_point, change_base);
457 runCompareJacobian(state_solver, joint_names_empty, jvals,
"", link_point, change_base));
461 runCompareJacobian(*state_solver_clone, joint_names_empty, jvals,
"", link_point, change_base));
467 for (
int k = 0; k < 3; ++k)
469 Eigen::Vector3d link_point(0, 0, 0);
472 Eigen::Isometry3d change_base;
473 change_base.setIdentity();
474 change_base(0, 0) = 0;
475 change_base(1, 0) = 1;
476 change_base(0, 1) = -1;
477 change_base(1, 1) = 0;
478 change_base.translation() = link_point;
482 runCompareJacobian(state_solver, joint_names_empty, jvals, link_name, link_point, change_base);
483 runCompareJacobian(*state_solver_clone, joint_names_empty, jvals, link_name, link_point, change_base);
488 runCompareJacobian(state_solver, joint_names_empty, jvals,
"", link_point, change_base));
492 runCompareJacobian(*state_solver_clone, joint_names_empty, jvals,
"", link_point, change_base));
498 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
500 Eigen::Vector3d link_point(0, 0, 0);
506 runCompareJacobian(state_solver, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
507 runCompareJacobian(*state_solver_clone, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
516 *state_solver_clone,
joint_names, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
522 for (
int k = 0; k < 3; ++k)
524 Eigen::Vector3d link_point(0, 0, 0);
532 runCompareJacobian(state_solver, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
533 runCompareJacobian(*state_solver_clone, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
542 *state_solver_clone,
joint_names, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
548 for (
int k = 0; k < 3; ++k)
550 Eigen::Vector3d link_point(0, 0, 0);
551 Eigen::Isometry3d change_base;
552 change_base.setIdentity();
553 change_base(0, 0) = 0;
554 change_base(1, 0) = 1;
555 change_base(0, 1) = -1;
556 change_base(1, 1) = 0;
557 change_base.translation() = Eigen::Vector3d(0, 0, 0);
558 change_base.translation()[k] = 1;
580 for (
int k = 0; k < 3; ++k)
582 Eigen::Vector3d link_point(0, 0, 0);
585 Eigen::Isometry3d change_base;
586 change_base.setIdentity();
587 change_base(0, 0) = 0;
588 change_base(1, 0) = 1;
589 change_base(0, 1) = -1;
590 change_base(1, 1) = 0;
591 change_base.translation() = link_point;
623 Eigen::Vector3d link_point(0, 0, 0);
629 runCompareJacobian(state_solver, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
630 runCompareJacobian(*state_solver_clone, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
639 *state_solver_clone,
joint_names, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
645 for (
int k = 0; k < 3; ++k)
647 Eigen::Vector3d link_point(0, 0, 0);
655 runCompareJacobian(state_solver, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
656 runCompareJacobian(*state_solver_clone, jv_map, link_name, link_point, Eigen::Isometry3d::Identity());
665 *state_solver_clone,
joint_names, jvals,
"", link_point, Eigen::Isometry3d::Identity()));
671 for (
int k = 0; k < 3; ++k)
673 Eigen::Vector3d link_point(0, 0, 0);
674 Eigen::Isometry3d change_base;
675 change_base.setIdentity();
676 change_base(0, 0) = 0;
677 change_base(1, 0) = 1;
678 change_base(0, 1) = -1;
679 change_base(1, 1) = 0;
680 change_base.translation() = Eigen::Vector3d(0, 0, 0);
681 change_base.translation()[k] = 1;
702 for (
int k = 0; k < 3; ++k)
704 Eigen::Vector3d link_point(0, 0, 0);
707 Eigen::Isometry3d change_base;
708 change_base.setIdentity();
709 change_base(0, 0) = 0;
710 change_base(1, 0) = 1;
711 change_base(0, 1) = -1;
712 change_base(1, 1) = 0;
713 change_base.translation() = link_point;
739 auto visual = std::make_shared<Visual>();
740 visual->geometry = std::make_shared<tesseract_geometry::Box>(1, 1, 1);
741 auto collision = std::make_shared<Collision>();
742 collision->geometry = std::make_shared<tesseract_geometry::Box>(1, 1, 1);
744 const std::string link_name1 =
"link_n1";
745 const std::string link_name2 =
"link_n2";
746 const std::string joint_name1 =
"joint_n1";
747 const std::string joint_name2 =
"joint_n2";
750 link_1.visual.push_back(visual);
755 joint_1.child_link_name = link_name1;
761 joint_2.parent_to_joint_origin_transform.translation()(0) = 1.25;
762 joint_2.parent_link_name = link_name1;
763 joint_2.child_link_name = link_name2;
771 auto base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
780 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
792 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
798 state_solver_clone = state_solver.clone();
802 state = state_solver.getState();
816 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
822 state_solver_clone = state_solver.clone();
826 state = state_solver.getState();
844 state_solver_clone = state_solver.clone();
852 state_solver_clone = state_solver.clone();
860 state_solver_clone = state_solver.clone();
868 state_solver_clone = state_solver.clone();
878 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
884 state_solver_clone = state_solver.clone();
888 state = state_solver.getState();
899 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
905 state_solver_clone = state_solver.clone();
909 state = state_solver.getState();
921 EXPECT_TRUE(state_solver.removeJoint(joint_name1));
923 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
929 state_solver_clone = state_solver.clone();
933 state = state_solver.getState();
949 state_solver_clone = state_solver.clone();
957 state_solver_clone = state_solver.clone();
965 state_solver_clone = state_solver.clone();
973 state_solver_clone = state_solver.clone();
977 Link link_exists(
"link_1");
983 state_solver_clone = state_solver.clone();
987 Link link_10(
"link_10");
988 Joint joint_exists(
"joint_a1");
993 EXPECT_FALSE(state_solver.addLink(link_10, joint_exists));
998 state_solver_clone = state_solver.clone();
1002template <
typename S>
1009 auto subgraph = std::make_unique<SceneGraph>();
1010 subgraph->setName(
"subgraph");
1012 Joint joint_1_empty(
"provided_subgraph_joint");
1018 EXPECT_FALSE(state_solver.insertSceneGraph(*subgraph, joint_1_empty));
1020 auto base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1031 const std::string subgraph_joint_name =
"attach_subgraph_joint";
1033 Joint joint(subgraph_joint_name);
1039 EXPECT_TRUE(state_solver.insertSceneGraph(*subgraph, joint));
1041 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1047 state_solver_clone = state_solver.clone();
1050 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
1059 EXPECT_FALSE(state_solver.insertSceneGraph(*subgraph, joint));
1061 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1067 state_solver_clone = state_solver.clone();
1071 std::string prefix =
"prefix_";
1072 Joint prefix_joint(prefix + subgraph_joint_name);
1078 EXPECT_TRUE(state_solver.insertSceneGraph(*subgraph, prefix_joint, prefix));
1080 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1086 state_solver_clone = state_solver.clone();
1090 state = state_solver.getState();
1097 prefix =
"prefix2_";
1098 Joint prefix_joint2(prefix + subgraph_joint_name);
1104 EXPECT_TRUE(state_solver.insertSceneGraph(*subgraph, prefix_joint2, prefix));
1106 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1112 state_solver_clone = state_solver.clone();
1118 state = state_solver.getState();
1125 prefix =
"prefix3_";
1126 Joint prefix_joint3(prefix + subgraph_joint_name);
1131 EXPECT_FALSE(state_solver.insertSceneGraph(empty_scene_graph, prefix_joint3, prefix));
1133 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1139 state_solver_clone = state_solver.clone();
1143template <
typename S>
1150 const std::string link_name1 =
"link_n1";
1151 const std::string joint_name1 =
"joint_n1";
1156 joint_1.child_link_name = link_name1;
1162 auto base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1178 Eigen::Isometry3d new_origin = Eigen::Isometry3d::Identity();
1179 new_origin.translation()(0) += 1.234;
1182 EXPECT_TRUE(state_solver.changeJointOrigin(joint_name1, new_origin));
1184 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1190 state_solver_clone = state_solver.clone();
1194 state = state_solver.getState();
1201 EXPECT_FALSE(state_solver.changeJointOrigin(
"joint_does_not_exist", new_origin));
1203 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1209 state_solver_clone = state_solver.clone();
1213template <
typename S>
1220 const std::string link_name1 =
"link_n1";
1221 const std::string link_name2 =
"link_n2";
1222 const std::string joint_name1 =
"joint_n1";
1223 const std::string joint_name2 =
"joint_n2";
1229 joint_1.child_link_name = link_name1;
1233 joint_2.parent_to_joint_origin_transform.translation()(0) = 1.25;
1234 joint_2.parent_link_name = link_name1;
1235 joint_2.child_link_name = link_name2;
1241 auto base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1258 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1263 state_solver_clone = state_solver.clone();
1266 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
1267 state = state_solver.getState();
1280 EXPECT_TRUE(state_solver.moveJoint(joint_name1,
"tool0"));
1282 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1288 state_solver_clone = state_solver.clone();
1292 state = state_solver.getState();
1305 EXPECT_FALSE(state_solver.moveJoint(
"joint_does_not_exist",
"tool0"));
1307 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1313 state_solver_clone = state_solver.clone();
1317 EXPECT_FALSE(state_solver.moveJoint(joint_name1,
"link_does_not_exist"));
1319 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1325 state_solver_clone = state_solver.clone();
1329template <
typename S>
1336 const std::string link_name1 =
"link_n1";
1337 const std::string link_name2 =
"link_n2";
1338 const std::string joint_name1 =
"joint_n1";
1339 const std::string joint_name2 =
"joint_n2";
1345 joint_1.child_link_name = link_name1;
1349 joint_2.parent_to_joint_origin_transform.translation()(0) = 1.25;
1350 joint_2.parent_link_name = link_name1;
1351 joint_2.child_link_name = link_name2;
1357 auto base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1374 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1380 state_solver_clone = state_solver.clone();
1383 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
1384 state = state_solver.getState();
1396 std::string moved_joint_name = joint_name1 +
"_moved";
1397 Joint move_link_joint =
joint_1.clone(moved_joint_name);
1401 EXPECT_TRUE(state_solver.moveLink(move_link_joint));
1403 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1409 state_solver_clone = state_solver.clone();
1413 state = state_solver.getState();
1429 std::string moved_joint_name_err = joint_name1 +
"_err";
1430 Joint move_link_joint_err1 =
joint_1.clone(moved_joint_name_err);
1434 EXPECT_FALSE(state_solver.moveLink(move_link_joint_err1));
1436 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1442 Joint move_link_joint_err2 =
joint_1.clone(moved_joint_name_err);
1445 EXPECT_FALSE(state_solver.moveLink(move_link_joint_err2));
1447 base_state_solver = std::make_shared<KDLStateSolver>(*
scene_graph);
1453template <
typename S>
1460 double new_lower = 1.0;
1461 double new_upper = 2.0;
1462 double new_velocity = 3.0;
1463 double new_acceleration = 4.0;
1465 scene_graph->changeJointPositionLimits(
"joint_a1", new_lower, new_upper);
1466 scene_graph->changeJointVelocityLimits(
"joint_a1", new_velocity);
1467 scene_graph->changeJointAccelerationLimits(
"joint_a1", new_acceleration);
1469 EXPECT_TRUE(state_solver.changeJointPositionLimits(
"joint_a1", new_lower, new_upper));
1470 EXPECT_TRUE(state_solver.changeJointVelocityLimits(
"joint_a1", new_velocity));
1471 EXPECT_TRUE(state_solver.changeJointAccelerationLimits(
"joint_a1", new_acceleration));
1474 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
1476 auto limits = state_solver.getLimits();
1485 S& state_solver_clone =
static_cast<S&
>(*temp);
1487 std::vector<std::string>
joint_names = state_solver_clone.getActiveJointNames();
1489 auto limits = state_solver_clone.getLimits();
1497 double new_lower_err = 1.0 * 10;
1498 double new_upper_err = 2.0 * 10;
1499 double new_velocity_err = 3.0 * 10;
1500 double new_acceleration_err = 4.0 * 10;
1501 EXPECT_FALSE(state_solver.changeJointPositionLimits(
"joint_does_not_exist", new_lower_err, new_upper_err));
1502 EXPECT_FALSE(state_solver.changeJointVelocityLimits(
"joint_does_not_exist", new_velocity_err));
1503 EXPECT_FALSE(state_solver.changeJointAccelerationLimits(
"joint_does_not_exist", new_acceleration_err));
1506 std::vector<std::string>
joint_names = state_solver.getActiveJointNames();
1508 auto limits = state_solver.getLimits();
1517 S& state_solver_clone =
static_cast<S&
>(*temp);
1519 std::vector<std::string>
joint_names = state_solver_clone.getActiveJointNames();
1521 auto limits = state_solver_clone.getLimits();
1529template <
typename S>
1538 joint_1.parent_to_joint_origin_transform.translation()(0) = 1.25;
1539 joint_1.parent_link_name =
"base_link";
1540 joint_1.child_link_name =
"link_1";
1563 joint_1.parent_to_joint_origin_transform.translation()(0) = 1.25;
1564 joint_1.parent_link_name =
"base_link";
1565 joint_1.child_link_name =
"link_2_does_not_exist";
1590 EXPECT_TRUE(state_solver.replaceJoint(new_joint_a1));
1613 EXPECT_TRUE(state_solver.replaceJoint(new_joint_a1));
1636 EXPECT_TRUE(state_solver.replaceJoint(new_joint_a1));
1659 EXPECT_TRUE(state_solver.replaceJoint(new_joint_a1));
1679 EXPECT_TRUE(state_solver.replaceJoint(new_joint_a3));
1698 Joint new_joint_a3 =
scene_graph->getJoint(
"joint_a3")->clone(
"joint_does_not_exist");
Abstract class for resource loaders.
Definition: tesseract_support_resource_locator.h:42
JointType type
The type of joint.
Definition: joint.h:301
Eigen::Isometry3d parent_to_joint_origin_transform
transform from Parent Link frame to Joint frame
Definition: joint.h:322
std::string parent_link_name
Definition: joint.h:319
std::string child_link_name
Definition: joint.h:315
Definition: kdl_state_solver.h:43
std::unique_ptr< SceneGraph > UPtr
Definition: graph.h:132
Definition: state_solver.h:46
virtual Eigen::MatrixXd getJacobian(const Eigen::Ref< const Eigen::VectorXd > &joint_values, const std::string &link_name) const =0
Get the jacobian of the solver given the joint values.
std::unique_ptr< StateSolver > UPtr
Definition: state_solver.h:50
virtual std::vector< std::string > getActiveJointNames() const =0
Get the vector of joint names which align with the limits.
virtual SceneState getRandomState() const =0
Get the random state of the environment.
virtual std::vector< std::string > getJointNames() const =0
Get the vector of joint names.
virtual bool hasLinkName(const std::string &link_name) const =0
Check if link name exists.
virtual SceneState getState(const Eigen::Ref< const Eigen::VectorXd > &joint_values) const =0
Get the state of the solver given the joint values.
virtual tesseract_common::KinematicLimits getLimits() const =0
Getter for kinematic limits.
virtual Eigen::Isometry3d getLinkTransform(const std::string &link_name) const =0
Get the transform corresponding to the link.
virtual bool isActiveLinkName(const std::string &link_name) const =0
Check if link is an active link.
virtual std::vector< std::string > getLinkNames() const =0
Get the vector of link names.
virtual Eigen::Isometry3d getRelativeLinkTransform(const std::string &from_link_name, const std::string &to_link_name) const =0
Get transform between two links using the current state.
virtual std::string getBaseLinkName() const =0
Get the base link name.
virtual tesseract_common::VectorIsometry3d getLinkTransforms() const =0
Get all of the links transforms.
virtual std::vector< std::string > getActiveLinkNames() const =0
Get the vector of active link names.
virtual void setState(const Eigen::Ref< const Eigen::VectorXd > &joint_values)=0
Set the current state of the solver.
virtual std::vector< std::string > getStaticLinkNames() const =0
Get a vector of static link names in the environment.
EXPECT_NEAR(config.contact_manager_config.margin_data.getDefaultCollisionMargin(), 5, 1e-6)
results link_names[0]
Definition: collision_core_unit.cpp:146
EXPECT_EQ(results.distance, std::numeric_limits< double >::max())
EXPECT_FALSE(tesseract_collision::isContactAllowed("base_link", "link_2", acm, false))
EXPECT_TRUE(tesseract_common::isIdentical< tesseract_collision::ObjectPairKey >(pairs, check_pairs, false))
auto scene_graph
Definition: ikfast_kinematics_7dof_unit.cpp:51
Tesseract Scene Graph State Solver KDL Implementation.
Eigen::VectorXd jv
Definition: kinematics_core_unit.cpp:152
Eigen::MatrixXd jacobian
Definition: kinematics_core_unit.cpp:153
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
bool isIdentical(const std::vector< T > &vec1, const std::vector< T > &vec2, bool ordered=true, const std::function< bool(const T &, const T &)> &equal_pred=[](const T &v1, const T &v2) { return v1==v2;}, const std::function< bool(const T &, const T &)> &comp=[](const T &v1, const T &v2) { return v1< v2;})
Check if two vector of strings are identical.
Definition: utils.h:217
void jacobianChangeRefPoint(Eigen::Ref< Eigen::MatrixXd > jacobian, const Eigen::Ref< const Eigen::Vector3d > &ref_point)
Change the reference point of the jacobian.
Definition: utils.cpp:108
std::string getTempPath()
Get the host temp directory path.
Definition: utils.cpp:209
AlignedMap< std::string, Eigen::Isometry3d > TransformMap
Definition: types.h:66
AlignedVector< Eigen::Isometry3d > VectorIsometry3d
Definition: types.h:62
void jacobianChangeBase(Eigen::Ref< Eigen::MatrixXd > jacobian, const Eigen::Isometry3d &change_base)
Change the base coordinate system of the jacobian.
Definition: utils.cpp:101
Definition: state_solver_test_suite.h:19
void runAddSceneGraphTest()
Definition: state_solver_test_suite.h:1003
void runMoveJointTest()
Definition: state_solver_test_suite.h:1214
SceneGraph::UPtr getSceneGraph()
Definition: state_solver_test_suite.h:20
void runCompareSceneStates(const SceneState &base_state, const SceneState &compare_state)
Definition: state_solver_test_suite.h:60
void runReplaceJointTest()
Definition: state_solver_test_suite.h:1530
void runJacobianTest()
Definition: state_solver_test_suite.h:353
static void numericalJacobian(Eigen::Ref< Eigen::MatrixXd > jacobian, const Eigen::Isometry3d &change_base, const StateSolver &state_solver, const std::vector< std::string > &joint_names, const Eigen::Ref< const Eigen::VectorXd > &joint_values, const std::string &link_name, const Eigen::Ref< const Eigen::Vector3d > &link_point)
Numerically calculate a jacobian. This is mainly used for testing.
Definition: state_solver_test_suite.h:194
void runCompareStateSolver(const StateSolver &base_solver, StateSolver &comp_solver)
Definition: state_solver_test_suite.h:82
SceneGraph::UPtr getSubSceneGraph()
Definition: state_solver_test_suite.h:28
void runChangeJointLimitsTest()
Definition: state_solver_test_suite.h:1454
void runCompareJacobian(StateSolver &state_solver, const std::vector< std::string > &joint_names, const Eigen::VectorXd &jvals, const std::string &link_name, const Eigen::Vector3d &link_point, const Eigen::Isometry3d &change_base)
Run a kinematic jacobian test.
Definition: state_solver_test_suite.h:256
void runMoveLinkTest()
Definition: state_solver_test_suite.h:1330
void runAddandRemoveLinkTest()
Definition: state_solver_test_suite.h:733
void runCompareStateSolverLimits(const SceneGraph &scene_graph, const StateSolver &comp_solver)
Definition: state_solver_test_suite.h:171
void runChangeJointOriginTest()
Definition: state_solver_test_suite.h:1144
tesseract_scene_graph::SceneGraph::UPtr parseURDFFile(const std::string &path, const tesseract_common::ResourceLocator &locator)
Parse a URDF file into a Tesseract Scene Graph.
Definition: urdf_parser.cpp:160
Locate and retrieve resource data.
ResourceLocator::Ptr locator
Definition: resource_locator_unit.cpp:57
Store kinematic limits.
Definition: kinematic_limits.h:39
This holds a state of the scene.
Definition: scene_state.h:54
tesseract_common::TransformMap link_transforms
The link transforms in world coordinate system.
Definition: scene_state.h:68
Eigen::VectorXd getJointValues(const std::vector< std::string > &joint_names) const
Definition: scene_state.cpp:46
std::unordered_map< std::string, double > joints
The joint values used for calculating the joint and link transforms.
Definition: scene_state.h:65
tesseract_common::TransformMap joint_transforms
The joint transforms in world coordinate system.
Definition: scene_state.h:71
Common Tesseract Utility Functions.
joint_state joint_names
Definition: tesseract_common_serialization_unit.cpp:75
tesseract_collision::ContactResultMap collision
Definition: tesseract_environment_collision.cpp:124
auto pose
Definition: tesseract_environment_collision.cpp:118
joint_1 limits
Definition: tesseract_scene_graph_joint_unit.cpp:153
JointDynamics j
Definition: tesseract_scene_graph_joint_unit.cpp:15
joint_1 mimic joint_name
Definition: tesseract_scene_graph_joint_unit.cpp:163
Joint joint_2("joint_a2")
tesseract_common::fs::path path
Definition: tesseract_srdf_unit.cpp:1992
Joint joint_1("joint_a1")
Locate and retrieve resource data in tesseract_support.
tesseract_scene_graph::Link::Ptr link_1
Definition: tesseract_urdf_urdf_unit.cpp:464
A urdf parser for tesseract.