Skip to content

Commit

Permalink
modify steering gains over CAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jcirce committed Jun 2, 2024
1 parent c54d886 commit 8a41e95
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions can/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ nodes:
from_template: PIDGains
id: 0x778

- SetSTEERGains:
from_template: PIDGains
id: 0x779

- SteeringCommand:
id: 0x21
cycletime: 10
Expand Down Expand Up @@ -490,6 +494,7 @@ nodes:
- STEER:
rx:
- DBW_ESTOP
- DBW_SetSTEERGains
- DBW_SteeringCommand
- ODRIVE_Status
- SUP_Authorization
Expand Down Expand Up @@ -608,6 +613,12 @@ nodes:
- READY
- CALIBRATING
- NEEDS_CALIBRATION

- SteeringGains:
from_template: PIDGains
id: 0x251
cycletime: 10

- STEERBL:
rx:
- UPD_IsoTpTx_STEER
Expand Down
19 changes: 19 additions & 0 deletions components/steer/src/steer.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,25 @@ static bool odrive_calibration_needed(void)
return calibration_needed;
}

void CANRX_onRxCallback_DBW_SetSTEERGains(
const struct CAN_TMessageRaw_PIDGains * const raw,
const struct CAN_TMessage_PIDGains * const dec)
{
(void) raw;

pid.kp = dec->gainKp;
pid.ki = dec->gainKi;
pid.kd = dec->gainKd;
}

void CANTX_populateTemplate_SteeringGains(
struct CAN_TMessage_PIDGains * const m)
{
m->gainKp = pid.kp;
m->gainKi = pid.ki;
m->gainKd = pid.kd;
}

void CANTX_populate_STEER_Alarms(struct CAN_Message_STEER_Alarms * const m)
{
m->STEER_alarmsRaised = alarm.odrive_calibration;
Expand Down

0 comments on commit 8a41e95

Please sign in to comment.