Skip to content

Commit

Permalink
updated working rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Comerm28 committed Sep 21, 2024
1 parent ad8c202 commit 11ed4ea
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions test/test_systems/tc_mux_v2_testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ TEST(TorqueControllerMuxTesting, test_construction_with_new_controller_orgs)
// mode 1
TorqueControllerLoadCellVectoring tc_vec;
// mode 2
dummy_queue q;
CASESystem<dummy_queue> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<dummy_queue> case_wrapper(&case_sys);
DummyQueue_s q;
CASESystem<DummyQueue_s> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<DummyQueue_s> case_wrapper(&case_sys);

// mode 3
TorqueControllerSimpleLaunch simple_launch;
Expand Down Expand Up @@ -129,7 +129,7 @@ TEST(TorqueControllerMuxTesting, test_controller_output_swap_logic)
// auto out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_0, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_1, TorqueLimit_e::TCMUX_FULL_TORQUE, state);

ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::ERROR_SPEED_DIFF_TOO_HIGH);

set_outputs(inst1, 0, 1);
Expand All @@ -138,7 +138,7 @@ TEST(TorqueControllerMuxTesting, test_controller_output_swap_logic)

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_1, TorqueLimit_e::TCMUX_FULL_TORQUE, state);

ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_1);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_1);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
}
TEST(TorqueControllerMuxTesting, simple_switch_many_active_modes)
Expand All @@ -156,27 +156,27 @@ TEST(TorqueControllerMuxTesting, simple_switch_many_active_modes)
state.vn_data = {};

auto out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_0, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_1, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_1);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_1);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_2, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_2);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_2);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_3, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_3);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_3);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_2, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_2);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_2);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);

out1 = test.getDrivetrainCommand(ControllerMode_e::MODE_0, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
}

Expand Down Expand Up @@ -219,7 +219,7 @@ TEST(TorqueControllerMuxTesting, test_torque_diff_swap_limit)

ASSERT_EQ(test.get_tc_mux_status().current_error, TorqueControllerMuxError::ERROR_TORQUE_DIFF_TOO_HIGH);

ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);

ASSERT_EQ(out1.torqueSetpoints[0], 1);
ASSERT_EQ(out1.torqueSetpoints[1], 1);
Expand Down Expand Up @@ -251,9 +251,9 @@ TEST(TorqueControllerMuxTesting, test_mode0_evaluation)
// mode 1
TorqueControllerLoadCellVectoring tc_vec;
// mode 2
dummy_queue q;
CASESystem<dummy_queue> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<dummy_queue> case_wrapper(&case_sys);
DummyQueue_s q;
CASESystem<DummyQueue_s> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<DummyQueue_s> case_wrapper(&case_sys);

// mode 3
TorqueControllerSimpleLaunch simple_launch;
Expand Down Expand Up @@ -374,7 +374,7 @@ TEST(TorqueControllerMuxTesting, test_tc_mux_status)

auto out1 = test.getDrivetrainCommand(testMode, testTorqLim, state);
ASSERT_EQ(test.get_tc_mux_status().current_error, testErr);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode_, testMode);
ASSERT_EQ(test.get_tc_mux_status().current_controller_mode, testMode);
ASSERT_EQ(test.get_tc_mux_status().current_torque_limit_enum, testTorqLim);
}
TEST(TorqueControllerMuxTesting, test_real_controllers_output)
Expand All @@ -384,9 +384,9 @@ TEST(TorqueControllerMuxTesting, test_real_controllers_output)
// mode 1
TorqueControllerLoadCellVectoring tc_vec;
// mode 2
dummy_queue q;
CASESystem<dummy_queue> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<dummy_queue> case_wrapper(&case_sys);
DummyQueue_s q;
CASESystem<DummyQueue_s> case_sys(&q, 100, 70, 550, {});
TorqueControllerCASEWrapper<DummyQueue_s> case_wrapper(&case_sys);

// mode 3
TorqueControllerSimpleLaunch simple_launch;
Expand All @@ -407,39 +407,39 @@ TEST(TorqueControllerMuxTesting, test_real_controllers_output)

auto out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_0, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_1, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_1);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_1);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_2, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_2);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_2);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_3, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(static_cast<int>(torque_controller_mux.get_tc_mux_status().current_error), static_cast<int>(TorqueControllerMuxError::NO_ERROR));
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_3);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_3);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_4, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_4);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_4);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_4, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_4);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_4);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_3, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_3);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_3);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_2, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_2);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_2);

out1 = torque_controller_mux.getDrivetrainCommand(ControllerMode_e::MODE_0, TorqueLimit_e::TCMUX_FULL_TORQUE, state);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_error, TorqueControllerMuxError::NO_ERROR);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode_, ControllerMode_e::MODE_0);
ASSERT_EQ(torque_controller_mux.get_tc_mux_status().current_controller_mode, ControllerMode_e::MODE_0);
}

#endif // __TC_MUX_V2_TESTING_H__

0 comments on commit 11ed4ea

Please sign in to comment.