Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
TorqueControl.h
Go to the documentation of this file.
1#ifndef RENSSELAERMOTORSPORT_TORQUE_CONTROL_H
2#define RENSSELAERMOTORSPORT_TORQUE_CONTROL_H
3
4#include "../ControllerSystem.h"
5
6#define TORQUE_ERROR_MARGIN 0.05 // TODO: Determine correct value for the margin, or change to lookup table if needed.
7
8// TODO: Move to torque police in the future
9typedef enum {
15
16typedef struct {
23
24
32void initTorqueControl(TorqueControl* tc, int hz, float maxTorque);
33
41void setDesiredTorque(TorqueControl* tc, float torque);
42
43/*
44 * @brief Sets the actual torque for Torque Control Actuator
45 * For testing and debugging.
46 *
47 * @param tc A pointer to the TorqueControl structure.
48 * @param torque The torque to be set (in Nm).
49 */
50void setActualTorque(TorqueControl* tc, float torque);
51
57void updateTorqueControl(void* tc);
58
59
70
71// TODO: Add doc / add function in if applicable
73
79int torqueSafetyCheck(void* tc);
80
81#endif // RENSSELAERMOTORSPORT_TORQUE_CONTROL_H
TorqueStatus
Definition: TorqueControl.h:9
@ 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
TorqueStatus checkTorqueLimits(TorqueControl *tc)
Checks if the actual torque is within the defined limits and desired range.
Definition: TorqueControl.c:58
void setDesiredTorque(TorqueControl *tc, float torque)
Sets the desired torque for the Torque Control Actuator.
Definition: TorqueControl.c:27
void sendTorqueCommand(const TorqueControl *tc)
void setActualTorque(TorqueControl *tc, float torque)
Definition: TorqueControl.c:39
void updateTorqueControl(void *tc)
Updates the Torque Control Actuator based on sensor inputs and calculations.
Definition: TorqueControl.c:43
int torqueSafetyCheck(void *tc)
Checks the safety of the torque with multiple monitors.
Definition: TorqueControl.c:76
void initTorqueControl(TorqueControl *tc, int hz, float maxTorque)
Initializes the Torque Control Actuator with initial settings.
Definition: TorqueControl.c:4
TorqueStatus
Definition: TorqueMonitor.h:9
ControllerSystem base
Definition: TorqueControl.h:17
float maxAllowedTorque
Definition: TorqueControl.h:20
float actualTorque
Definition: TorqueControl.h:18
TorqueStatus status
Definition: TorqueControl.h:21
float desiredTorque
Definition: TorqueControl.h:19