@@ -813,14 +813,13 @@ TEST(TestComponentInterfaces, dummy_actuator)
813813 EXPECT_EQ (lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE , state.id ());
814814 EXPECT_EQ (hardware_interface::lifecycle_state_names::INACTIVE , state.label ());
815815
816- // Read and Write are working because it is INACTIVE
816+ // Read should work but write should not update the state because it is INACTIVE
817817 for (auto step = 0u ; step < 10 ; ++step)
818818 {
819819 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
820820
821- EXPECT_EQ (
822- step * velocity_value, state_interfaces[0 ]->get_optional ().value ()); // position value
823- EXPECT_EQ (step ? velocity_value : 0 , state_interfaces[1 ]->get_optional ().value ()); // velocity
821+ EXPECT_EQ (0.0 , state_interfaces[0 ]->get_optional ().value ()); // position value
822+ EXPECT_EQ (0.0 , state_interfaces[1 ]->get_optional ().value ()); // velocity
824823
825824 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.write (TIME , PERIOD ));
826825 }
@@ -835,9 +834,10 @@ TEST(TestComponentInterfaces, dummy_actuator)
835834 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
836835
837836 EXPECT_EQ (
838- (10 + step) * velocity_value,
839- state_interfaces[0 ]->get_optional ().value ()); // position value
840- EXPECT_EQ (velocity_value, state_interfaces[1 ]->get_optional ().value ()); // velocity
837+ step * velocity_value,
838+ state_interfaces[0 ]->get_optional ().value ()); // position value
839+ EXPECT_EQ (
840+ step ? velocity_value : 0.0 , state_interfaces[1 ]->get_optional ().value ()); // velocity
841841
842842 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.write (TIME , PERIOD ));
843843 }
@@ -851,7 +851,7 @@ TEST(TestComponentInterfaces, dummy_actuator)
851851 {
852852 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
853853
854- EXPECT_EQ (20 * velocity_value, state_interfaces[0 ]->get_optional ().value ()); // position value
854+ EXPECT_EQ (10 * velocity_value, state_interfaces[0 ]->get_optional ().value ()); // position value
855855 EXPECT_EQ (0 , state_interfaces[1 ]->get_optional ().value ()); // velocity
856856
857857 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.write (TIME , PERIOD ));
@@ -939,17 +939,13 @@ TEST(TestComponentInterfaces, dummy_actuator_default)
939939 EXPECT_EQ (lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE , state.id ());
940940 EXPECT_EQ (hardware_interface::lifecycle_state_names::INACTIVE , state.label ());
941941
942- // Read and Write are working because it is INACTIVE
942+ // Read should work but write should not update the state because it is INACTIVE
943943 for (auto step = 0u ; step < 10 ; ++step)
944944 {
945945 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
946946
947- EXPECT_EQ (
948- step * velocity_value,
949- state_interfaces[si_joint1_pos]->get_optional ().value ()); // position value
950- EXPECT_EQ (
951- step ? velocity_value : 0 ,
952- state_interfaces[si_joint1_vel]->get_optional ().value ()); // velocity
947+ EXPECT_EQ (0.0 , state_interfaces[si_joint1_pos]->get_optional ().value ()); // position value
948+ EXPECT_EQ (0.0 , state_interfaces[si_joint1_vel]->get_optional ().value ()); // velocity
953949
954950 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.write (TIME , PERIOD ));
955951 }
@@ -964,9 +960,11 @@ TEST(TestComponentInterfaces, dummy_actuator_default)
964960 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
965961
966962 EXPECT_EQ (
967- ( 10 + step) * velocity_value,
963+ step * velocity_value,
968964 state_interfaces[si_joint1_pos]->get_optional ().value ()); // position value
969- EXPECT_EQ (velocity_value, state_interfaces[si_joint1_vel]->get_optional ().value ()); // velocity
965+ EXPECT_EQ (
966+ step ? velocity_value : 0.0 ,
967+ state_interfaces[si_joint1_vel]->get_optional ().value ()); // velocity
970968
971969 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.write (TIME , PERIOD ));
972970 }
@@ -981,7 +979,7 @@ TEST(TestComponentInterfaces, dummy_actuator_default)
981979 ASSERT_EQ (hardware_interface::return_type::OK , actuator_hw.read (TIME , PERIOD ));
982980
983981 EXPECT_EQ (
984- 20 * velocity_value,
982+ 10 * velocity_value,
985983 state_interfaces[si_joint1_pos]->get_optional ().value ()); // position value
986984 EXPECT_EQ (0 , state_interfaces[si_joint1_vel]->get_optional ().value ()); // velocity
987985
0 commit comments