-
Notifications
You must be signed in to change notification settings - Fork 1
Dev #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Dev #15
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f5e7414
功率控制加上速度误差
d9346a1
RLS改为Eigen
Rui-Xiaoyu b67c369
Merge pull request #12 from Rui-Xiaoyu/dev
llLeo306 d07469c
RLS改为Eigen
Rui-Xiaoyu e96176e
统一接口
Rui-Xiaoyu 827f2c2
更新构建工作流,调整容器镜像,添加模块生成和构建步骤
llLeo306 664e8ca
修正构造函数参数中的拼写错误,将'super_power'更改为'superpower'
llLeo306 9080a7d
Merge pull request #14 from Rui-Xiaoyu:dev
llLeo306 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,93 +1,142 @@ | ||
| name: XRobot Module Build Test | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| schedule: | ||
| - cron: '0 3 1 * *' # 每月1日凌晨3点(UTC)自动触发 | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ghcr.io/xrobot-org/docker-image-stm32:main | ||
| options: --user 0 | ||
|
|
||
| env: | ||
| XR_MODULE_NAME: ${{ github.event.repository.name }} | ||
|
|
||
| steps: | ||
| - name: install pip packages | ||
| run: pip install libxr xrobot | ||
|
|
||
| - name: Checkout bsp-dev-c | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/bsp-dev-c | ||
| path: bsp-dev-c | ||
|
|
||
| - name: config libxr | ||
| run: cd bsp-dev-c && xr_cubemx_cfg -d ./ --xrobot | ||
|
|
||
| - name: Checkout current module repo to bsp-dev-c/Modules/${{ env.XR_MODULE_NAME }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: bsp-dev-c/Modules/${{ env.XR_MODULE_NAME }} | ||
|
|
||
| - name: Checkout SuperPower module | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/SuperPower | ||
| path: bsp-dev-c/Modules/SuperPower | ||
|
|
||
| - name: Checkout Matrix module | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/Matrix | ||
| path: bsp-dev-c/Modules/Matrix | ||
|
|
||
| - name: Add modules | ||
| run: | | ||
| cd bsp-dev-c | ||
| rm -rf ./User/xrobot.yaml | ||
| xrobot_add_mod SuperPower --instance-id super_power | ||
| xrobot_add_mod PowerControl --instance-id power_control | ||
| cat ./User/xrobot.yaml | ||
|
|
||
| - name: xrobot generate code | ||
| run: cd bsp-dev-c && xrobot_gen_main && cat ./User/xrobot_main.hpp | ||
|
|
||
|
|
||
| - name: config cmake | ||
| run: cd bsp-dev-c && export GCC_TOOLCHAIN_ROOT=/opt/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi/bin && export CLANG_GCC_CMSIS_COMPILER=/opt/st-arm-clang && cmake . -DCMAKE_TOOLCHAIN_FILE:STRING=cmake/starm-clang.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Bbuild -G Ninja | ||
| - name: build | ||
| run: cd bsp-dev-c && cmake --build build | ||
|
|
||
| - name: Create Tag via GitHub API | ||
| if: ${{ success() && github.event_name != 'pull_request' }} | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const moduleTag = process.env.XR_MODULE_NAME; | ||
| const date = new Date(); | ||
| const yyyy = date.getUTCFullYear(); | ||
| const mm = String(date.getUTCMonth() + 1).padStart(2, '0'); | ||
| const dd = String(date.getUTCDate()).padStart(2, '0'); | ||
| const HH = String(date.getUTCHours()).padStart(2, '0'); | ||
| const MM = String(date.getUTCMinutes()).padStart(2, '0'); | ||
| const SS = String(date.getUTCSeconds()).padStart(2, '0'); | ||
| const tagName = `${moduleTag}-${yyyy}${mm}${dd}-${HH}${MM}${SS}`; | ||
|
|
||
| // 获取当前 commit sha | ||
| const sha = process.env.GITHUB_SHA; | ||
|
|
||
| // 创建 tag reference | ||
| await github.rest.git.createRef({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| ref: `refs/tags/${tagName}`, | ||
| sha: sha | ||
| }); | ||
| console.log(`Created tag: ${tagName} on sha: ${sha}`); | ||
|
|
||
| name: XRobot Module Build Test | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| schedule: | ||
| - cron: '0 3 1 * *' # 每月1日凌晨3点(UTC)自动触发 | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ghcr.io/xrobot-org/docker-image-linux:main | ||
| options: --user 0 | ||
|
|
||
| env: | ||
| XR_MODULE_NAME: ${{ github.event.repository.name }} | ||
|
|
||
| steps: | ||
| - name: Checkout current module repo to ./Modules/${{ env.XR_MODULE_NAME }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: Modules/${{ env.XR_MODULE_NAME }} | ||
|
|
||
| - name: Create main.cpp | ||
| run: | | ||
| cat > main.cpp <<'EOF' | ||
| #include <iostream> | ||
| #include "xrobot_main.hpp" | ||
| #include "libxr.hpp" | ||
|
|
||
| int main() { | ||
| LibXR::PlatformInit(); | ||
| LibXR::STDIO::Printf("This is XRobot Module Template Test\n"); | ||
| LibXR::HardwareContainer hw; | ||
| XRobotMain(hw); | ||
| return 0; | ||
| } | ||
| EOF | ||
|
|
||
| - name: Create minimal CMakeLists.txt | ||
| run: | | ||
| cat > CMakeLists.txt <<'EOF' | ||
| project(xrobot_mod_test CXX) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| add_executable(xr_test main.cpp) | ||
| set(XROBOT_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Modules/) | ||
| add_subdirectory(libxr) | ||
| target_include_directories(xr_test PUBLIC $<TARGET_PROPERTY:xr,INTERFACE_INCLUDE_DIRECTORIES> ${CMAKE_SOURCE_DIR}/User) | ||
| target_link_libraries(xr_test PUBLIC xr) | ||
| EOF | ||
|
|
||
| - name: Pull libxr to ./libxr | ||
| run: git clone --depth=1 https://github.com/Jiu-xiao/libxr ./libxr | ||
|
|
||
| - name: Checkout Referee module | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/Referee | ||
| path: Modules/Referee | ||
|
|
||
| - name: Checkout CMD module | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/CMD | ||
| path: Modules/CMD | ||
|
|
||
| - name: Checkout SuperPower module | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: QDU-Robomaster/SuperPower | ||
| path: Modules/SuperPower | ||
|
|
||
| - name: Setup Python & Install deps | ||
| run: | | ||
| python3 -m pip install --upgrade pip | ||
| pip3 install pyyaml requests | ||
|
|
||
| - name: Add XRobot tools to PATH | ||
| run: | | ||
| echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Install xrobot toolchain | ||
| run: | | ||
| pip3 install xrobot libxr | ||
|
|
||
| - name: Run xrobot_setup | ||
| run: | | ||
| xrobot_setup || true | ||
|
|
||
| - name: Run xrobot_init_mod | ||
| run: | | ||
| xrobot_init_mod | ||
|
|
||
| - name: Add module | ||
| run: | | ||
| xrobot_add_mod BlinkLED --instance-id BlinkLED_0 | ||
| xrobot_add_mod Referee --instance-id referee | ||
| xrobot_add_mod CMD --instance-id cmd | ||
| xrobot_add_mod SuperPower --instance-id superpower | ||
| - name: Add this repo module | ||
| run: | | ||
| xrobot_add_mod ${{ env.XR_MODULE_NAME }} && cat User/xrobot.yaml | ||
|
|
||
| - name: Generate main again | ||
| run: | | ||
| xrobot_setup | ||
|
|
||
| - name: Build | ||
| run: | | ||
| mkdir -p build | ||
| cd build | ||
| cmake .. | ||
| make | ||
|
|
||
| - name: Create Tag via GitHub API | ||
| if: ${{ success() && github.event_name != 'pull_request' }} | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const moduleTag = process.env.XR_MODULE_NAME; | ||
| const date = new Date(); | ||
| const yyyy = date.getUTCFullYear(); | ||
| const mm = String(date.getUTCMonth() + 1).padStart(2, '0'); | ||
| const dd = String(date.getUTCDate()).padStart(2, '0'); | ||
| const HH = String(date.getUTCHours()).padStart(2, '0'); | ||
| const MM = String(date.getUTCMinutes()).padStart(2, '0'); | ||
| const SS = String(date.getUTCSeconds()).padStart(2, '0'); | ||
| const tagName = `${moduleTag}-${yyyy}${mm}${dd}-${HH}${MM}${SS}`; | ||
|
|
||
| // 获取当前 commit sha | ||
| const sha = process.env.GITHUB_SHA; | ||
|
|
||
| // 创建 tag reference | ||
| await github.rest.git.createRef({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| ref: `refs/tags/${tagName}`, | ||
| sha: sha | ||
| }); | ||
| console.log(`Created tag: ${tagName} on sha: ${sha}`); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,36 @@ | ||
| # CMakeLists.txt for PowerControl | ||
|
|
||
| # Add module to include path | ||
| target_include_directories(xr PUBLIC ${CMAKE_CURRENT_LIST_DIR}) | ||
|
|
||
| # Auto-include source files | ||
| file(GLOB MODULE_POWERCONTROL_SRC CONFIGURE_DEPENDS | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cpp" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cxx" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cc" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.c" | ||
| ) | ||
|
|
||
| target_sources(xr PRIVATE ${MODULE_POWERCONTROL_SRC}) | ||
|
|
||
| # INTERFACE deps shell | ||
| get_filename_component(_MODULE_DIRNAME ${CMAKE_CURRENT_LIST_DIR} NAME) | ||
| set(_DEPS_TARGET "${_MODULE_DIRNAME}_deps") | ||
| add_library(${_DEPS_TARGET} INTERFACE) | ||
|
|
||
| # find_package(YourPkg REQUIRED COMPONENTS a b c) | ||
|
|
||
| # target_link_libraries(${_DEPS_TARGET} INTERFACE | ||
| # # YourLibA | ||
| # # YourLibB | ||
| # ) | ||
|
|
||
| # target_compile_definitions(${_DEPS_TARGET} INTERFACE | ||
| # # FOO=1 | ||
| # ) | ||
| # target_compile_options(${_DEPS_TARGET} INTERFACE | ||
| # # -Wall | ||
| # ) | ||
|
|
||
| # Register to global | ||
| set_property(GLOBAL APPEND PROPERTY XR_MODULE_DEPS ${_DEPS_TARGET}) | ||
| # CMakeLists.txt for PowerControl | ||
| # Add module to include path | ||
| target_include_directories(xr PUBLIC ${CMAKE_CURRENT_LIST_DIR}) | ||
| # Auto-include source files | ||
| file(GLOB MODULE_POWERCONTROL_SRC CONFIGURE_DEPENDS | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cpp" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cxx" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.cc" | ||
| "${CMAKE_CURRENT_LIST_DIR}/*.c" | ||
| ) | ||
| target_sources(xr PRIVATE ${MODULE_POWERCONTROL_SRC}) | ||
| # INTERFACE deps shell | ||
| get_filename_component(_MODULE_DIRNAME ${CMAKE_CURRENT_LIST_DIR} NAME) | ||
| set(_DEPS_TARGET "${_MODULE_DIRNAME}_deps") | ||
| add_library(${_DEPS_TARGET} INTERFACE) | ||
| # find_package(YourPkg REQUIRED COMPONENTS a b c) | ||
| # target_link_libraries(${_DEPS_TARGET} INTERFACE | ||
| # # YourLibA | ||
| # # YourLibB | ||
| # ) | ||
| # target_compile_definitions(${_DEPS_TARGET} INTERFACE | ||
| # # FOO=1 | ||
| # ) | ||
| # target_compile_options(${_DEPS_TARGET} INTERFACE | ||
| # # -Wall | ||
| # ) | ||
| # Register to global | ||
| set_property(GLOBAL APPEND PROPERTY XR_MODULE_DEPS ${_DEPS_TARGET}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Using
xrobot_setup || truemay hide real failures in the toolchain setup.Because later steps rely on a valid XRobot setup, swallowing non-zero exit codes here can turn a clear setup failure into harder-to-debug downstream errors. If there are specific, expected failure modes, handle those explicitly; otherwise, let the step fail so setup issues surface immediately.