-
Notifications
You must be signed in to change notification settings - Fork 0
Added PID parameters (Kp and Kd) to the steering command #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
// DO NOT REMOVE NEXT BLOCK | ||
unsigned char hex_value = | ||
static_cast<unsigned char>((static_cast<char *>(steering_payload_data))[1]); | ||
unsigned char hex_sign = | ||
static_cast<unsigned char>((static_cast<char *>(steering_payload_data))[0]); | ||
// SIGN OF THE ANGLE | ||
assert(hex_sign == 0x00 || hex_sign == 0xff); | ||
// HARD STEERING UPPER LIMIT | ||
assert(hex_sign != 0x00 || hex_value < STEERING_UPPER_LIMIT_HEX_CHAR); | ||
// HARD STEERING LOWER LIMIT | ||
assert(hex_sign != 0xff || hex_value > STEERING_LOWER_LIMIT_HEX_CHAR); | ||
// DO NOT REMOVE PREVIOUS BLOCK | ||
auto *b = static_cast<unsigned char*>(steering_payload_data); | ||
uint16_t raw = (uint16_t(b[0]) << 8) | uint16_t(b[1]); | ||
|
||
// HARD LOWER LIMIT (more negative than -1.2 rad) | ||
assert(raw >= STEERING_RAW_MIN); | ||
|
||
// HARD UPPER LIMIT (more positive than +1.2 rad) | ||
assert(raw <= STEERING_RAW_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be changed
float v_des = 0.0f; | ||
float kp = 20.0f; | ||
float kd = 0.5f; | ||
float torque_ff = 0.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this as parameter
Please review carefully. I had to modify the entire steering command to incorporate the new parameters, which also required changes to the safety function to validate steering angle limits, which is a critical system.