@@ -847,13 +847,63 @@ INSTANTIATE_TEST_CASE_P(
847847 )
848848);
849849
850- // TODO(denis): Add incorrect interface parameters
851- TEST_F (TrajectoryControllerTest, incorrect_initialization_using_wrong_parameters) {
850+ TEST_F (TrajectoryControllerTest, incorrect_initialization_using_interface_parameters) {
851+ auto set_parameter_and_check_result = [&] () {
852+ SetParameters (); // This call is replacing the way parameters are set via launch
853+ traj_controller_->configure ();
854+ auto state = traj_controller_->get_current_state ();
855+ EXPECT_EQ (state.id (), State::PRIMARY_STATE_FINALIZED);
856+ };
857+
852858 SetUpTrajectoryController (false );
853859
854- // This call is replacing the way parameters are set via launch
855- SetParameters ();
856- traj_controller_->configure ();
857- auto state = traj_controller_->get_current_state ();
858- ASSERT_EQ (State::PRIMARY_STATE_INACTIVE, state.id ());
860+ // command interfaces: empty
861+ command_interface_types_ = {};
862+ set_parameter_and_check_result ();
863+
864+ // command interfaces: bad_name
865+ command_interface_types_ = {" bad_name" };
866+ set_parameter_and_check_result ();
867+
868+ // command interfaces: effort not yet implemented
869+ command_interface_types_ = {" effort" };
870+ set_parameter_and_check_result ();
871+
872+ // command interfaces: effort has to be only
873+ command_interface_types_ = {" effort" , " position" };
874+ set_parameter_and_check_result ();
875+
876+ // command interfaces: velocity alone not yet implemented
877+ command_interface_types_ = {" velocity" };
878+ set_parameter_and_check_result ();
879+
880+ // command interfaces: velocity - position not present
881+ command_interface_types_ = {" velocity" , " acceleration" };
882+ set_parameter_and_check_result ();
883+
884+ // command interfaces: acceleration without position and velocity
885+ command_interface_types_ = {" acceleration" };
886+ set_parameter_and_check_result ();
887+
888+ // state interfaces: empty
889+ state_interface_types_ = {};
890+ set_parameter_and_check_result ();
891+
892+ // state interfaces: cannot not be effort
893+ state_interface_types_ = {" effort" };
894+ set_parameter_and_check_result ();
895+
896+ // state interfaces: bad name
897+ state_interface_types_ = {" bad_name" };
898+ set_parameter_and_check_result ();
899+
900+ // state interfaces: velocity - position not present
901+ state_interface_types_ = {" velocity" };
902+ set_parameter_and_check_result ();
903+ state_interface_types_ = {" velocity" , " acceleration" };
904+ set_parameter_and_check_result ();
905+
906+ // state interfaces: acceleration without position and velocity
907+ state_interface_types_ = {" acceleration" };
908+ set_parameter_and_check_result ();
859909}
0 commit comments