Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Macros | Functions
TorqueControlActuatorTest.c File Reference
#include "../Inc/Systems/Controller/TorqueControl.h"
#include "test.h"
Include dependency graph for TorqueControlActuatorTest.c:

Go to the source code of this file.

Macros

#define MAX_TORQUE   100
 
#define TORQUE_DO(torque, desired)
 

Functions

void torque_control_main ()
 

Macro Definition Documentation

◆ MAX_TORQUE

#define MAX_TORQUE   100

Definition at line 4 of file TorqueControlActuatorTest.c.

◆ TORQUE_DO

#define TORQUE_DO (   torque,
  desired 
)
Value:
initTorqueControl(&tc, 0, MAX_TORQUE); \
setActualTorque(&tc, torque); \
setDesiredTorque(&tc, desired); \
updateTorqueControl(&tc); \
#define MAX_TORQUE
TorqueStatus
Definition: TorqueControl.h:9
TorqueStatus checkTorqueLimits(TorqueControl *tc)
Checks if the actual torque is within the defined limits and desired range.
Definition: TorqueControl.c:58

Definition at line 6 of file TorqueControlActuatorTest.c.

Function Documentation

◆ torque_control_main()

void torque_control_main ( )

Definition at line 14 of file TorqueControlActuatorTest.c.

14 {
15 TEST(torque_init, {
17 initTorqueControl(&tc, 0, 100);
18 ASSERT(tc.status == TORQUE_OK, "status is expected", "status is not expected");
19 })
20
21 TEST(update_normal, {
22 TORQUE_DO(75, 75)
23 ASSERT(tc.status == TORQUE_OK, "status is expected", "status is not expected");
24 })
25
26 TEST(update_below_desired, {
27 TORQUE_DO(93.5, 95)
28 ASSERT(tc.status == TORQUE_OK, "status is expected", "status is not expected");
29 })
30
31 TEST(update_above_desired, {
32 TORQUE_DO(98.5, 95)
33 ASSERT(tc.status == TORQUE_OK, "status is expected", "status is not expected");
34 })
35
36 TEST(update_over_limit, {
37 TORQUE_DO(101, 95)
38 ASSERT(tc.status == TORQUE_OVER_LIMIT, "status is expected", "status is not expected");
39 })
40
41 TEST(update_negative_torque, {
42 TORQUE_DO(-10, 95)
43 ASSERT(tc.status == TORQUE_UNDER_LIMIT, "status is expected", "status is not expected");
44 })
45
46 TEST(update_sensor_error, {
47 TORQUE_DO(10, 80)
48 ASSERT(tc.status == TORQUE_SENSOR_ERROR, "status is expected", "status is not expected");
49 })
50}
#define TORQUE_DO(torque, desired)
@ TORQUE_OK
Definition: TorqueControl.h:10
@ TORQUE_UNDER_LIMIT
Definition: TorqueControl.h:12
@ TORQUE_SENSOR_ERROR
Definition: TorqueControl.h:13
@ TORQUE_OVER_LIMIT
Definition: TorqueControl.h:11
void initTorqueControl(TorqueControl *tc, int hz, float maxTorque)
Initializes the Torque Control Actuator with initial settings.
Definition: TorqueControl.c:4
TorqueStatus status
Definition: TorqueControl.h:21
#define TEST(NAME, BODY)
Definition: test.h:19
#define ASSERT(BOOL, OK, ERR)
Definition: test.h:27
Here is the call graph for this function: