36 #include <gtest/gtest.h> 40 #include <urdf_parser/urdf_parser.h> 43 #include <boost/filesystem/path.hpp> 44 #include <moveit_resources/config.h> 45 #include <boost/filesystem.hpp> 54 boost::filesystem::path res_path(MOVEIT_TEST_RESOURCES_DIR);
58 std::fstream xml_file((res_path /
"panda_description/urdf/panda.urdf").
string().c_str(), std::fstream::in);
59 if (xml_file.is_open())
61 while (xml_file.good())
64 std::getline(xml_file, line);
65 xml_string += (line +
"\n");
70 srdf_model->initFile(*
urdf_model, (res_path /
"panda_moveit_config/config/panda.srdf").
string());
82 boost::filesystem::path res_path(MOVEIT_TEST_RESOURCES_DIR);
85 moveit_setup_assistant::MoveItConfigDataPtr config_data_;
92 EXPECT_EQ(config_data_->getROSControllers().size(), 0);
95 config_data_->addDefaultControllers();
98 int group_count = config_data_->srdf_->srdf_model_->getGroups().size();
101 EXPECT_EQ(config_data_->getROSControllers().size(), group_count);
104 char test_file[] =
"/tmp/msa_unittest_ros_controller.yaml";
107 EXPECT_EQ(config_data_->outputROSControllersYAML(test_file),
true);
113 EXPECT_EQ(config_data_->getROSControllers().size(), 0);
116 EXPECT_EQ(config_data_->inputROSControllersYAML(test_file),
true);
119 EXPECT_EQ(config_data_->getROSControllers().size(), group_count);
122 boost::filesystem::remove(test_file);
129 moveit_setup_assistant::MoveItConfigDataPtr config_data_;
132 boost::filesystem::path setup_assistant_path(config_data_->setup_assistant_path_);
135 EXPECT_EQ(config_data_->getSensorPluginConfig().size(), 0);
138 config_data_->input3DSensorsYAML(
139 (setup_assistant_path /
"templates/moveit_config_pkg_template/config/sensors_3d.yaml").
string());
143 EXPECT_EQ(config_data_->getSensorPluginConfig().size(), 2);
145 EXPECT_EQ(config_data_->getSensorPluginConfig()[0][
"sensor_plugin"].getValue(),
146 std::string(
"occupancy_map_monitor/PointCloudOctomapUpdater"));
148 EXPECT_EQ(config_data_->getSensorPluginConfig()[1][
"sensor_plugin"].getValue(),
149 std::string(
"occupancy_map_monitor/DepthImageOctomapUpdater"));
152 int main(
int argc,
char** argv)
154 testing::InitGoogleTest(&argc, argv);
155 return RUN_ALL_TESTS();
int main(int argc, char **argv)
def xml_string(rootXml, addHeader=True)
moveit::core::RobotModelPtr robot_model
urdf::ModelInterfaceSharedPtr urdf_model
srdf::ModelSharedPtr srdf_model
This class is shared with all widgets and contains the common configuration data needed for generatin...
TEST_F(MoveItConfigData, ReadingControllers)