diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f24c704c..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" @@ -27,25 +27,18 @@ 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" - + 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ffc9e6..befad900 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 @@ -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/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) diff --git a/cmake/modules/BuildODE.cmake b/cmake/modules/BuildODE.cmake index 41aa54f7..25aadfb2 100644 --- a/cmake/modules/BuildODE.cmake +++ b/cmake/modules/BuildODE.cmake @@ -11,10 +11,14 @@ 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 -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 ) 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 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 83c76d08..f4bcdaa3 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -431,6 +431,10 @@ 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(); @@ -438,19 +442,27 @@ 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 + 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); - 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); } @@ -668,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); }