Skip to content

Commit 7e0f62c

Browse files
committed
added comments
1 parent 2f99103 commit 7e0f62c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/steer/src/steer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void steer_init()
6565

6666
static void steer_100Hz()
6767
{
68-
bool calibration_needed = odrive_calibration_needed();
68+
bool calibration_needed = odrive_calibration_needed(); // check if calibration is needed, which is true if any of the error alarms are raised
6969

7070
alarm.odrive_calibration = calibration_needed;
7171

@@ -75,20 +75,20 @@ static void steer_100Hz()
7575
&& CANRX_is_node_ODRIVE_ok()
7676
&& CANRX_get_SUP_steerAuthorized();
7777

78-
if (!steer_authorized) {
78+
if (!steer_authorized) { // if steer is not authorized, set to idle
7979
base_request_state(SYS_STATE_IDLE);
8080

8181
velocity = 0;
8282

8383
if (odrive_state != IDLE) {
8484
odrive_state = IDLE;
85-
CANTX_doTx_STEER_ODriveRequestState();
85+
CANTX_doTx_STEER_ODriveRequestState(); // transmits IDLE state to ODrive
8686
}
8787

88-
return;
88+
return; // exit function
8989
}
90-
91-
base_request_state(SYS_STATE_DBW_ACTIVE);
90+
// if steer is authorized, set to active
91+
base_request_state(SYS_STATE_DBW_ACTIVE); // request DBW active state, DBW is drive by wire so the throttle, brake, and steering are controlled by the computer
9292

9393
// clear errors before calibrating
9494
if (calibration_needed) {
@@ -115,7 +115,7 @@ static void steer_100Hz()
115115

116116
steer_state = READY;
117117
}
118-
118+
// calibrated
119119
float encoder_deg = encoder2deg();
120120

121121
float desired_deg = RAD2DEG(CANRX_get_DBW_steeringAngle());

0 commit comments

Comments
 (0)