Skip to content
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

[Feat!!!]: add the whole hero code #64

Merged
merged 17 commits into from
Apr 6, 2024
Merged

[Feat!!!]: add the whole hero code #64

merged 17 commits into from
Apr 6, 2024

Conversation

N9nGe
Copy link
Collaborator

@N9nGe N9nGe commented Sep 9, 2023

Implement the whole hero code.

Copy link
Collaborator

@ywh114 ywh114 left a comment

Choose a reason for hiding this comment

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

weak is misspelled as week, since this changeset is very large it should just be fixed here instead of in some refactor.

examples/hero/hero_shooter_2023.cc Outdated Show resolved Hide resolved
examples/hero/hero_shooter_2023.cc Outdated Show resolved Hide resolved
Comment on lines +287 to +295
// pitch data from keyboard
if (dbus->keyboard.bit.E) pitch_keyboard -= PI; // offset need test
if (dbus->keyboard.bit.Q) pitch_keyboard += PI; // offset need test
if (-0.55 * PI <= pitch_keyboard && pitch_keyboard <= 0.55 * PI) pitch_keyboard = 0;
if (pitch_keyboard > 0)
pitch_keyboard -= 0.85 * PI;
if (pitch_keyboard < 0)
pitch_keyboard += 0.85 * PI;
pitch_keyboard = clip<float>(pitch_keyboard, -30 * PI, 30 * PI);

Choose a reason for hiding this comment

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

Instead of using all the if conditions. What if we just increase pitch_keyboard 1.5pi when Q is pressed, and decrease 1.5 pi when E is pressed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this situation, pitch_keyboard is like a discrete angular velocity, rather than angle. Therefore, we want this velocity decrease to 0 when we do not press the keyboard.

control::Motor4310::TransmitOutput(motor_can1_gimbal, 1);
} else {
chassis->SetSpeed(0, 0, 0);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what elevation does, better explain more and the numbers in it with comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

elevation is for the gimbal. when elevation, the mouse is used to control the shooter rather than chassis.

// 5. reload motor release to the original position to prepare for the next load

// Load Detector
LoadDetect.input(dbus->swr == remote::UP || dbus->mouse.l);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why called "LoadDetect" should it not be "Trigger detect“?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just detect the load signal.

@N9nGe N9nGe requested a review from ywh114 April 6, 2024 21:06
Copy link
Collaborator

@ywh114 ywh114 left a comment

Choose a reason for hiding this comment

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

lgtm

@N9nGe N9nGe merged commit d70528d into main Apr 6, 2024
1 check passed
@N9nGe N9nGe deleted the ngao4/Hero branch April 6, 2024 21:08
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.

6 participants