Tesseract
Motion Planning Environment
|
Tesseract kinematics factory test. More...
#include <tesseract_common/macros.h>
#include <gtest/gtest.h>
#include <fstream>
#include "kinematics_test_utils.h"
#include <tesseract_kinematics/core/kinematics_plugin_factory.h>
#include <tesseract_state_solver/kdl/kdl_state_solver.h>
Functions | |
void | runKinematicsFactoryTest (const tesseract_common::fs::path &config_path) |
runKinematicsFactoryTest (config_path) | |
runKinematicsFactoryTest (export_config_path) | |
EXPECT_FALSE (factory.getSearchPaths().empty()) | |
EXPECT_EQ (factory.getSearchPaths().size(), 1) | |
EXPECT_EQ (factory.getSearchLibraries().size(), 4) | |
EXPECT_EQ (factory.getFwdKinPlugins().size(), 0) | |
factory | addSearchPath ("/usr/local/lib") |
EXPECT_EQ (factory.getSearchPaths().size(), 2) | |
factory | addSearchLibrary ("tesseract_collision") |
EXPECT_EQ (factory.getSearchLibraries().size(), 5) | |
EXPECT_TRUE (map.find("manipulator")==map.end()) | |
factory | addFwdKinPlugin ("manipulator", "KDLFwdKin", pi) |
EXPECT_TRUE (map.find("manipulator") !=map.end()) | |
EXPECT_TRUE (map.at("manipulator").plugins.find("KDLFwdKin") !=map.at("manipulator").plugins.end()) | |
EXPECT_EQ (map.find("manipulator") ->second.plugins.size(), 1) | |
EXPECT_EQ (factory.getDefaultFwdKinPlugin("manipulator"), "KDLFwdKin") | |
factory | addFwdKinPlugin ("manipulator", "default", pi2) |
EXPECT_TRUE (map.at("manipulator").plugins.find("default") !=map.at("manipulator").plugins.end()) | |
EXPECT_EQ (map.find("manipulator") ->second.plugins.size(), 2) | |
factory | setDefaultFwdKinPlugin ("manipulator", "default") |
EXPECT_EQ (factory.getDefaultFwdKinPlugin("manipulator"), "default") | |
factory | removeFwdKinPlugin ("manipulator", "default") |
factory | addInvKinPlugin ("manipulator", "KDLInvKin", pi) |
EXPECT_TRUE (map.at("manipulator").plugins.find("KDLInvKin") !=map.at("manipulator").plugins.end()) | |
EXPECT_EQ (factory.getDefaultInvKinPlugin("manipulator"), "KDLInvKin") | |
factory | addInvKinPlugin ("manipulator", "default", pi2) |
factory | setDefaultInvKinPlugin ("manipulator", "default") |
factory | removeInvKinPlugin ("manipulator", "default") |
plugin | remove ("OPWInvKin") |
EXPECT_TRUE (inv_kin==nullptr) | |
plugin | remove ("class") |
EXPECT_ANY_THROW (KinematicsPluginFactory factory(config)) | |
plugin | remove ("default") |
EXPECT_TRUE (inv_kin !=nullptr) | |
KinematicsPluginFactory | factory (YAML::Load(yaml_string)) |
EXPECT_EQ (inv_kin->getSolverName(), "OPWInvKin") | |
plugin | remove ("config") |
plugin["config"] | remove ("base_link") |
plugin["config"] | remove ("tip_link") |
plugin["config"] | remove ("params") |
plugin["config"]["params"] | remove ("a1") |
plugin["config"]["params"] | remove ("a2") |
plugin["config"]["params"] | remove ("b") |
plugin["config"]["params"] | remove ("c1") |
plugin["config"]["params"] | remove ("c2") |
plugin["config"]["params"] | remove ("c3") |
plugin["config"]["params"] | remove ("c4") |
plugin["config"]["params"] | remove ("offset") |
plugin["config"]["params"] | remove ("sign_corrections") |
plugin["config"]["params"]["offsets"] | push_back (0) |
EXPECT_EQ (inv_kin->getSolverName(), "URInvKin") | |
KinematicsPluginFactory | factory (YAML::Load(yaml_model_string)) |
plugin["config"] | remove ("model") |
plugin["config"]["params"] | remove ("d1") |
plugin["config"]["params"] | remove ("a3") |
plugin["config"]["params"] | remove ("d4") |
plugin["config"]["params"] | remove ("d5") |
plugin["config"]["params"] | remove ("d6") |
EXPECT_EQ (inv_kin->getSolverName(), "REPInvKin") | |
plugin["config"] | remove ("manipulator_reach") |
plugin["config"] | remove ("positioner_sample_resolution") |
plugin["config"]["positioner_sample_resolution"][0] | remove ("name") |
plugin["config"]["positioner_sample_resolution"][0] | remove ("value") |
plugin["config"] | remove ("positioner") |
plugin["config"] | remove ("manipulator") |
EXPECT_EQ (inv_kin->getSolverName(), "ROPInvKin") | |
EXPECT_TRUE (fwd_kin !=nullptr) | |
EXPECT_EQ (fwd_kin->getSolverName(), "KDLFwdKinChain") | |
EXPECT_EQ (inv_kin->getSolverName(), "KDLInvKinChainLMA") | |
EXPECT_EQ (inv_kin->getSolverName(), "KDLInvKinChainNR") | |
EXPECT_TRUE (kin==nullptr) | |
int | main (int argc, char **argv) |
Variables | |
tesseract_common::fs::path | config_path = file_path.parent_path() / "kinematic_plugins.yaml" |
tesseract_common::fs::path | export_config_path |
tesseract_common::PluginInfo | pi |
pi | class_name = "KDLFwdKin" |
map = factory.getFwdKinPlugins() | |
tesseract_common::PluginInfo | pi2 |
tesseract_scene_graph::SceneGraph::UPtr | scene_graph = getSceneGraphABB() |
tesseract_scene_graph::SceneState | scene_state = state_solver.getState() |
std::string | yaml_string |
auto | plugin = config["kinematic_plugins"]["inv_kin_plugins"]["manipulator"]["plugins"] |
KinematicsPluginFactory | factory (config) |
auto | inv_kin = factory.createInvKin("manipulator", "OPWInvKin", *scene_graph, scene_state) |
std::string | yaml_model_string |
std::string | yaml_params_string |
config ["kinematic_plugins"]["inv_kin_plugins"]["manipulator"]["plugins"]["URInvKin"]["config"]["model"] = "UR10e" | |
auto | fwd_kin = factory.createFwdKin("manipulator", "KDLFwdKinChain", *scene_graph, scene_state) |
auto | kin = factory.createFwdKin("manipulator", "KDLFwdKinChain", *scene_graph, scene_state) |
Tesseract kinematics factory test.
factory addSearchLibrary | ( | "tesseract_collision" | ) |
factory addSearchPath | ( | "/usr/local/lib" | ) |
EXPECT_ANY_THROW | ( | KinematicsPluginFactory | factoryconfig | ) |
EXPECT_EQ | ( | factory. | getDefaultFwdKinPlugin"manipulator", |
"default" | |||
) |
EXPECT_EQ | ( | factory. | getDefaultFwdKinPlugin"manipulator", |
"KDLFwdKin" | |||
) |
EXPECT_EQ | ( | factory. | getDefaultInvKinPlugin"manipulator", |
"KDLInvKin" | |||
) |
EXPECT_EQ | ( | factory. | getFwdKinPlugins).size(, |
0 | |||
) |
EXPECT_EQ | ( | factory. | getSearchLibraries).size(, |
4 | |||
) |
EXPECT_EQ | ( | factory. | getSearchLibraries).size(, |
5 | |||
) |
EXPECT_EQ | ( | factory. | getSearchPaths).size(, |
1 | |||
) |
EXPECT_EQ | ( | factory. | getSearchPaths).size(, |
2 | |||
) |
EXPECT_EQ | ( | fwd_kin-> | getSolverName(), |
"KDLFwdKinChain" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"KDLInvKinChainLMA" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"KDLInvKinChainNR" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"OPWInvKin" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"REPInvKin" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"ROPInvKin" | |||
) |
EXPECT_EQ | ( | inv_kin-> | getSolverName(), |
"URInvKin" | |||
) |
EXPECT_EQ | ( | map. | find"manipulator") ->second.plugins.size(, |
1 | |||
) |
EXPECT_EQ | ( | map. | find"manipulator") ->second.plugins.size(, |
2 | |||
) |
EXPECT_FALSE | ( | factory. | getSearchPaths).empty( | ) |
EXPECT_TRUE | ( | fwd_kin ! | = nullptr | ) |
EXPECT_TRUE | ( | inv_kin ! | = nullptr | ) |
EXPECT_TRUE | ( | inv_kin | = =nullptr | ) |
EXPECT_TRUE | ( | kin | = =nullptr | ) |
EXPECT_TRUE | ( | map.at("manipulator").plugins.find("default") ! | = map.at("manipulator").plugins.end() | ) |
EXPECT_TRUE | ( | map.at("manipulator").plugins.find("KDLFwdKin") ! | = map.at("manipulator").plugins.end() | ) |
EXPECT_TRUE | ( | map.at("manipulator").plugins.find("KDLInvKin") ! | = map.at("manipulator").plugins.end() | ) |
EXPECT_TRUE | ( | map.find("manipulator") ! | = map.end() | ) |
EXPECT_TRUE | ( | map. | find"manipulator" = =map.end() | ) |
KinematicsPluginFactory factory | ( | YAML::Load(yaml_model_string) | ) |
KinematicsPluginFactory factory | ( | YAML::Load(yaml_string) | ) |
int main | ( | int | argc, |
char ** | argv | ||
) |
plugin["config"]["params"]["offsets"] push_back | ( | 0 | ) |
plugin["config"]["params"] remove | ( | "a1" | ) |
plugin["config"]["params"] remove | ( | "a2" | ) |
plugin["config"]["params"] remove | ( | "a3" | ) |
plugin["config"]["params"] remove | ( | "b" | ) |
plugin["config"] remove | ( | "base_link" | ) |
plugin["config"]["params"] remove | ( | "c1" | ) |
plugin["config"]["params"] remove | ( | "c2" | ) |
plugin["config"]["params"] remove | ( | "c3" | ) |
plugin["config"]["params"] remove | ( | "c4" | ) |
plugin remove | ( | "class" | ) |
plugin remove | ( | "config" | ) |
plugin["config"]["params"] remove | ( | "d1" | ) |
plugin["config"]["params"] remove | ( | "d4" | ) |
plugin["config"]["params"] remove | ( | "d5" | ) |
plugin["config"]["params"] remove | ( | "d6" | ) |
plugin remove | ( | "default" | ) |
plugin["config"] remove | ( | "manipulator" | ) |
plugin["config"] remove | ( | "manipulator_reach" | ) |
plugin["config"] remove | ( | "model" | ) |
plugin["config"]["positioner_sample_resolution"][0] remove | ( | "name" | ) |
plugin["config"]["params"] remove | ( | "offset" | ) |
plugin remove | ( | "OPWInvKin" | ) |
plugin["config"] remove | ( | "params" | ) |
plugin["config"] remove | ( | "positioner" | ) |
plugin["config"] remove | ( | "positioner_sample_resolution" | ) |
plugin["config"]["params"] remove | ( | "sign_corrections" | ) |
plugin["config"] remove | ( | "tip_link" | ) |
plugin["config"]["positioner_sample_resolution"][0] remove | ( | "value" | ) |
factory removeFwdKinPlugin | ( | "manipulator" | , |
"default" | |||
) |
factory removeInvKinPlugin | ( | "manipulator" | , |
"default" | |||
) |
runKinematicsFactoryTest | ( | config_path | ) |
void runKinematicsFactoryTest | ( | const tesseract_common::fs::path & | config_path | ) |
runKinematicsFactoryTest | ( | export_config_path | ) |
factory setDefaultFwdKinPlugin | ( | "manipulator" | , |
"default" | |||
) |
factory setDefaultInvKinPlugin | ( | "manipulator" | , |
"default" | |||
) |
pi2 class_name = "KDLFwdKin" |
config["kinematic_plugins"]["inv_kin_plugins"]["manipulator"]["plugins"]["URInvKin"]["config"]["model"] = "UR10e" |
tesseract_common::fs::path config_path = file_path.parent_path() / "kinematic_plugins.yaml" |
tesseract_common::fs::path export_config_path |
KinematicsPluginFactory factory(config) | ( | config | ) |
auto fwd_kin = factory.createFwdKin("manipulator", "KDLFwdKinChain", *scene_graph, scene_state) |
auto inv_kin = factory.createInvKin("manipulator", "OPWInvKin", *scene_graph, scene_state) |
auto kin = factory.createFwdKin("manipulator", "KDLFwdKinChain", *scene_graph, scene_state) |
map = factory.getFwdKinPlugins() |
tesseract_scene_graph::KDLStateSolver state_solver* scene_graph = getSceneGraphABB() |
tesseract_scene_graph::SceneState scene_state = state_solver.getState() |
std::string yaml_model_string |
std::string yaml_params_string |
std::string yaml_string |