Skip to content

Update field size for 2026#192

Open
kkimurak wants to merge 5 commits intoRoboCup-SSL:masterfrom
kkimurak:update-field-size-rules103
Open

Update field size for 2026#192
kkimurak wants to merge 5 commits intoRoboCup-SSL:masterfrom
kkimurak:update-field-size-rules103

Conversation

@kkimurak
Copy link
Contributor

Issue or RFC Endorsed by GrSim's Maintainers

Corresponding rule update: RoboCup-SSL/ssl-rules#103

Description of the Change

  • Split variable Field_Margin, making it possible to set both Field_Margin_Goal_Line and Field_Margin_Touch_Line separately.
  • Set DivA_Field_Margin_Goal_line to 0.6m, set the others to 0.3m
  • Replace usage of ConfigWidget::Field_Margin() to corresponding one (ConfigWidget::Field_Margin_Touch_Line() or ConfigWidget::Field_Margin_Goal_Line())
  • Update goal side walls to extend to the outside wall

Alternate Designs

N/A

Possible Drawbacks

On first startup, incorrect value for Field Margin will be loaded from ~/.grsim.xml if exists.

Verification Process

  1. Build
  2. Launch
  3. Check if new configurations "Geometry"->"Field"->"Division A"->"Margin along the touch line" and "Margin behind the goal line" available and set to 0.6 and 0.3 (meters)
  4. Set "Geometry"->"Game"->"Division" to "Division A" and check if the goal side walls extend to outside wall
grsim_d3c37fe5_y-side_goal_mod_rules103_2026-03-22 213104

Release Notes

Change size of field margin behind the goal lines for Div.A and adjust goal side walls to meet the rule change RoboCup-SSL/ssl-rules#103

Corresponding rule update: RoboCup-SSL/ssl-rules#103
- Split variable Field_Margin, making it possible to set both
  `Field_Margin_Goal_Line` and `Field_Margin_Touch_Line` separately.
- Set DivA_Field_Margin_Goal_line to 0.6m,
  set the others to 0.3m
- Replace usage of `ConfigWidget::Field_Margin()` to corresponding one
  (`ConfigWidget::Field_Margin_Touch_Line()`
  or `ConfigWidget::Field_Margin_Goal_Line()`)
-  Update goal side walls to extend to the outside wall
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates grSim’s field geometry configuration to support different margins along the touch lines vs behind the goal lines (per the 2026 rules update), and adjusts camera/wall placement accordingly.

Changes:

  • Split field margin into Field_Margin_Touch_Line and Field_Margin_Goal_Line (Div A goal-line margin defaulted to 0.6m).
  • Update camera positioning and wall placement code paths to use the appropriate margin component.
  • Adjust goal side-wall geometry so side walls extend further toward the outside boundary.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/sslworld.cpp Uses split margins for viewpoint, bounding walls, goal-wall geometry, and geometry packet boundary width.
src/glwidget.cpp Updates camera mode viewpoints to use touch-line vs goal-line margin appropriately.
src/mainwindow.cpp Hooks restart logic to the two new margin variables for Div A and Div B.
src/configwidget.cpp Adds UI/config variables for the two margins in Div A/Div B geometry settings.
include/configwidget.h Replaces the single Field_Margin field accessor with touch-line and goal-line variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to +85
ADD_VALUE(div_a_vars, Double, DivB_Field_Margin_Touch_Line,0.3,"Margin along the touch lines")
ADD_VALUE(div_a_vars, Double, DivB_Field_Margin_Goal_Line,0.3,"Margin behind the goal lines")
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

DivB margin vars are being added to div_a_vars instead of div_b_vars, which will place Division B settings under the Division A tree and likely prevent Division B margin values from being saved/loaded/configured correctly. Add these two ADD_VALUE entries to div_b_vars (like the surrounding DivB field settings).

Suggested change
ADD_VALUE(div_a_vars, Double, DivB_Field_Margin_Touch_Line,0.3,"Margin along the touch lines")
ADD_VALUE(div_a_vars, Double, DivB_Field_Margin_Goal_Line,0.3,"Margin behind the goal lines")
ADD_VALUE(div_b_vars, Double, DivB_Field_Margin_Touch_Line,0.3,"Margin along the touch lines")
ADD_VALUE(div_b_vars, Double, DivB_Field_Margin_Goal_Line,0.3,"Margin behind the goal lines")

Copilot uses AI. Check for mistakes.
field->set_field_length(CONVUNIT(cfg->Field_Length()));
field->set_field_width(CONVUNIT(cfg->Field_Width()));
field->set_boundary_width(CONVUNIT(cfg->Field_Margin()));
field->set_boundary_width(CONVUNIT(cfg->Field_Margin_Touch_Line()));
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

field->set_boundary_width(...) now uses only Field_Margin_Touch_Line(), but the simulation walls use Field_Margin_Goal_Line() for the goal-line side and Field_Margin_Touch_Line() for the touch-line side. This makes the geometry packet inconsistent with the actual simulated boundary on the goal lines (especially for Div A where the margins differ). Consider using a conservative single value (e.g., the max of the two margins) or otherwise documenting/handling that the protocol only supports a single boundary width.

Suggested change
field->set_boundary_width(CONVUNIT(cfg->Field_Margin_Touch_Line()));
// Use a conservative single boundary width based on both touch-line and goal-line margins
double boundary_width = cfg->Field_Margin_Touch_Line();
double goal_line_margin = cfg->Field_Margin_Goal_Line();
if (goal_line_margin > boundary_width) {
boundary_width = goal_line_margin;
}
field->set_boundary_width(CONVUNIT(boundary_width));

Copilot uses AI. Check for mistakes.
src/sslworld.cpp Outdated
Comment on lines +198 to +201
const double gsiz_x = cfg->Field_Margin_Goal_Line();
const double gsiz_y = cfg->Goal_Width();
const double gsiz_z = cfg->Goal_Height();
const double gpos2_x = (cfg->Field_Length() + gsiz_x) / 2.0;

const double gpos2_x = (cfg->Field_Length() + cfg->Field_Margin_Goal_Line() + cfg->Field_Line_Width()) / 2.0;
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

Goal side walls are intended to “extend to the outside wall”, but their X extent/position is based only on Field_Margin_Goal_Line() (+ half line width) and ignores Field_Referee_Margin() and the bounding wall thickness used in the outer wall placement. If Field_Referee_Margin() is non-zero, these goal side walls will no longer reach the outer wall and a gap will appear. Compute the goal side wall length/center from the actual outer wall inner face (derived from pos_x/thick) so the pieces always meet.

Copilot uses AI. Check for mistakes.
@g3force
Copy link
Member

g3force commented Mar 22, 2026

Thx for the contribution :) Very welcome.

Besides the copilot remarks: Can you also update the geometry protobuf message and sent out the separate boundary widths?

and set `cfg->Field_Margin_Goal_Line()` on `generatePacket()`

fef: RoboCup-SSL/ssl-vision#234
Add field value `Field_Goal_Substitution_Area_Width`
- Div.A: 0.3m
- Div.B: 0.0m (non available)

set the value on `generatePacket()`

ref: fef: RoboCup-SSL/ssl-vision#234
@kkimurak
Copy link
Contributor Author

Thank you for review, revised as suggested and updated .proto file referring RoboCup-SSL/ssl-vision#234 .

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.

3 participants