Skip to content

Swerve improvements#84

Open
deadlyvortex wants to merge 4 commits into
masterfrom
Swerve-Improvements
Open

Swerve improvements#84
deadlyvortex wants to merge 4 commits into
masterfrom
Swerve-Improvements

Conversation

@deadlyvortex

Copy link
Copy Markdown
Contributor

No description provided.

@danielbrownmsm danielbrownmsm linked an issue Apr 8, 2023 that may be closed by this pull request
@danielbrownmsm

Copy link
Copy Markdown
Collaborator

#84

Comment thread src/main/cpp/subsystems/SwerveDrive.cpp Outdated
Comment on lines +247 to +266
if (left_front_speed > 1) {
right_front_speed = right_front_speed/left_front_speed;
left_back_speed = left_back_speed/left_front_speed;
right_back_speed = right_back_speed/left_front_speed;
}
if (left_back_speed > 1) {
left_front_speed = left_front_speed/left_back_speed;
right_front_speed = right_front_speed/left_back_speed;
right_back_speed = right_back_speed/left_back_speed;
}
if (right_front_speed > 1) {
left_front_speed = left_front_speed/right_front_speed;
left_back_speed = left_back_speed/right_front_speed;
right_back_speed = right_back_speed/right_front_speed;
}
if (right_back_speed > 1) {
left_front_speed = left_front_speed/right_back_speed;
left_back_speed = left_back_speed/right_back_speed;
right_front_speed= right_front_speed/right_back_speed;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to use abs() as the speeds can be negative

Comment on lines +287 to +294
if (abs(drive_) > 0.05 || abs(strafe_) > 0.03 || abs(turn_) > 0.2) {
OKC_CALL(this->left_front_module_->SetAngle(left_front_turn));
OKC_CALL(this->left_back_module_->SetAngle(left_back_turn));
OKC_CALL(this->right_front_module_->SetAngle(right_front_turn));
OKC_CALL(this->right_back_module_->SetAngle(right_back_turn));
}

if (abs(drive_) < 0.05 && abs(strafe_) < 0.05 && abs(turn_) < 0.3) {
if (abs(drive_) < 0.05 && abs(strafe_) < 0.03 && abs(turn_) < 0.2) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Parameterize these

Comment on lines +310 to +316
if (abs(drive_) < 0.05 && abs(strafe_) < 0.03 && abs(turn_) > 0.2) {
this->interface_->left_front_drive_motor_output = turn_ * 2;
this->interface_->left_back_drive_motor_output= turn_ * 2;
this->interface_->right_front_drive_motor_output = turn_ * 2;
this->interface_->right_back_drive_motor_output = turn_ * 2;

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Parameterize these and add a comment about what this check is for

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.

Swerve Drive Improvements

3 participants