Skip to content

Commit

Permalink
fix the tests of the PID controller
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Jul 12, 2024
1 parent bce6cac commit 0bccb50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions pid_controller/test/test_pid_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class TestablePidController : public pid_controller::PidController
const rclcpp_lifecycle::State & previous_state) override
{
auto ref_itfs = on_export_reference_interfaces();
auto state_itfs = on_export_state_interfaces();
return pid_controller::PidController::on_activate(previous_state);
}

Expand Down
18 changes: 18 additions & 0 deletions pid_controller/test/test_pid_controller_preceding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ TEST_F(PidControllerTest, check_exported_interfaces)
++ri_index;
}
}

// check exported state itfs
auto exported_state_itfs = controller_->export_state_interfaces();
ASSERT_EQ(exported_state_itfs.size(), dof_state_values_.size());
size_t esi_index = 0;
for (const auto & interface : state_interfaces_)
{
for (const auto & dof_name : reference_and_state_dof_names_)
{
const std::string state_itf_name =
std::string(controller_->get_node()->get_name()) + "/" + dof_name + "/" + interface;
EXPECT_EQ(exported_state_itfs[esi_index].get_name(), state_itf_name);
EXPECT_EQ(
exported_state_itfs[esi_index].get_prefix_name(), controller_->get_node()->get_name());
EXPECT_EQ(exported_state_itfs[esi_index].get_interface_name(), dof_name + "/" + interface);
++esi_index;
}
}
}

int main(int argc, char ** argv)
Expand Down

0 comments on commit 0bccb50

Please sign in to comment.