From a59a7b46eedd8a229c63abde04a4d9433e8fa6e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:40:10 +0000 Subject: [PATCH 01/11] Fix ball friction: only apply on ground and only in XY plane Fixes two bugs: - Mismatch 9: Ground friction was applied in all 3 axes (including Z), but ground friction should only act in the XY plane. - Mismatch 10: Ground friction was applied unconditionally even when the ball was airborne. Now checks ball Z position against ground level before applying friction. Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/bd648558-4597-4716-8949-9375cb72d37e Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- src/sslworld.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index 83c76d08..29bb1bfc 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -438,19 +438,28 @@ void SSLWorld::step(dReal dt) { int ballCollisionTry = 5; for (int kk=0;kk < ballCollisionTry;kk++) { const dReal* ballvel = dBodyGetLinearVel(ball->body); + // Check if ball is on the ground before applying ground friction + dReal ballx, bally, ballz; + ball->getBodyPosition(ballx, bally, ballz); + bool ballOnGround = ballz <= cfg->BallRadius() * 1.2; dReal ballspeed = ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1] + ballvel[2]*ballvel[2]; ballspeed = sqrt(ballspeed); - if (ballspeed > 0.01) { + if (ballOnGround && ballspeed > 0.01) { dReal fk = cfg->BallFriction()*cfg->BallMass()*cfg->Gravity(); - dReal ballfx = -fk*ballvel[0] / ballspeed; - dReal ballfy = -fk*ballvel[1] / ballspeed; - dReal ballfz = -fk*ballvel[2] / ballspeed; + // Ground friction acts only in the XY plane + dReal ballxyspeed = sqrt(ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1]); + dReal ballfx = 0; + dReal ballfy = 0; + if (ballxyspeed > 0.01) { + ballfx = -fk*ballvel[0] / ballxyspeed; + ballfy = -fk*ballvel[1] / ballxyspeed; + } dReal balltx = -ballfy*cfg->BallRadius(); dReal ballty = ballfx*cfg->BallRadius(); dReal balltz = 0; dBodyAddTorque(ball->body,balltx,ballty,balltz); - dBodyAddForce(ball->body,ballfx,ballfy,ballfz); - } else { + dBodyAddForce(ball->body,ballfx,ballfy,0); + } else if (ballOnGround && ballspeed <= 0.01) { dBodySetAngularVel(ball->body, 0, 0, 0); dBodySetLinearVel(ball->body, 0, 0, 0); } From 189be4ae54abed053173052edfeb9f1683f8e2e2 Mon Sep 17 00:00:00 2001 From: Mahi Rahimi Date: Fri, 10 Apr 2026 03:57:28 +0900 Subject: [PATCH 02/11] Update src/sslworld.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/sslworld.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index 29bb1bfc..d645325b 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -441,6 +441,8 @@ void SSLWorld::step(dReal dt) { // Check if ball is on the ground before applying ground friction dReal ballx, bally, ballz; ball->getBodyPosition(ballx, bally, ballz); + (void)ballx; + (void)bally; bool ballOnGround = ballz <= cfg->BallRadius() * 1.2; dReal ballspeed = ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1] + ballvel[2]*ballvel[2]; ballspeed = sqrt(ballspeed); From 66002c15ebc6247c36614741decb1cd8d2871a9f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:58:37 +0000 Subject: [PATCH 03/11] Extract ballGroundThreshold constant for BallRadius * 1.2 Replaces duplicated cfg->BallRadius() * 1.2 in the friction ground check and ball replacement positioning with a single named constant defined at the top of SSLWorld::step(). Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/45d9654e-0950-4e11-a136-cc2003d2c4cb Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- src/sslworld.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index d645325b..15c7e10c 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -435,6 +435,7 @@ void SSLWorld::step(dReal dt) { if (customDT > 0) dt = customDT; const auto ratio = m_parent->devicePixelRatio(); g->initScene(m_parent->width()*ratio,m_parent->height()*ratio,0,0.7,1); + const dReal ballGroundThreshold = cfg->BallRadius() * 1.2; int ballCollisionTry = 5; for (int kk=0;kk < ballCollisionTry;kk++) { const dReal* ballvel = dBodyGetLinearVel(ball->body); @@ -443,7 +444,7 @@ void SSLWorld::step(dReal dt) { ball->getBodyPosition(ballx, bally, ballz); (void)ballx; (void)bally; - bool ballOnGround = ballz <= cfg->BallRadius() * 1.2; + bool ballOnGround = ballz <= ballGroundThreshold; dReal ballspeed = ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1] + ballvel[2]*ballvel[2]; ballspeed = sqrt(ballspeed); if (ballOnGround && ballspeed > 0.01) { @@ -679,7 +680,7 @@ void SSLWorld::recvActions() { if (grSimPacket.replacement().ball().has_vx()) vx = grSimPacket.replacement().ball().vx(); if (grSimPacket.replacement().ball().has_vy()) vy = grSimPacket.replacement().ball().vy(); - ball->setBodyPosition(x,y,cfg->BallRadius()*1.2); + ball->setBodyPosition(x,y,ballGroundThreshold); dBodySetLinearVel(ball->body,vx,vy,0); dBodySetAngularVel(ball->body,0,0,0); } From ca3ce9dbee78117da3abfac6ec0339b66653716d Mon Sep 17 00:00:00 2001 From: Mahi Rahimi Date: Fri, 10 Apr 2026 04:17:35 +0900 Subject: [PATCH 04/11] Update src/sslworld.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/sslworld.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index 15c7e10c..6410ab51 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -680,6 +680,7 @@ void SSLWorld::recvActions() { if (grSimPacket.replacement().ball().has_vx()) vx = grSimPacket.replacement().ball().vx(); if (grSimPacket.replacement().ball().has_vy()) vy = grSimPacket.replacement().ball().vy(); + const dReal ballGroundThreshold = cfg->BallRadius() * 1.2; ball->setBodyPosition(x,y,ballGroundThreshold); dBodySetLinearVel(ball->body,vx,vy,0); dBodySetAngularVel(ball->body,0,0,0); From 5c5b9e2bf178ca6b8adc17005eea2db6f4386a94 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:22:37 +0000 Subject: [PATCH 05/11] Fix macOS CI/CD: update cmake_minimum_required and replace deprecated macos-13 runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - clients/qt/CMakeLists.txt: VERSION 2.8 → 3.10 (CMake 4.x removed < 3.5 compat) - CMakeLists.txt: VERSION 3.5 → 3.10 (pre-empt upcoming removal of < 3.10 compat) - build.yaml: replace deprecated macos-13 with macos-15, clean up Homebrew paths Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/63b6bfd3-c1e9-4877-b17a-5491aba569f2 Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- .github/workflows/build.yaml | 10 +--------- CMakeLists.txt | 2 +- clients/qt/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f24c704c..38b23430 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,25 +27,17 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-13, macos-14 ] + os: [ macos-14, macos-15 ] steps: - uses: actions/checkout@v6 - name: "Install dependencies" run: brew tap robotology/formulae && brew install cmake pkg-config qt@5 - name: "Build" run: | - # For macOS 13 - export PATH="/usr/local/opt/qt@5/bin:$PATH" - export LDFLAGS="-L/usr/local/opt/qt@5/lib" - export CPPFLAGS="-I/usr/local/opt/qt@5/include" - export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig" - - # For macOS 14 export PATH="/opt/homebrew/opt/qt@5/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/qt@5/lib" export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig" - make # Windows build does not work currently, see https://github.com/RoboCup-SSL/grSim/issues/183 diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ffc9e6..26eca238 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) ## Project branding, version and package mantainer diff --git a/clients/qt/CMakeLists.txt b/clients/qt/CMakeLists.txt index a543a721..ff1d466e 100644 --- a/clients/qt/CMakeLists.txt +++ b/clients/qt/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) set(CMAKE_AUTOMOC ON) From 20e5c435c5779f35a403a6715a78b7e6b716311b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:36:06 +0000 Subject: [PATCH 06/11] Extract ballGroundThreshold() as private helper method Move the duplicated `cfg->BallRadius() * 1.2` threshold into a single private `SSLWorld::ballGroundThreshold()` const method, used by both step() and recvActions(). Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/ed027e95-34cf-4b51-a993-74ad8ed20436 Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- include/sslworld.h | 1 + src/sslworld.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/sslworld.h b/include/sslworld.h index 60915835..1cdaa72e 100644 --- a/include/sslworld.h +++ b/include/sslworld.h @@ -68,6 +68,7 @@ class SSLWorld : public QObject QList sendQueue; bool lastInfraredState[TEAM_COUNT][MAX_ROBOT_COUNT]{}; KickStatus lastKickState[TEAM_COUNT][MAX_ROBOT_COUNT]{}; + dReal ballGroundThreshold() const; void processSimControl(const SimulatorCommand &simulatorCommand, SimulatorResponse &simulatorResponse); void processRobotControl(const RobotControl &robotControl, RobotControlResponse &robotControlResponse, Team team); void processRobotSpec(const RobotSpecs &robotSpec) const; diff --git a/src/sslworld.cpp b/src/sslworld.cpp index 6410ab51..e2fd058d 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -431,11 +431,14 @@ void SSLWorld::glinit() { p->glinit(); } +dReal SSLWorld::ballGroundThreshold() const { + return cfg->BallRadius() * 1.2; +} + void SSLWorld::step(dReal dt) { if (customDT > 0) dt = customDT; const auto ratio = m_parent->devicePixelRatio(); g->initScene(m_parent->width()*ratio,m_parent->height()*ratio,0,0.7,1); - const dReal ballGroundThreshold = cfg->BallRadius() * 1.2; int ballCollisionTry = 5; for (int kk=0;kk < ballCollisionTry;kk++) { const dReal* ballvel = dBodyGetLinearVel(ball->body); @@ -444,7 +447,7 @@ void SSLWorld::step(dReal dt) { ball->getBodyPosition(ballx, bally, ballz); (void)ballx; (void)bally; - bool ballOnGround = ballz <= ballGroundThreshold; + bool ballOnGround = ballz <= ballGroundThreshold(); dReal ballspeed = ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1] + ballvel[2]*ballvel[2]; ballspeed = sqrt(ballspeed); if (ballOnGround && ballspeed > 0.01) { @@ -680,8 +683,7 @@ void SSLWorld::recvActions() { if (grSimPacket.replacement().ball().has_vx()) vx = grSimPacket.replacement().ball().vx(); if (grSimPacket.replacement().ball().has_vy()) vy = grSimPacket.replacement().ball().vy(); - const dReal ballGroundThreshold = cfg->BallRadius() * 1.2; - ball->setBodyPosition(x,y,ballGroundThreshold); + ball->setBodyPosition(x,y,ballGroundThreshold()); dBodySetLinearVel(ball->body,vx,vy,0); dBodySetAngularVel(ball->body,0,0,0); } From c3e3ab3cef85f9a5570ff7d630c85b291129cb2e Mon Sep 17 00:00:00 2001 From: Mahi Rahimi Date: Fri, 10 Apr 2026 05:04:51 +0900 Subject: [PATCH 07/11] Update .github/workflows/build.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38b23430..da7486b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,6 +38,7 @@ jobs: export LDFLAGS="-L/opt/homebrew/opt/qt@5/lib" export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig" + export CMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5" make # Windows build does not work currently, see https://github.com/RoboCup-SSL/grSim/issues/183 From b4aa75f3481bd86482dcbbf15d023584c1bb58be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:04:57 +0000 Subject: [PATCH 08/11] Add CMAKE_POLICY_VERSION_MINIMUM=3.5 to ExternalProject builds for CMake 4.x compat Protobuf 3.6.1, ODE, and vartypes have old cmake_minimum_required that CMake 4.x (on macOS runners) rejects. Pass CMAKE_POLICY_VERSION_MINIMUM=3.5 to allow these external projects to configure successfully. Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/838d00c6-d230-4382-801b-9e2b0aa8ae78 Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- CMakeLists.txt | 2 +- cmake/modules/BuildODE.cmake | 1 + cmake/modules/BuildProtobuf.cmake | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26eca238..befad900 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ find_package(VarTypes) if(NOT VARTYPES_FOUND) include(ExternalProject) - set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=") + set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=;-DCMAKE_POLICY_VERSION_MINIMUM=3.5") if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") set(VARTYPES_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE};${VARTYPES_CMAKE_ARGS}") endif() diff --git a/cmake/modules/BuildODE.cmake b/cmake/modules/BuildODE.cmake index 41aa54f7..5a5f73a2 100644 --- a/cmake/modules/BuildODE.cmake +++ b/cmake/modules/BuildODE.cmake @@ -11,6 +11,7 @@ ExternalProject_Add(ode_external -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} -DCMAKE_MAKE_PROGRAM:PATH=${CMAKE_MAKE_PROGRAM} + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 # necessary, because it does not build the static libs if this is ON -DBUILD_SHARED_LIBS=OFF # if this is OFF grSim just dies instantly and INSTALL.md says it should be ON diff --git a/cmake/modules/BuildProtobuf.cmake b/cmake/modules/BuildProtobuf.cmake index dcc584b3..ce03b9d5 100644 --- a/cmake/modules/BuildProtobuf.cmake +++ b/cmake/modules/BuildProtobuf.cmake @@ -34,6 +34,7 @@ ExternalProject_Add(protobuf_external -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} -DCMAKE_MAKE_PROGRAM:PATH=${CMAKE_MAKE_PROGRAM} + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 # the tests fail to build :-( -Dprotobuf_BUILD_TESTS:BOOL=OFF STEP_TARGETS install From 6eb1da259818c5b58565cbb927c276a5e41cf30f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:15:15 +0000 Subject: [PATCH 09/11] Disable ODE demo/test builds to fix macOS-15 narrowing errors ODE 0.16.4 demo_cylvssphere.cpp has double-to-float narrowing conversions that fail with the stricter Clang on macOS 15. Since we only need the ODE library (not demos or tests), disable them with ODE_WITH_DEMOS=OFF and ODE_WITH_TESTS=OFF. Agent-Logs-Url: https://github.com/mahi97/grSim/sessions/c1d5edc7-457e-40ea-a2f3-8cf678736c23 Co-authored-by: mahi97 <7570279+mahi97@users.noreply.github.com> --- cmake/modules/BuildODE.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/BuildODE.cmake b/cmake/modules/BuildODE.cmake index 5a5f73a2..25aadfb2 100644 --- a/cmake/modules/BuildODE.cmake +++ b/cmake/modules/BuildODE.cmake @@ -16,6 +16,9 @@ ExternalProject_Add(ode_external -DBUILD_SHARED_LIBS=OFF # if this is OFF grSim just dies instantly and INSTALL.md says it should be ON -DODE_DOUBLE_PRECISION=ON + # demos are not needed and fail to compile on macOS 15+ due to narrowing errors + -DODE_WITH_DEMOS=OFF + -DODE_WITH_TESTS=OFF -DCMAKE_INSTALL_PREFIX= STEP_TARGETS install ) From 8ba78ef760c472d826371610f57926b204b0dac3 Mon Sep 17 00:00:00 2001 From: Mahi Rahimi Date: Tue, 14 Apr 2026 14:49:30 +0900 Subject: [PATCH 10/11] Update src/sslworld.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/sslworld.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index e2fd058d..f4bcdaa3 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -443,10 +443,7 @@ void SSLWorld::step(dReal dt) { for (int kk=0;kk < ballCollisionTry;kk++) { const dReal* ballvel = dBodyGetLinearVel(ball->body); // Check if ball is on the ground before applying ground friction - dReal ballx, bally, ballz; - ball->getBodyPosition(ballx, bally, ballz); - (void)ballx; - (void)bally; + const dReal ballz = dBodyGetPosition(ball->body)[2]; bool ballOnGround = ballz <= ballGroundThreshold(); dReal ballspeed = ballvel[0]*ballvel[0] + ballvel[1]*ballvel[1] + ballvel[2]*ballvel[2]; ballspeed = sqrt(ballspeed); From b00de9bfb44049d6828fd8e67274242b10379925 Mon Sep 17 00:00:00 2001 From: Mahi Rahimi Date: Wed, 15 Apr 2026 17:47:21 +0900 Subject: [PATCH 11/11] Update build.yaml --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index da7486b6..d332af75 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] steps: - uses: actions/checkout@v6 - name: "Update dependencies"