MCPcopy Create free account
hub / github.com/PolySync/oscc / process_steering_command

Function process_steering_command

firmware/steering/src/communications.cpp:110–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109
110static void process_steering_command(
111 const uint8_t * const data )
112{
113 if ( data != NULL )
114 {
115 const oscc_steering_command_s * const steering_command =
116 (oscc_steering_command_s *) data;
117
118 const float clamped_torque = CONSTRAIN(
119 steering_command->torque_command * MAXIMUM_TORQUE_COMMAND,
120 MINIMUM_TORQUE_COMMAND,
121 MAXIMUM_TORQUE_COMMAND);
122
123 float spoof_voltage_low =
124 STEERING_TORQUE_TO_VOLTS_LOW( clamped_torque );
125
126 spoof_voltage_low = CONSTRAIN(
127 spoof_voltage_low,
128 STEERING_SPOOF_LOW_SIGNAL_VOLTAGE_MIN,
129 STEERING_SPOOF_LOW_SIGNAL_VOLTAGE_MAX);
130
131 float spoof_voltage_high =
132 STEERING_TORQUE_TO_VOLTS_HIGH( clamped_torque );
133
134 spoof_voltage_high = CONSTRAIN(
135 spoof_voltage_high,
136 STEERING_SPOOF_HIGH_SIGNAL_VOLTAGE_MIN,
137 STEERING_SPOOF_HIGH_SIGNAL_VOLTAGE_MAX);
138
139 const uint16_t spoof_value_low = STEPS_PER_VOLT * spoof_voltage_low;
140 const uint16_t spoof_value_high = STEPS_PER_VOLT * spoof_voltage_high;
141
142 update_steering( spoof_value_high, spoof_value_low );
143 }
144}
145
146
147static void process_fault_report(

Callers 1

process_rx_frameFunction · 0.85

Calls 1

update_steeringFunction · 0.85

Tested by

no test coverage detected