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

Waller steal #2222

Open
wants to merge 8 commits into
base: ros2
Choose a base branch
from
Open

Waller steal #2222

wants to merge 8 commits into from

Conversation

ZachB123
Copy link
Contributor

Description

Wallers will come out to kick the ball towards the opponents goal if the ball is within a certain threshold.

automated style fixes

Co-authored-by: ZachB123 <[email protected]>
@@ -134,7 +134,7 @@ std::optional<RobotIntent> Defense::state_to_task(RobotIntent intent) {
return intent;
} else if (current_state_ == WALLING) {
if (!walling_robots_.empty()) {
Waller waller{waller_id_, (int)walling_robots_.size()};
Waller waller{waller_id_, robot_id_, (int)walling_robots_.size(), walling_robots_};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Waller waller{waller_id_, robot_id_, (int)walling_robots_.size(), walling_robots_};
Waller waller{waller_id_, robot_id_, static_cast<int>(walling_robots_.size()), walling_robots_};

@@ -2,10 +2,12 @@

namespace strategy {

Waller::Waller(int waller_num, int total_wallers) {
Waller::Waller(int waller_num, int robot_id, int total_wallers, std::vector<u_int8_t> waller_ids) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use an initializer-list here instead. also std::move the waller_ids vector

intent.kick_speed = 4.0;
intent.dribbler_speed = 255.0;
intent.is_active = true;
dont_kick = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you do an early return intent; here instead of using the boolean and checking it later?

std::vector<u_int8_t> waller_ids_; // list of wallers

// max distance away the ball can be from a waller for it to jump out and kick it
const float CLEAR_DIST = 0.75;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const float CLEAR_DIST = 0.75;
static constexpr float CLEAR_DIST = 0.75;

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.

None yet

2 participants