Skip to content

Brakebream availability in gameplay#3462

Merged
zuperzane merged 40 commits into
UBC-Thunderbots:masterfrom
zuperzane:zane/brakebream_availability
Jun 13, 2025
Merged

Brakebream availability in gameplay#3462
zuperzane merged 40 commits into
UBC-Thunderbots:masterfrom
zuperzane:zane/brakebream_availability

Conversation

@zuperzane

@zuperzane zuperzane commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

Please fill out the following before requesting review on this PR

Description

Making it so breakbeam status is accessible from gameplay

Testing Done

Added Tests

Resolved Issues

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

@williamckha williamckha left a comment

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.

I think your approach looks good!

{
Team new_enemy_team = enemy_team_filter.getFilteredData(enemy_team, robot_detections);
Team new_enemy_team = enemy_team_filter.getFilteredData(
enemy_team, robot_detections, friendly_robot_id_with_ball_in_dribbler);

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.

Since we don't know the breakbeam status for the enemy team, I think it makes more sense to pass false here instead of friendly_robot_id_with_ball_in_dribbler

Comment on lines +92 to +99
// find breakbeam_status
bool breakbeam_tripped = false;

if (breakbeam_tripped_id.has_value())
{
breakbeam_tripped = breakbeam_tripped_id.value() == this->getRobotId();
}

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.

I believe this can be simplified to

bool breakbeam_tripped = breakbeam_tripped_id == getRobotId();

since if !breakbeam_tripped_id.has_value(), comparing it with a value will implicitly return false (see #21 here)

@zuperzane zuperzane changed the title Zane/brakebream availability in gameplay Brakebream availability in gameplay Jun 2, 2025
Comment thread src/software/sensor_fusion/filter/robot_filter.h
Comment thread src/software/sensor_fusion/filter/robot_team_filter.h
Comment thread src/software/world/robot.h
Comment thread src/software/world/robot.h Outdated

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you should refactor isNearDribbler as well. You can basically short-circuit the Computation by checking the breakbeam. Otherwise, great work so far! Excited to see this come together.

bool Robot::isNearDribbler(const Point &test_point, double TOLERANCE) const

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@zuperzane

Copy link
Copy Markdown
Contributor Author

@GrayHoang I see, I just changed isNearDribbler to use the breakbeam and that's littered all throughout AI, if u think there's smth still lmk

Comment thread src/software/world/robot.cpp Outdated
if (vector_to_test_point.length() > POSSESSION_THRESHOLD_METERS)
{
return false;
return breakbeam || false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this || false?

zuperzane added 3 commits June 7, 2025 12:56
@zuperzane zuperzane requested a review from Andrewyx June 7, 2025 22:07
Comment on lines +1019 to +1030
Point ball_position_ssl(0.75, 0.75);
Vector velocity(0, 0);
ball_state = BallState{ball_position_ssl, velocity};

yellow_robot_states.clear();
blue_robot_states.clear();

RobotState robot_state(Point(0, 0), Vector(0, 0), Angle::fromRadians(2),
AngularVelocity::zero());
RobotStateWithId robot_id = {2, robot_state};
yellow_robot_states.push_back(robot_id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these variables seem unused

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/software/sensor_fusion/sensor_fusion_test.cpp Outdated
Comment on lines +1072 to +1078
yellow_robot_states.clear();
blue_robot_states.clear();

RobotState robot_state(Point(0, 0), Vector(0, 0), Angle::fromRadians(2),
AngularVelocity::zero());
RobotStateWithId robot_id = {2, robot_state};
yellow_robot_states.push_back(robot_id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems unused?

@zuperzane zuperzane Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe they're used in initDetectionFrame

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yellow_robot_status and blue_robot_states are already initialized in the constructor:

yellow_robot_states(initYellowRobotStates()),

This is already initialized with three robots already. Since other tests might be relying on how the yellow_robot_states and blue_robot_states are initialized in the constructor, I think we should avoid updating it (line 1074-1080) can be deleted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@zuperzane same thing for 1019-1029

Comment thread src/software/sensor_fusion/sensor_fusion_test.cpp Outdated

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good! tiny tiny nits

@zuperzane zuperzane requested a review from itsarune June 9, 2025 02:35

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one more thing!

Comment thread src/software/sensor_fusion/filter/robot_filter.h Outdated
Comment on lines +132 to +133
bool vision_confirm_ball = (ball_to_robot_angle < Angle::fromDegrees(45.0));
return breakbeam || vision_confirm_ball;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this an OR not an AND?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in case vision noise is preventing AI from realizing the ball is in the breakbeam

Andrewyx
Andrewyx previously approved these changes Jun 10, 2025

@Andrewyx Andrewyx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

left some minor comments

Co-authored-by: Andrew Mao <72371419+Andrewyx@users.noreply.github.com>

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one more thing lol

@zuperzane

Copy link
Copy Markdown
Contributor Author

I didnt see that lol my b

@zuperzane zuperzane requested review from Andrewyx and itsarune June 11, 2025 19:42

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks awesome!

@williamckha williamckha left a comment

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.

💯

@zuperzane zuperzane merged commit ef3db1a into UBC-Thunderbots:master Jun 13, 2025
6 checks passed
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.

5 participants