Skip to content

Commit

Permalink
adapt admittance_controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mamueluth committed May 17, 2023
1 parent 167b210 commit b04371a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions admittance_controller/test/test_admittance_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class AdmittanceControllerTest : public ::testing::Test

for (auto i = 0u; i < joint_command_values_.size(); ++i)
{
command_itfs_.emplace_back(hardware_interface::CommandInterface(
command_itfs_.emplace_back(std::make_shared<hardware_interface::CommandInterface>(
joint_names_[i], command_interface_types_[0], &joint_command_values_[i]));
command_ifs.emplace_back(command_itfs_.back());
}
Expand All @@ -216,7 +216,7 @@ class AdmittanceControllerTest : public ::testing::Test

for (auto i = 0u; i < joint_state_values_.size(); ++i)
{
state_itfs_.emplace_back(hardware_interface::StateInterface(
state_itfs_.emplace_back(std::make_shared<hardware_interface::StateInterface>(
joint_names_[i], state_interface_types_[0], &joint_state_values_[i]));
state_ifs.emplace_back(state_itfs_.back());
}
Expand All @@ -226,7 +226,7 @@ class AdmittanceControllerTest : public ::testing::Test

for (auto i = 0u; i < fts_state_names_.size(); ++i)
{
state_itfs_.emplace_back(hardware_interface::StateInterface(
state_itfs_.emplace_back(std::make_shared<hardware_interface::StateInterface>(
ft_sensor_name_, fts_itf_names[i], &fts_state_values_[i]));
state_ifs.emplace_back(state_itfs_.back());
}
Expand Down Expand Up @@ -397,8 +397,8 @@ class AdmittanceControllerTest : public ::testing::Test
std::array<double, 6> fts_state_values_ = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
std::vector<std::string> fts_state_names_;

std::vector<hardware_interface::StateInterface> state_itfs_;
std::vector<hardware_interface::CommandInterface> command_itfs_;
std::vector<std::shared_ptr<hardware_interface::StateInterface>> state_itfs_;
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> command_itfs_;

// Test related parameters
std::unique_ptr<TestableAdmittanceController> controller_;
Expand Down
9 changes: 6 additions & 3 deletions gripper_controllers/test/test_gripper_controllers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ class GripperControllerTest : public ::testing::Test
std::vector<double> joint_states_ = {1.1, 2.1};
std::vector<double> joint_commands_ = {3.1};

StateInterface joint_1_pos_state_{joint_name_, HW_IF_POSITION, &joint_states_[0]};
StateInterface joint_1_vel_state_{joint_name_, HW_IF_VELOCITY, &joint_states_[1]};
CommandInterface joint_1_pos_cmd_{joint_name_, HW_IF_POSITION, &joint_commands_[0]};
std::shared_ptr<StateInterface> joint_1_pos_state_ =
std::make_shared<StateInterface>(joint_name_, HW_IF_POSITION, &joint_states_[0]);
std::shared_ptr<StateInterface> joint_1_vel_state_ =
std::make_shared<StateInterface>(joint_name_, HW_IF_VELOCITY, &joint_states_[1]);
std::shared_ptr<CommandInterface> joint_1_pos_cmd_ =
std::make_shared<CommandInterface>(joint_name_, HW_IF_POSITION, &joint_commands_[0]);
};

#endif // TEST_GRIPPER_CONTROLLERS_HPP_

0 comments on commit b04371a

Please sign in to comment.