Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DiogoProPrayer
Copy link
Contributor

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.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Comment on lines -20 to +29
// 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);
Copy link
Contributor

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

Comment on lines +129 to +132
float v_des = 0.0f;
float kp = 20.0f;
float kd = 0.5f;
float torque_ff = 0.0f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this as parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants