Skip to content

Commit

Permalink
[Add] Enable CI & Add vendors & Remove vision pkgs (#27)
Browse files Browse the repository at this point in the history
1. Enable CI for common building in Ubuntu 20.04
2. Add behaviortreecppv3_vendor
3. Combine sdl2main_vendor and sdl2mixer_vendor into sdl2_vendor
4. Remove opencv_vendor & vision pkgs

Signed-off-by: Homalozoa <[email protected]>
  • Loading branch information
homalozoa authored Oct 14, 2021
1 parent 1362031 commit b35dc14
Show file tree
Hide file tree
Showing 56 changed files with 226 additions and 1,190 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Checklist for the Merge Request Author

- [ ] Follow [CONTRIBUTING.MD](https://partner-gitlab.mioffice.cn/cyberdog/cyberdog_cyberdog/-/blob/master/CONTRIBUTING.md)
- [ ] Follow [CONTRIBUTING.MD](https://github.com/MiRoboticsLab/cyberdog_ros2/blob/main/CONTRIBUTING.md)
- [ ] Commit messages are signed(`git commit -s`)
- [ ] Commit author matches [Individual Contributor License Agreement](https://cdn.cnbj2m.fds.api.mi-img.com/cyberdog-package/packages/doc_materials/cla_zh_en.pdf)
- [ ] Commits messages are according to this [guideline](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/build_common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
pull_request:
push:

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
fail-fast: false
steps:
- name: Setup ROS 2
uses: ros-tooling/[email protected]
with:
required-ros-distributions: galactic
- name: build and test
uses: ros-tooling/[email protected]
with:
target-ros2-distro: galactic
colcon-defaults: |
{
"build": {
"merge-install": [true]
}
}
- name: Codecov
uses: codecov/[email protected]
with:
file: ros_ws/lcov/total_coverage.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/
build/
install/
log/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Move the repositories to GitHub and replace the athena keyword with cyberdog in
## 1.0.2 (2021-09-27)

Add grpc_vendor, lcm_vendor, mpg123_vendor, sdl2main_vendor, sdl2mixer_vendor and opencv_vendor to constrain the building environment.

## 1.0.3 (2021-10-14)

Remove opencv_vendor, combine sdl2main_vendor & sdl2mixer_vendor into sdl2_vendor. Remove vision pkgs.
6 changes: 0 additions & 6 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ alsa-lib (v1.1.3)
- Source: https://github.com/alsa-project/alsa-lib/releases/tag/v1.1.3
- Usage: as-is, dynamic-linking

angles (1.12.4)
- License: BSD-3-Clause
- Project: https://github.com/ros/angles
- Source: https://github.com/ros/angles/releases/tag/1.12.4
- Usage: as-is, dynamic-linking

bluepy (v1.3.0)
- License: public-domain
- Project: https://github.com/IanHarvey/bluepy
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

由于NVIDIA对Jetson系列截至目前(202109)只提供了Ubuntu 18.04的支持, 故我们对Ubuntu 18.04进行了ROS 2的适配和修改. 具体的修改内容可以通过[mini.repos](tools/ros2_fork/mini.repos)进行拉取, 我们去除了部分没必要的仓, 并添加了一些需要使用的仓库.

本项目的详细文档都在各个子模块的根目录里, 如有需要可以直接[点击进行了解](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/CyberDog-2021---ROS-2-%E8%BD%AF%E4%BB%B6%E6%9E%B6%E6%9E%84-ROS-2-Software-Architecture)
本项目的详细文档都在各个子模块的根目录里, 如有需要可以直接[点击进行了解](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki)

## 前置条件

Expand All @@ -34,15 +34,15 @@ $ apt-get update
$ apt-get install nvidia-l4t-jetson-multimedia-api cuda-compiler-10-2
```

如是后者, 可以考虑[使用aarch64的Docker](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/%E4%BD%BF%E7%94%A8Docker%E6%9E%84%E5%BB%BA%E9%93%81%E8%9B%8B%E9%A1%B9%E7%9B%AE-%7C-Building-CyberDog-Projects-with-Docker). 我们在未来会支持交叉编译。
如是后者, 可以考虑使用arm64的Docker. 我们在未来会支持交叉编译。

## 大陆地区加速

如果您在中华人民共和国大陆地区, 可以使用我们提供的Docker的构建加速和colcon的编译加速

> 构建Docker时, 可使用`docker build -t arm_docker:1.0 . --build-arg gfw=1`进行构建镜像, 以提高速度.
> 使用colcon编译包时, 可在colcon编译的语句最后添加`--cmake-args -DBUILD_INSIDE_GFW=ON`以获取加速, 如`colcon build --merge-install --packages-select sdl2main_vendor sdl2mixer_vendor lcm_vendor mpg123_vendor toml11_vendor --cmake-args -DBUILD_INSIDE_GFW=ON`.
> 使用colcon编译包时, 可在colcon编译的语句最后添加`--cmake-args -DBUILD_INSIDE_GFW=ON`以获取加速, 如`colcon build --merge-install --packages-select sdl2_vendor lcm_vendor mpg123_vendor toml11_vendor --cmake-args -DBUILD_INSIDE_GFW=ON`.
## 构建 & 部署

Expand All @@ -64,7 +64,7 @@ $ git clone https://github.com/MiRoboticsLab/cyberdog_ros2.git
$ cd ..
```

- 使用`--packages-up-to`编译([确保source过ROS 2的环境变量](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/%E4%BB%8E%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85ROS-2#7-%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95))
- 使用`--packages-up-to`编译(确保source过ROS 2的环境变量)

```
$ colcon build --merge-install --packages-up-to cyberdog_bringup
Expand All @@ -91,7 +91,7 @@ $ git clone https://github.com/MiRoboticsLab/cyberdog_ros2.git
$ cd ..
```

- 直接编译所有的包([确保source过ROS 2的环境变量](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/%E4%BB%8E%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85ROS-2#7-%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95))
- 直接编译所有的包(确保source过ROS 2的环境变量)

```
$ colcon build --merge-install
Expand All @@ -104,7 +104,7 @@ $ export OUTPUT_DIR=/opt/ros2/cyberdog
$ colcon build --merge-install --install-base $OUTPUT_DIR
```

此外,小米提供的部分闭源功能包:视觉识别和小爱同学支持默认`不打开`,需要通过在`--cmake-args`后添加`-DXIAOMI_VISION=ON``-DXIAOMI_XIAOAI=ON`分别打开两个功能的编译。
此外,小米提供的部分闭源功能包:小爱同学支持默认`不打开`,需要通过在`--cmake-args`后添加`-DXIAOMI_XIAOAI=ON`分别打开两个功能的编译。

### 通用的部署方式

Expand Down
10 changes: 5 additions & 5 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Most of the robot applications are implemented based on ROS -As shown in the [ar

Due to NVIDIA only provides support for Ubuntu 18.04 for the Jetson series (202109) as yet, we have adapted and modified ROS 2 for Ubuntu 18.04. The specific modification content can be pulled through [mini.repos](tools/ros2_fork/mini.repos). We have removed some unnecessary repositories, and added some repositories that need to be used.

The documentation of this project is in the root directory of each submodule. If necessary, read [this page](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/CyberDog-2021---ROS-2-%E8%BD%AF%E4%BB%B6%E6%9E%B6%E6%9E%84-ROS-2-Software-Architecture).
The documentation of this project is in the root directory of each submodule. If necessary, read [this page](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki).

## Precondition

Expand All @@ -34,7 +34,7 @@ $ apt-get update
$ apt-get install nvidia-l4t-jetson-multimedia-api cuda-compiler-10-2
```

If the latter, you can consider [using aarch64's Docker](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/%E4%BD%BF%E7%94%A8Docker%E6%9E%84%E5%BB%BA%E9%93%81%E8%9B%8B%E9%A1%B9%E7%9B%AE-%7C-Building-CyberDog-Projects-with-Docker). We will support cross compilation in the future.
If the latter, you can consider using arm64's Docker. We will support cross compilation in the future.

## Build & Deploy

Expand All @@ -56,7 +56,7 @@ $ git clone https://github.com/MiRoboticsLab/cyberdog_ros2.git
$ cd ..
```

- Use `--packages-up-to` to compile([Ensure the ROS 2 environment is sourced](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/%E4%BB%8E%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85ROS-2---Building-ROS-2-from-source))
- Use `--packages-up-to` to compile(Ensure the ROS 2 environment is sourced)

```
$ colcon build --merge-install --packages-up-to cyberdog_bringup
Expand All @@ -82,7 +82,7 @@ $ git clone https://github.com/MiRoboticsLab/cyberdog_ros2.git
$ cd ..
```

- Compile all packages ([Ensure the ROS 2 environment is sourced](https://github.com/MiRoboticsLab/cyberdog_ros2/wiki/Building-ROS-2-from-source#7-instructions))
- Compile all packages (Ensure the ROS 2 environment is sourced)

```
$ colcon build --merge-install
Expand All @@ -95,7 +95,7 @@ $ export OUTPUT_DIR=/opt/ros2/cyberdog
$ colcon build --merge-install --install-base $OUTPUT_DIR
```

In addition, some closed-source function packages provided by Xiaomi: visual recognition and Xiaoai support default `not open`, you need to add `-DXIAOMI_VISION=ON` and `-DXIAOMI_XIAOAI=ON` after `--cmake-args` respectively turn on the building of the two functions.
In addition, some closed-source function packages provided by Xiaomi: Xiaoai support default `not open`, you need to add `-DXIAOMI_XIAOAI=ON` after `--cmake-args` respectively turn on the building of the two functions.

### General deployment method

Expand Down
2 changes: 1 addition & 1 deletion cyberdog_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>cyberdog_bringup</name>
<version>1.0.0</version>
<description>CyberDog Launch Scripts</description>
<maintainer email="[email protected]">Homalozoa</maintainer>
<maintainer email="[email protected]">homalozoa</maintainer>
<license>Apache License, Version 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
6 changes: 4 additions & 2 deletions cyberdog_ception/cyberdog_bms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ ${catkin_INCLUDE_DIRS}
)

add_executable(bms_recv src/bms_logger.cpp src/bms_recv.cpp)
ament_target_dependencies(bms_recv rclcpp std_msgs ception_msgs lcm_vendor rclcpp_action interaction_msgs)
ament_target_dependencies(bms_recv rclcpp std_msgs ception_msgs lcm_vendor rclcpp_action interaction_msgs
lcm_translate_msgs)
target_link_libraries(bms_recv)

add_executable(bms_ctrl src/bms_ctrl.cpp)
ament_target_dependencies(bms_ctrl rclcpp std_msgs ception_msgs lcm_vendor)
ament_target_dependencies(bms_ctrl rclcpp std_msgs ception_msgs lcm_vendor
lcm_translate_msgs)
target_link_libraries(bms_ctrl)

## Install headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ cyberdog_utils::CallbackReturn BodyStatePubNode::on_activate(const rclcpp_lifecy
return cyberdog_utils::CallbackReturn::SUCCESS;
}

cyberdog_utils::CallbackReturn BodyStatePubNode::on_deactivate(const rclcpp_lifecycle::State & state)
cyberdog_utils::CallbackReturn BodyStatePubNode::on_deactivate(
const rclcpp_lifecycle::State & state)
{
UNUSED_VAR(state);
RCLCPP_INFO(get_logger(), "Deactiving");
Expand Down
3 changes: 3 additions & 0 deletions cyberdog_ception/cyberdog_scenedetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ include(ExternalProject)
set(EXTPRJ_NAME bream)
set(PREFIX_DIR "${CMAKE_CURRENT_BINARY_DIR}/${EXTPRJ_NAME}")

message(WARNING "Not support yet.")
return()

externalproject_add(
${EXTPRJ_NAME}
PREFIX ${EXTPRJ_NAME}
Expand Down
39 changes: 39 additions & 0 deletions cyberdog_common/behaviortreecppv3_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.8)
project(behaviortreecppv3_vendor)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)

set(GITHUB_URL "github.com")
option(BUILD_INSIDE_GFW "Build this package in PRC" OFF)

if(BUILD_INSIDE_GFW)
message(">>> Replace github.com into hub.fastgit.org for PRC users!")
set(GITHUB_URL "hub.fastgit.org")
endif()

set(EXTPRJ_NAME behaviortreecppv3)
set(OUT_DIR "${CMAKE_BINARY_DIR}/install")
set(GIT_URL "https://${GITHUB_URL}/BehaviorTree/BehaviorTree.CPP.git")
set(PKG_VER "3.5.6")

include(ExternalProject)

externalproject_add(
${EXTPRJ_NAME}
PREFIX ${EXTPRJ_NAME}
GIT_REPOSITORY ${GIT_URL}
GIT_TAG ${PKG_VER}
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DBUILD_EXAMPLES=OFF
-DBUILD_UNIT_TESTS=OFF
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
TIMEOUT 1200
)

ament_package()
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>opencv_vendor</name>
<name>behaviortreecppv3_vendor</name>
<version>1.0.0</version>
<description>Vendor library for OpenCV of CyberDog.</description>
<description>Vendor library for behaviortree_cpp_v3.</description>
<maintainer email="[email protected]">homalozoa</maintainer>
<license>Apache License 2.0</license>

Expand Down
3 changes: 1 addition & 2 deletions cyberdog_common/cyberdog_grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ find_package(interaction_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(automation_msgs REQUIRED)
find_package(cyberdog_utils REQUIRED)
find_package(behaviortree_cpp_v3 REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(lcm_vendor REQUIRED)
find_package(rclcpp REQUIRED)
Expand Down Expand Up @@ -60,7 +59,7 @@ set(dependencies
nav_msgs
automation_msgs
cyberdog_utils
behaviortree_cpp_v3
lcm_translate_msgs
builtin_interfaces
rclcpp
rclcpp_action
Expand Down
1 change: 0 additions & 1 deletion cyberdog_common/grpc_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if(BUILD_INSIDE_GFW)
endif()

set(EXTPRJ_NAME grpc)
set(PREFIX_DIR "${CMAKE_CURRENT_BINARY_DIR}/${EXTPRJ_NAME}/src/${EXTPRJ_NAME}")
set(OUT_DIR "${CMAKE_BINARY_DIR}/install")
set(GIT_URL "https://${GITHUB_URL}/grpc/grpc.git")
set(PKG_VER "v1.36.3")
Expand Down
2 changes: 2 additions & 0 deletions cyberdog_common/grpc_vendor/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>grpc</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
7 changes: 5 additions & 2 deletions cyberdog_common/lcm_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if(BUILD_INSIDE_GFW)
endif()

set(EXTPRJ_NAME mpg123)
set(PREFIX_DIR "${CMAKE_CURRENT_BINARY_DIR}/${EXTPRJ_NAME}/src/${EXTPRJ_NAME}")
set(OUT_DIR "${CMAKE_BINARY_DIR}/install")
set(PKG_VER "v1.4.0")

Expand All @@ -30,8 +29,12 @@ externalproject_add(
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${OUT_DIR}
-DLCM_ENABLE_JAVA=OFF
-DLCM_ENABLE_PYTHON=OFF
-DLCM_ENABLE_LUA=OFF
-DLCM_ENABLE_TESTS=OFF
INSTALL_DIR ${OUT_DIR}
TIMEOUT 300
TIMEOUT 1200
)

set(lcm_libs
Expand Down
2 changes: 1 addition & 1 deletion cyberdog_common/mpg123_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ externalproject_add(
CONFIGURE_COMMAND eval ${PREFIX_DIR}/configure --prefix=${OUT_DIR}
BUILD_COMMAND "make"
INSTALL_DIR ${OUT_DIR}
TIMEOUT 60
TIMEOUT 1200
)

set(mpg123_libs
Expand Down
Loading

0 comments on commit b35dc14

Please sign in to comment.