Skip to content

Conversation

@eziCode
Copy link

@eziCode eziCode commented Nov 5, 2025

Description

Updated free kick logic to shoot at position farthest from the goalie

Steps to Test

Test Case 1

  1. Open the simulator
  2. Set up a free kick
  3. Watch ball go in corner instead of straight down the middle

Key Files to Review

Group 1

  • /robocup-software/src/rj_strategy/src/agent/position/free_kicker.cpp

automated style fixes

Co-authored-by: eziCode <eziCode@users.noreply.github.com>
@FarkasJoseph
Copy link

@eziCode May I ask what prompted the move from using dot products / tan calculations and to using cross products? Based on my quick glance the outcome is the same, so I'm just curious if that was a design choice or if there was a specific bug you were targetting.

@eziCode
Copy link
Author

eziCode commented Nov 5, 2025 via email

@FarkasJoseph
Copy link

image

Looks great!

@FarkasJoseph
Copy link

image

wait i found an edge case

@FarkasJoseph
Copy link

looking to add goal post/edge detection into the model. looks like this is missing from offense as well, might add it there if this is a success

@FarkasJoseph
Copy link

i've been told we just don't have the physical feasibility to launch from such tight angles, so it doesn't matter

@FarkasJoseph
Copy link

i'm going to slightly increase our offsets from the goal sides since we are leaving essentially zero tolerance for error

}
}

constexpr double BALL_WIDTH = 0.025;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a measured quantity? wondering if there's a constant that already exists for this

}

constexpr double BALL_WIDTH = 0.025;
constexpr double BALL_WIDTH_OFFSET = BALL_WIDTH * 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

why times 3?

double best_distance = -1.0;
rj_geometry::Point ball_position = this->last_world_state_->ball.position;

int num_samples = 20;
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to do this that doesn't require num_samples? Makes this computation a bit inefficient.

@FarkasJoseph
Copy link

Updates:

Replaced the sampling method with a simple check to shoot at either the left or right corner of the goal. I expanded the padding on the sides of the goal to 10*ball width, which makes straight shots (or really anything +/- 45deg of a straight shot) work quite well. However, it does exceptionally poorly with tight angles (i.e. corner kicks). Sanat recommends we look at passing logic next (if angle too extreme, pass to a partner instead), but that's likely outside the scope of this specific PR.

automated style fixes

Co-authored-by: FarkasJoseph <FarkasJoseph@users.noreply.github.com>
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.

4 participants