Skip to content

Commit

Permalink
実機用パケットでgrSimを駆動する (#3)
Browse files Browse the repository at this point in the history
* use C++17

* add ibis_robot_packet.hpp

* add ibis_ssl_client.h

* (WIP) connect ibis packet

* adjust dribbler

* format

* succeeded to conncet ibis packet

* comment out unused code

* Add ibis

* set correct robot

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* Delete unnecessary diffs

* update

* ibis_orion.hを追加

* AIコマンドを受け取る部分

* ビルドエラー修正

* orionのパラメータを反映

* 不要なDiffの削除

* Update src/sslworld.cpp

* Apply suggestions from code review

* Update src/sslworld.cpp

* ibis_orion.hを消してファイルまるごとコピーに変更

* windows向けのCIを削除

* mac向けのCIを削除

* よく分からん

* とりあえずAIパケットで動くようになった

* dockerイメージ作るやつを作った

* イメージ名に大文字はだめらしい

* 誤字ってたw

* リングバッファ関連のファイルを追加

* omniOdometryの移植

* 変な動きをするね

* AIパケットで動くことを優先して一旦理想速度指令で動かすようにした
  • Loading branch information
HansRobo authored Jun 4, 2024
1 parent 588c6c2 commit d4b47cc
Show file tree
Hide file tree
Showing 18 changed files with 1,924 additions and 100 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,3 @@ jobs:
run: sudo apt-get install -y build-essential cmake pkg-config qtbase5-dev libqt5opengl5-dev libgl1-mesa-dev libglu1-mesa-dev libprotobuf-dev protobuf-compiler libode-dev libboost-dev
- name: "Build"
run: make

build-macos:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ macos-12, macos-13 ]
steps:
- uses: actions/checkout@v4
- name: "Install dependencies"
run: brew tap robotology/formulae && brew install cmake pkg-config qt@5
- name: "Build"
# for some reason qt5 is not correctly in the path and this will break whenever the location of it changes
# 5.15.11 is for macos-12 and 5.15.12 is for macos-13
run: PATH=/usr/local/Cellar/qt@5/5.15.11/lib/cmake/Qt5:/usr/local/Cellar/qt@5/5.15.12/lib/cmake/Qt5:$PATH && make

# Windows build does not work currently, see https://github.com/RoboCup-SSL/grSim/issues/183
# build-windows:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
#
# - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies
# uses: lukka/run-vcpkg@v11
# with:
# vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
# vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors
#
# - name: Run CMake and run vcpkg to build packages
# uses: lukka/run-cmake@v10
# with:
# # this preset is needed to actually install the vcpkg dependencies
# configurePreset: "ninja-multi-vcpkg"
# configPresetAdditionalArgs: "[-DVCPKG_TARGET_TRIPLET=x64-windows]"
# buildPreset: "ninja-multi-vcpkg"
# buildPresetAdditionalArgs: "['--config Release']"
# env:
# # [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one
# # for the hosting system will be automatically choosen (x64 is the default on all
# # platforms, e.g. `x64-osx`).
# VCPKG_DEFAULT_TRIPLET: "x64-windows"
33 changes: 33 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build and push ibis customized grSim image

on:
push:
branches:
- main
workflow_dispatch:
pull_request:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/ibis-ssl/grsim:customized
103 changes: 48 additions & 55 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ if(UNIX)
endif()

# set explicitly the c++ standard to use
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

# add src dir to included directories
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/include/net)
include_directories(${PROJECT_SOURCE_DIR}/include/physics)
include_directories(${PROJECT_SOURCE_DIR}/include/ibis)


## Handling depenendcies
Expand Down Expand Up @@ -193,6 +194,10 @@ set(SOURCES
src/physics/pray.cpp
src/net/robocup_ssl_server.cpp
src/net/robocup_ssl_client.cpp
src/ibis/util.c
# src/ibis/ring_buffer.c
# src/ibis/robot_control.c
src/net/ibis_ssl_client.cpp
src/sslworld.cpp
src/robot.cpp
src/configwidget.cpp
Expand All @@ -216,6 +221,11 @@ set(HEADERS
include/physics/pray.h
include/net/robocup_ssl_server.h
include/net/robocup_ssl_client.h
include/net/ibis_ssl_client.h
include/ibis/util.h
include/ibis/ring_buffer.h
include/ibis/robot_control.h
include/ibis/management.h
include/sslworld.h
include/robot.h
include/configwidget.h
Expand All @@ -237,75 +247,58 @@ set(srcs
${SOURCES}
)


message(WARNING "Sources: ${srcs}")

file(GLOB CONFIG_FILES "config/*.ini")
set_source_files_properties(${CONFIG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "config")

target_sources(${app} PRIVATE ${srcs})
install(TARGETS ${app} DESTINATION bin)
target_link_libraries(${app} ${libs})

if(APPLE AND CMAKE_MACOSX_BUNDLE)
# use CMAKE_MACOSX_BUNDLE if you want to build a mac bundle
set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/resources/icons/grsim.icns")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${VERSION})
set(MACOSX_BUNDLE_VERSION ${VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${VERSION}")
set(BUNDLE_APP ${PROJECT_SOURCE_DIR}/bin/${app}.app)
install(
CODE "
include(BundleUtilities)
fixup_bundle(\"${BUNDLE_APP}\" \"\" \"/opt/local/lib;/usr/local/lib\")"
COMPONENT Runtime)
set(CPACK_GENERATOR "DragNDrop" "TGZ")
elseif(WIN32 AND CMAKE_WIN32_EXECUTABLE)
# use CMAKE_WIN32_EXECUTABLE if you want to build a windows exe
install(DIRECTORY config DESTINATION .)
install(DIRECTORY bin DESTINATION .
FILES_MATCHING PATTERN "*.dll")
set(CPACK_PACKAGE_EXECUTABLES ${app} ${app})
else()
install(DIRECTORY config DESTINATION share/${app})
install(FILES resources/grsim.desktop DESTINATION share/applications)
install(FILES resources/icons/grsim.svg DESTINATION share/icons/hicolor/scalable/apps)
endif()
install(DIRECTORY config DESTINATION share/${app})
install(FILES resources/grsim.desktop DESTINATION share/applications)
install(FILES resources/icons/grsim.svg DESTINATION share/icons/hicolor/scalable/apps)


option(BUILD_CLIENTS "Choose this option if you want to build the example Qt client." ON)
if(BUILD_CLIENTS)
add_subdirectory(clients/qt)
# add_subdirectory(clients/qt)
endif()

file(COPY README.md LICENSE.md DESTINATION ${CMAKE_BINARY_DIR})
file(RENAME ${CMAKE_BINARY_DIR}/README.md ${CMAKE_BINARY_DIR}/README.txt)
file(RENAME ${CMAKE_BINARY_DIR}/LICENSE.md ${CMAKE_BINARY_DIR}/LICENSE.txt)

## Packaging
if(UNIX)
execute_process(COMMAND uname -p OUTPUT_VARIABLE ARCH)
string(STRIP ${ARCH} ARCH)
if(APPLE)
set(ARCH "osx-universal")
endif()
elseif(WIN32)
set(ARCH "win32")
set(CPACK_GENERATOR ZIP NSIS)
endif()
set(CPACK_OUTPUT_FILE_PREFIX ${PROJECT_SOURCE_DIR}/dist)
set(CPACK_PACKAGE_CONTACT ${MAINTAINER})
if(VENDOR)
set(CPACK_PACKAGE_VENDOR ${VENDOR})
string(TOLOWER ${CPACK_PACKAGE_VENDOR} FLAVOR)
endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README.txt")
#set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/WELCOME.txt")
set(CPACK_PACKAGE_VERSION ${VERSION})
# Debian based specific
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libode1 (>=0.11), vartypes (>=0.7.0)")
if(FLAVOR)
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}-${FLAVOR}_${ARCH}")
else()
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${ARCH}")
endif()
include(CPack)
### Packaging
#if(UNIX)
# execute_process(COMMAND uname -p OUTPUT_VARIABLE ARCH)
# string(STRIP ${ARCH} ARCH)
# if(APPLE)
# set(ARCH "osx-universal")
# endif()
#elseif(WIN32)
# set(ARCH "win32")
# set(CPACK_GENERATOR ZIP NSIS)
#endif()
#set(CPACK_OUTPUT_FILE_PREFIX ${PROJECT_SOURCE_DIR}/dist)
#set(CPACK_PACKAGE_CONTACT ${MAINTAINER})
#if(VENDOR)
# set(CPACK_PACKAGE_VENDOR ${VENDOR})
# string(TOLOWER ${CPACK_PACKAGE_VENDOR} FLAVOR)
#endif()
#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.txt")
#set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README.txt")
##set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/WELCOME.txt")
#set(CPACK_PACKAGE_VERSION ${VERSION})
## Debian based specific
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libode1 (>=0.11), vartypes (>=0.7.0)")
#if(FLAVOR)
# set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}-${FLAVOR}_${ARCH}")
#else()
# set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${ARCH}")
#endif()
#include(CPack)


35 changes: 35 additions & 0 deletions config/ibis.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[Geometery]
CenterFromKicker= 0.073
Radius = 0.089
Height = 0.090
RobotBottomZValue = 0.02
KickerZValue = 0.005
KickerThickness = 0.005
KickerWidth = 0.08
KickerHeight = 0.04
WheelRadius = 0.027
WheelThickness = 0.005
Wheel1Angle = 60
Wheel2Angle = 135
Wheel3Angle = 225
Wheel4Angle = 300
[Physics]
Bodymass = 2
Wheelmass = 0.2
Kickermass =0.02
KickerDampFactor = 0.2
RollerTorqueFactor = 0.06
RollerPerpendicularTorqueFactor = 0.005
KickerFriction = 0.8
WheelTangentFriction = 0.8
WheelPerpendicularFriction = 0.05
WheelMotorMaximumApplyingTorque= 0.2

MaxLinearKickSpeed=10
MaxChipKickSpeed=10
AccSpeedupAbsoluteMax=4
AccSpeedupAngularMax=50
AccBrakeAbsoluteMax=4
AccBrakeAngularMax=50
VelAbsoluteMax=5
VelAngularMax=20
Loading

0 comments on commit d4b47cc

Please sign in to comment.