Skip to content

Commit 691dea7

Browse files
authored
Auto-set joint state interfaces to zero in MockHardware (#2788) (#2795)
1 parent ce51b1c commit 691dea7

File tree

4 files changed

+84
-86
lines changed

4 files changed

+84
-86
lines changed

hardware_interface/doc/mock_components_userdoc.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ initial_value (optional; double)
108108
<param name="initial_value">3.45</param>
109109
</state_interface>
110110
111-
Note: This parameter is shared with the gazebo and gazebo classic plugins for
111+
If unset, the initial value is set to 0.0 for state interfaces of joints in ``configure`` lifecycle transition.
112+
113+
Note: This parameter is shared with the gz_ros2_control plugins for
112114
joint interfaces. For Mock components it is also possible to set initial
113115
values for gpio or sensor state interfaces.

hardware_interface/include/mock_components/generic_system.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class GenericSystem : public hardware_interface::SystemInterface
4848
hardware_interface::CallbackReturn on_configure(
4949
const rclcpp_lifecycle::State & previous_state) override;
5050

51-
hardware_interface::CallbackReturn on_activate(
52-
const rclcpp_lifecycle::State & previous_state) override;
53-
5451
std::vector<hardware_interface::InterfaceDescription>
5552
export_unlisted_command_interface_descriptions() override;
5653

hardware_interface/src/mock_components/generic_system.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,22 +302,18 @@ return_type GenericSystem::perform_command_mode_switch(
302302

303303
hardware_interface::CallbackReturn GenericSystem::on_configure(
304304
const rclcpp_lifecycle::State & /*previous_state*/)
305-
{
306-
// Set position control mode per default
307-
// This will be populated by perform_command_mode_switch
308-
joint_control_mode_.resize(get_hardware_info().joints.size(), POSITION_INTERFACE_INDEX);
309-
return hardware_interface::CallbackReturn::SUCCESS;
310-
}
311-
312-
hardware_interface::CallbackReturn GenericSystem::on_activate(
313-
const rclcpp_lifecycle::State & /*previous_state*/)
314305
{
315306
for (const auto & joint_state : joint_state_interfaces_)
316307
{
317308
const std::string & name = joint_state.second.get_name();
318-
// initial values are set from the URDF. only apply offset
319309
if (joint_state.second.get_data_type() == hardware_interface::HandleDataType::DOUBLE)
320310
{
311+
// if initial values are set not set from the URDF
312+
if (std::isnan(get_state(name)))
313+
{
314+
set_state(name, 0.0);
315+
}
316+
// set offset anyways
321317
if (
322318
joint_state.second.get_interface_name() == hardware_interface::HW_IF_POSITION &&
323319
custom_interface_with_following_offset_.empty())
@@ -326,6 +322,9 @@ hardware_interface::CallbackReturn GenericSystem::on_activate(
326322
}
327323
}
328324
}
325+
// Set position control mode per default
326+
// This will be populated by perform_command_mode_switch
327+
joint_control_mode_.resize(get_hardware_info().joints.size(), POSITION_INTERFACE_INDEX);
329328
return hardware_interface::CallbackReturn::SUCCESS;
330329
}
331330

hardware_interface/test/mock_components/test_generic_system.cpp

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,11 +1150,11 @@ void generic_system_error_group_test(
11501150
hardware_interface::LoanedCommandInterface j2p_c = rm.claim_command_interface("joint2/position");
11511151
hardware_interface::LoanedCommandInterface j2v_c = rm.claim_command_interface("joint2/velocity");
11521152

1153-
// State interfaces without initial value are set to nan
1153+
// State interfaces without initial value are set to zero
11541154
EXPECT_EQ(3.45, j1p_s.get_optional().value());
1155-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
1155+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
11561156
EXPECT_EQ(2.78, j2p_s.get_optional().value());
1157-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
1157+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
11581158
ASSERT_TRUE(std::isnan(j1p_c.get_optional().value()));
11591159
ASSERT_TRUE(std::isnan(j1v_c.get_optional().value()));
11601160
ASSERT_TRUE(std::isnan(j2p_c.get_optional().value()));
@@ -1168,9 +1168,9 @@ void generic_system_error_group_test(
11681168

11691169
// State values should not be changed
11701170
EXPECT_EQ(3.45, j1p_s.get_optional().value());
1171-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
1171+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
11721172
EXPECT_EQ(2.78, j2p_s.get_optional().value());
1173-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
1173+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
11741174
EXPECT_EQ(0.11, j1p_c.get_optional().value());
11751175
EXPECT_EQ(0.22, j1v_c.get_optional().value());
11761176
EXPECT_EQ(0.33, j2p_c.get_optional().value());
@@ -1179,9 +1179,9 @@ void generic_system_error_group_test(
11791179
// write() does not change values
11801180
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
11811181
EXPECT_EQ(3.45, j1p_s.get_optional().value());
1182-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
1182+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
11831183
EXPECT_EQ(2.78, j2p_s.get_optional().value());
1184-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
1184+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
11851185
EXPECT_EQ(0.11, j1p_c.get_optional().value());
11861186
EXPECT_EQ(0.22, j1v_c.get_optional().value());
11871187
EXPECT_EQ(0.33, j2p_c.get_optional().value());
@@ -1426,10 +1426,10 @@ TEST_F(TestGenericSystem, generic_system_2dof_sensor)
14261426
EXPECT_ANY_THROW(rm.claim_command_interface("tcp_force_sensor/ty"));
14271427

14281428
// State interfaces without initial value are set to nan
1429-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1430-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1431-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1432-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1429+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1430+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1431+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1432+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
14331433
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
14341434
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
14351435
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1442,10 +1442,10 @@ TEST_F(TestGenericSystem, generic_system_2dof_sensor)
14421442
ASSERT_TRUE(j2p_c.set_value(0.33));
14431443

14441444
// State values should not be changed
1445-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1446-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1447-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1448-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1445+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1446+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1447+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1448+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
14491449
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
14501450
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
14511451
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1455,10 +1455,10 @@ TEST_F(TestGenericSystem, generic_system_2dof_sensor)
14551455

14561456
// write() does not change values
14571457
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
1458-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1459-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1460-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1461-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1458+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1459+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1460+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1461+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
14621462
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
14631463
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
14641464
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1469,13 +1469,13 @@ TEST_F(TestGenericSystem, generic_system_2dof_sensor)
14691469
// read() mirrors commands to states
14701470
ASSERT_EQ(rm.read(TIME, PERIOD).result, hardware_interface::return_type::OK);
14711471
ASSERT_EQ(0.11, j1p_s.get_optional().value());
1472-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1472+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
14731473
ASSERT_EQ(0.33, j2p_s.get_optional().value());
1474+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
14741475
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
14751476
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
14761477
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
14771478
EXPECT_TRUE(std::isnan(sty_s.get_optional().value()));
1478-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
14791479
ASSERT_EQ(0.11, j1p_c.get_optional().value());
14801480
ASSERT_EQ(0.33, j2p_c.get_optional().value());
14811481
}
@@ -1529,11 +1529,11 @@ void TestGenericSystem::test_generic_system_with_mock_sensor_commands(
15291529
hardware_interface::LoanedCommandInterface sty_c =
15301530
rm.claim_command_interface("tcp_force_sensor/ty");
15311531

1532-
// State interfaces without initial value are set to nan
1533-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1534-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1535-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1536-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1532+
// State interfaces without initial value are set to nan, except for joint interfaces
1533+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1534+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1535+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1536+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
15371537
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
15381538
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
15391539
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1554,10 +1554,10 @@ void TestGenericSystem::test_generic_system_with_mock_sensor_commands(
15541554
ASSERT_TRUE(sty_c.set_value(4.44));
15551555

15561556
// State values should not be changed
1557-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1558-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1559-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1560-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1557+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1558+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1559+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1560+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
15611561
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
15621562
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
15631563
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1571,10 +1571,10 @@ void TestGenericSystem::test_generic_system_with_mock_sensor_commands(
15711571

15721572
// write() does not change values
15731573
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
1574-
ASSERT_TRUE(std::isnan(j1p_s.get_optional().value()));
1575-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1576-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1577-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1574+
EXPECT_EQ(0.0, j1p_s.get_optional().value());
1575+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1576+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1577+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
15781578
EXPECT_TRUE(std::isnan(sfx_s.get_optional().value()));
15791579
EXPECT_TRUE(std::isnan(sfy_s.get_optional().value()));
15801580
EXPECT_TRUE(std::isnan(stx_s.get_optional().value()));
@@ -1589,9 +1589,9 @@ void TestGenericSystem::test_generic_system_with_mock_sensor_commands(
15891589
// read() mirrors commands to states
15901590
ASSERT_EQ(rm.read(TIME, PERIOD).result, hardware_interface::return_type::OK);
15911591
ASSERT_EQ(0.11, j1p_s.get_optional().value());
1592-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1592+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
15931593
ASSERT_EQ(0.33, j2p_s.get_optional().value());
1594-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1594+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
15951595
ASSERT_EQ(1.11, sfx_s.get_optional().value());
15961596
ASSERT_EQ(2.22, sfy_s.get_optional().value());
15971597
ASSERT_EQ(3.33, stx_s.get_optional().value());
@@ -1647,11 +1647,11 @@ void TestGenericSystem::test_generic_system_with_mimic_joint(
16471647
hardware_interface::LoanedCommandInterface j1p_c = rm.claim_command_interface("joint1/position");
16481648
hardware_interface::LoanedCommandInterface j1v_c = rm.claim_command_interface("joint1/velocity");
16491649

1650-
// State interfaces without initial value are set to nan
1651-
ASSERT_EQ(1.57, j1p_s.get_optional().value());
1652-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1653-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1654-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1650+
// State interfaces without initial value are set to zero
1651+
EXPECT_EQ(1.57, j1p_s.get_optional().value());
1652+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1653+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1654+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
16551655
ASSERT_TRUE(std::isnan(j1p_c.get_optional().value()));
16561656
ASSERT_TRUE(std::isnan(j1v_c.get_optional().value()));
16571657

@@ -1661,18 +1661,18 @@ void TestGenericSystem::test_generic_system_with_mimic_joint(
16611661

16621662
// State values should not be changed
16631663
ASSERT_EQ(1.57, j1p_s.get_optional().value());
1664-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1665-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1666-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1664+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1665+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1666+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
16671667
ASSERT_EQ(0.11, j1p_c.get_optional().value());
16681668
ASSERT_EQ(0.05, j1v_c.get_optional().value());
16691669

16701670
// write() does not change values
16711671
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
16721672
ASSERT_EQ(1.57, j1p_s.get_optional().value());
1673-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
1674-
ASSERT_TRUE(std::isnan(j2p_s.get_optional().value()));
1675-
ASSERT_TRUE(std::isnan(j2v_s.get_optional().value()));
1673+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
1674+
EXPECT_EQ(0.0, j2p_s.get_optional().value());
1675+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
16761676
ASSERT_EQ(0.11, j1p_c.get_optional().value());
16771677
ASSERT_EQ(0.05, j1v_c.get_optional().value());
16781678

@@ -2191,15 +2191,15 @@ TEST_F(TestGenericSystem, simple_dynamics_pos_vel_acc_control_modes_interfaces)
21912191
hardware_interface::LoanedCommandInterface j2a_c =
21922192
rm.claim_command_interface("joint2/acceleration");
21932193

2194-
// State interfaces without initial value are set to nan
2194+
// State interfaces without initial value are set to zero
21952195
double j1p = 3.45;
21962196
double j2p = 2.78;
21972197
EXPECT_EQ(j1p, j1p_s.get_optional().value());
2198-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
2199-
EXPECT_TRUE(std::isnan(j1a_s.get_optional().value()));
2198+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2199+
EXPECT_EQ(0.0, j1a_s.get_optional().value());
22002200
EXPECT_EQ(j2p, j2p_s.get_optional().value());
2201-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
2202-
EXPECT_TRUE(std::isnan(j2a_s.get_optional().value()));
2201+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
2202+
EXPECT_EQ(0.0, j2a_s.get_optional().value());
22032203
ASSERT_TRUE(std::isnan(j1p_c.get_optional().value()));
22042204
ASSERT_TRUE(std::isnan(j1v_c.get_optional().value()));
22052205
ASSERT_TRUE(std::isnan(j1e_c.get_optional().value())); // not used in this test
@@ -2231,11 +2231,11 @@ TEST_F(TestGenericSystem, simple_dynamics_pos_vel_acc_control_modes_interfaces)
22312231

22322232
// State values should not be changed
22332233
EXPECT_EQ(j1p, j1p_s.get_optional().value());
2234-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
2235-
EXPECT_TRUE(std::isnan(j1a_s.get_optional().value()));
2234+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2235+
EXPECT_EQ(0.0, j1a_s.get_optional().value());
22362236
EXPECT_EQ(j2p, j2p_s.get_optional().value());
2237-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
2238-
EXPECT_TRUE(std::isnan(j2a_s.get_optional().value()));
2237+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
2238+
EXPECT_EQ(0.0, j2a_s.get_optional().value());
22392239
ASSERT_EQ(0.11, j1p_c.get_optional().value());
22402240
ASSERT_TRUE(std::isnan(j1v_c.get_optional().value()));
22412241
ASSERT_TRUE(std::isnan(j2v_c.get_optional().value()));
@@ -2244,11 +2244,11 @@ TEST_F(TestGenericSystem, simple_dynamics_pos_vel_acc_control_modes_interfaces)
22442244
// write() does not change values
22452245
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
22462246
EXPECT_EQ(j1p, j1p_s.get_optional().value());
2247-
EXPECT_TRUE(std::isnan(j1v_s.get_optional().value()));
2248-
EXPECT_TRUE(std::isnan(j1a_s.get_optional().value()));
2247+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2248+
EXPECT_EQ(0.0, j1a_s.get_optional().value());
22492249
EXPECT_EQ(j2p, j2p_s.get_optional().value());
2250-
EXPECT_TRUE(std::isnan(j2v_s.get_optional().value()));
2251-
EXPECT_TRUE(std::isnan(j2a_s.get_optional().value()));
2250+
EXPECT_EQ(0.0, j2v_s.get_optional().value());
2251+
EXPECT_EQ(0.0, j2a_s.get_optional().value());
22522252
ASSERT_EQ(0.11, j1p_c.get_optional().value());
22532253
ASSERT_TRUE(std::isnan(j1v_c.get_optional().value()));
22542254
ASSERT_TRUE(std::isnan(j2v_c.get_optional().value()));
@@ -2681,29 +2681,29 @@ TEST_F(TestGenericSystem, disabled_commands_flag_is_active)
26812681
hardware_interface::LoanedStateInterface j1v_s = rm.claim_state_interface("joint1/velocity");
26822682
hardware_interface::LoanedCommandInterface j1p_c = rm.claim_command_interface("joint1/position");
26832683

2684-
ASSERT_EQ(3.45, j1p_s.get_optional().value());
2685-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
2686-
ASSERT_TRUE(std::isnan(j1p_c.get_optional().value()));
2684+
EXPECT_EQ(3.45, j1p_s.get_optional().value());
2685+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2686+
EXPECT_TRUE(std::isnan(j1p_c.get_optional().value()));
26872687

26882688
// set some new values in commands
26892689
ASSERT_TRUE(j1p_c.set_value(0.11));
26902690

26912691
// State values should not be changed
2692-
ASSERT_EQ(3.45, j1p_s.get_optional().value());
2693-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
2694-
ASSERT_EQ(0.11, j1p_c.get_optional().value());
2692+
EXPECT_EQ(3.45, j1p_s.get_optional().value());
2693+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2694+
EXPECT_EQ(0.11, j1p_c.get_optional().value());
26952695

26962696
// write() does not change values
26972697
ASSERT_EQ(rm.write(TIME, PERIOD).result, hardware_interface::return_type::OK);
2698-
ASSERT_EQ(3.45, j1p_s.get_optional().value());
2699-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
2700-
ASSERT_EQ(0.11, j1p_c.get_optional().value());
2698+
EXPECT_EQ(3.45, j1p_s.get_optional().value());
2699+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2700+
EXPECT_EQ(0.11, j1p_c.get_optional().value());
27012701

27022702
// read() also does not change values
27032703
ASSERT_EQ(rm.read(TIME, PERIOD).result, hardware_interface::return_type::OK);
2704-
ASSERT_EQ(3.45, j1p_s.get_optional().value());
2705-
ASSERT_TRUE(std::isnan(j1v_s.get_optional().value()));
2706-
ASSERT_EQ(0.11, j1p_c.get_optional().value());
2704+
EXPECT_EQ(3.45, j1p_s.get_optional().value());
2705+
EXPECT_EQ(0.0, j1v_s.get_optional().value());
2706+
EXPECT_EQ(0.11, j1p_c.get_optional().value());
27072707
}
27082708

27092709
TEST_F(TestGenericSystem, prepare_command_mode_switch_works_with_all_example_tags)

0 commit comments

Comments
 (0)