Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
TorqueMonitor.h
Go to the documentation of this file.
1#ifndef RENSSELAERMOTORSPORT_TORQUE_MONITOR_H
2#define RENSSELAERMOTORSPORT_TORQUE_MONITOR_H
3
4#include "MonitorSystem.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 {
18 float actualTorque;
19 float desiredTorque;
20 float maxAllowedTorque;
21 TorqueStatus status;
23
24void initTorqueControl(TorqueControl* tc, int hz, float maxTorque);
25void setDesiredTorque(TorqueControl* tc, float torque);
26void setTorque(TorqueControl* tc, float torque);
27void updateTorqueControl(void* tc);
30
31#endif
TorqueStatus
Definition: TorqueControl.h:9
TorqueStatus
Definition: TorqueMonitor.h:9
@ TORQUE_OK
Definition: TorqueMonitor.h:10
@ TORQUE_UNDER_LIMIT
Definition: TorqueMonitor.h:12
@ TORQUE_SENSOR_ERROR
Definition: TorqueMonitor.h:13
@ TORQUE_OVER_LIMIT
Definition: TorqueMonitor.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 setTorque(TorqueControl *tc, float torque)
void sendTorqueCommand(const TorqueControl *tc)
void updateTorqueControl(void *tc)
Updates the Torque Control Actuator based on sensor inputs and calculations.
Definition: TorqueControl.c:43
void initTorqueControl(TorqueControl *tc, int hz, float maxTorque)
Initializes the Torque Control Actuator with initial settings.
Definition: TorqueControl.c:4