Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)


## Project branding, version and package mantainer
Expand Down Expand Up @@ -109,7 +109,7 @@ find_package(VarTypes)
if(NOT VARTYPES_FOUND)
include(ExternalProject)

set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>")
set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>;-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()
Expand Down
2 changes: 1 addition & 1 deletion clients/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

set(CMAKE_AUTOMOC ON)

Expand Down
4 changes: 4 additions & 0 deletions cmake/modules/BuildODE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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=<INSTALL_DIR>
Comment thread
mahi97 marked this conversation as resolved.
STEP_TARGETS install
)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/BuildProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/sslworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class SSLWorld : public QObject
QList<SendingPacket*> 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;
Expand Down
26 changes: 19 additions & 7 deletions src/sslworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,26 +431,38 @@ 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);
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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
Loading