52 MoveItSetupTest::SetUp();
53 config_data_->registerType(
"moveit_controllers",
"moveit_setup::controllers::MoveItControllersConfig");
54 config_data_->registerType(
"ros2_controllers",
"moveit_setup::controllers::ROS2ControllersConfig");
55 config_data_->registerType(
"modified_urdf",
"moveit_setup::ModifiedUrdfConfig");
56 config_data_->registerType(
"control_xacro",
"moveit_setup::controllers::ControlXacroConfig");
62 config_data_->preloadWithFullConfig(
"moveit_resources_fanuc_moveit_config");
64 const std::vector<ControllerInfo>& controllers = ros2_controllers_config->
getControllers();
65 ASSERT_EQ(1u, controllers.size());
67 EXPECT_EQ(
"fanuc_controller", ci.
name_);
68 EXPECT_EQ(
"joint_trajectory_controller/JointTrajectoryController", ci.
type_);
69 EXPECT_EQ(6u, ci.
joints_.size());
72 const std::vector<ControllerInfo>& mcontrollers = moveit_controllers_config->
getControllers();
73 ASSERT_EQ(1u, mcontrollers.size());
75 EXPECT_EQ(
"fanuc_controller", mci.
name_);
76 EXPECT_EQ(
"FollowJointTrajectory", mci.
type_);
77 EXPECT_EQ(6u, mci.
joints_.size());
82 config_data_->preloadWithFullConfig(
"moveit_resources_panda_moveit_config");
84 const std::vector<ControllerInfo>& controllers = ros2_controllers_config->
getControllers();
85 ASSERT_EQ(2u, controllers.size());
87 int offset = controllers[0].name_ ==
"panda_arm_controller" ? 0 : 1;
89 EXPECT_EQ(
"panda_arm_controller", ci1.
name_);
90 EXPECT_EQ(
"joint_trajectory_controller/JointTrajectoryController", ci1.
type_);
91 EXPECT_EQ(7u, ci1.
joints_.size());
94 EXPECT_EQ(
"panda_hand_controller", ci2.
name_);
95 EXPECT_EQ(
"position_controllers/GripperActionController", ci2.
type_);
96 EXPECT_EQ(1u, ci2.
joints_.size());
113 config_data_->preloadWithFullConfig(
"moveit_resources_fanuc_moveit_config");
115 generateFiles<ROS2ControllersConfig>(
"ros2_controllers");
116 generateFiles<MoveItControllersConfig>(
"moveit_controllers");
118 std::filesystem::path original_config = getSharePath(
"moveit_resources_fanuc_moveit_config");
119 for (
const std::string relative_path : {
"config/moveit_controllers.yaml",
"config/ros2_controllers.yaml" })
121 expectYamlEquivalence(output_dir_ / relative_path, original_config / relative_path);
128 auto config_dir = getSharePath(
"moveit_resources_panda_moveit_config");
129 YAML::Node settings = YAML::LoadFile(config_dir /
".setup_assistant")[
"moveit_setup_assistant_config"];
132 srdf_config->
loadPrevious(config_dir, settings[
"SRDF"]);
137 EXPECT_EQ(ros2_controllers_config->getControllers().size(), 0u);
141 initializeStep(setup_step);
147 size_t group_count = srdf_config->getGroups().size();
150 EXPECT_EQ(ros2_controllers_config->getControllers().size(), group_count);
155 testing::InitGoogleTest(&argc, argv);
156 rclcpp::init(argc, argv);
157 return RUN_ALL_TESTS();
Test environment with DataWarehouse setup and help for generating files in a temp dir.
moveit_setup::DataWarehousePtr config_data_
void loadPrevious(const std::filesystem::path &package_path, const YAML::Node &node) override
Loads the configuration from an existing MoveIt configuration.
std::vector< ControllerInfo > & getControllers()
Gets controllers_ vector.
bool addDefaultControllers()
std::filesystem::path getSharePath(const std::string &package_name)
Return a path for the given package's share folder.
void expectYamlEquivalence(const YAML::Node &generated, const YAML::Node &reference, const std::filesystem::path &generated_path, const std::string &yaml_namespace="")
std::vector< std::string > joints_
TEST_F(ControllersTest, ParseFanuc)
int main(int argc, char **argv)