feat: 初始化 Go2 导航代码与配置

This commit is contained in:
2026-10-14 11:08:44 +08:00
parent 8e16ecceba
commit 9dab37e8c8
1258 changed files with 1936673 additions and 0 deletions

44
unitree_ros2/.github/workflows/auto-tag.yml vendored Executable file
View File

@@ -0,0 +1,44 @@
name: Tag on version change
on:
push:
paths:
- 'version.txt'
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
id: version
run: |
VERSION=$(cat version.txt | tr -d '[:space:]')
echo "Detected version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create tag
id: tag
if: steps.version.outputs.version != ''
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@unitree.com'
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
BODY=$(awk '/^## \[?v${{ steps.version.outputs.version }}\]?/ {flag=1;next} /^## /{flag=0} flag' CHANGELOG.md)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
body: ${{ steps.tag.outputs.content }}

43
unitree_ros2/.github/workflows/build-foxy.yml vendored Executable file
View File

@@ -0,0 +1,43 @@
name: Build in ubuntu:20.04 with ROS2 Foxy
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest # Use latest runner to host the container
container:
image: althack/ros2:foxy-full
options: --privileged # Needed for some build tools
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
apt-get update
apt install -y ros-foxy-rmw-cyclonedds-cpp ros-foxy-rosidl-generator-dds-idl
- name: ROS2 build
run: |
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
cd cyclonedds_ws
git clone https://github.com/ros2/rmw_cyclonedds -b foxy
git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x
cd ..
export LD_LIBRARY_PATH=/opt/ros/foxy/lib
colcon build --packages-select cyclonedds
. /opt/ros/foxy/setup.sh
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
cd cyclonedds_ws
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --packages-select unitree_go unitree_hg unitree_api
. ./install/setup.sh
cd ..
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --packages-select unitree_ros2_example
. ./install/setup.sh
echo "Build completed successfully."

View File

@@ -0,0 +1,43 @@
name: Build in ubuntu:22.04 with ROS2 Humble
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest # Use latest runner to host the container
container:
image: althack/ros2:humble-full
options: --privileged # Needed for some build tools
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
apt-get update
apt install -y ros-humble-rmw-cyclonedds-cpp ros-humble-rosidl-generator-dds-idl
- name: ROS2 build
run: |
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
cd cyclonedds_ws
git clone https://github.com/ros2/rmw_cyclonedds -b humble
git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x
cd ..
export LD_LIBRARY_PATH=/opt/ros/humble/lib
colcon build --packages-select cyclonedds
. /opt/ros/humble/setup.sh
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
cd cyclonedds_ws
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --packages-select unitree_go unitree_hg unitree_api
. ./install/setup.sh
cd ..
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --packages-select unitree_ros2_example
. ./install/setup.sh
echo "Build completed successfully."

46
unitree_ros2/.github/workflows/release.yml vendored Executable file
View File

@@ -0,0 +1,46 @@
name: Generate Changelog and Release
on:
push:
tags:
- 'v*.*.*' # 仅当推送 tag,如 v1.2.3 时触发
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Set up Git
# run: |
# git config --global user.name 'github-actions[bot]'
# git config --global user.email 'github-actions[bot]@unitree.com'
# - name: Generate changelog
# run: |
# docker run -v "$PWD":/workdir quay.io/git-chglog/git-chglog -o CHANGELOG.md
# - name: Commit changelog
# run: |
# git add CHANGELOG.md
# git commit -m "docs(changelog): update changelog for ${{ github.ref_name }}"
# git push
- name: Read changelog content
id: changelog
run: |
BODY=$(awk '/^## \[?${{ github.ref_name }}\]?/ {flag=1;next} /^## /{flag=0} flag' CHANGELOG.md)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.content }}