test_faulty_params.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 #include <ros/ros.h>
3 
5 #include <moveit/robot_model_loader/robot_model_loader.h>
9 
10 // Names to read values from the parameter server
11 const std::string GROUP_PARAM = "group";
12 const std::string TIP_LINK_PARAM = "tip_link";
13 const std::string ROOT_LINK_PARAM = "root_link";
14 
15 // Robot description almost always called "robot_description" and therefore hardcoded below
16 const std::string ROBOT_DESCRIPTION = "robot_description";
17 
18 class TestPlugin : public ::testing::Test
19 {
20 protected:
21  void SetUp() override
22  {
23  ros::NodeHandle nh;
26  {
27  rdf_loader::RDFLoader rdf_loader(ROBOT_DESCRIPTION);
28  const srdf::ModelSharedPtr& srdf = rdf_loader.getSRDF();
29  const urdf::ModelInterfaceSharedPtr& urdf_model = rdf_loader.getURDF();
30 
31  if (!urdf_model || !srdf)
32  {
33  ROS_ERROR_NAMED("opw", "URDF and SRDF must be loaded for SRV kinematics "
34  "solver to work."); // TODO: is this true?
35  return;
36  }
37 
38  robot_model_.reset(new robot_model::RobotModel(urdf_model, srdf));
39  }
40  else
41  {
42  ROS_ERROR_STREAM("Failed to load parameters necessary to load plugin.");
43  }
44  }
45  void TearDown() override
46  {
47  }
48 
49  robot_model::RobotModelPtr robot_model_;
51  std::string root_link_;
52  std::string tip_link_;
53  std::string group_name_;
55 };
56 
63 TEST_F(TestPlugin, InitFaulty)
64 {
65  // the last parameter specifies "search_discretization", which is not used by the opw plugin
66  bool res = plugin_.initialize(*robot_model_.get(), group_name_, root_link_, { tip_link_ }, 0.1);
67  EXPECT_FALSE(res);
68 }
69 
70 int main(int argc, char** argv)
71 {
72  ros::init(argc, argv, "moveit_opw_kinematics_test_fanuc");
73  testing::InitGoogleTest(&argc, argv);
74  return RUN_ALL_TESTS();
75 }
const std::string GROUP_PARAM
void TearDown() override
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
const std::string ROBOT_DESCRIPTION
void SetUp() override
const std::string TIP_LINK_PARAM
robot_model::RobotModelPtr robot_model_
std::string tip_link_
#define EXPECT_FALSE(args)
Specific implementation of kinematics using ROS service calls to communicate with external IK solvers...
bool getParam(const std::string &key, std::string &s) const
std::string robot_description_name_
TEST_F(TestPlugin, InitFaulty)
moveit_opw_kinematics_plugin::MoveItOPWKinematicsPlugin plugin_
std::string root_link_
std::shared_ptr< Model > ModelSharedPtr
const std::string ROOT_LINK_PARAM
std::string group_name_
#define ROS_ERROR_NAMED(name,...)
virtual bool initialize(const moveit::core::RobotModel &robot_model, const std::string &group_name, const std::string &base_frame, const std::vector< std::string > &tip_frames, double search_discretization) override
int main(int argc, char **argv)
#define ROS_ERROR_STREAM(args)


moveit_opw_kinematics_plugin
Author(s): Jeroen De Maeyer, Simon Schmeisser (isys vision)
autogenerated on Mon Feb 28 2022 22:50:11