1. 编译安装

为了编译运行 lebai-ros-sdk,您需要先安装一些依赖。

1.1. 安装 ROS2 Humble

您可以参考 ROS2官方文档 安装 ROS 2 。 在一个标准的 Ubuntu 桌面系统通过 Debian package 的安装步骤通常如下:

1.1.1. 设置 ROS2 软件包安装源

sudo apt update && sudo apt install curl gnupg lsb-release
# https://ghproxy.com is for chinese network.
sudo curl -sSL https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

1.1.2. 通过 apt 安装 ROS2

sudo apt update
## must execute an upgrade before install.
sudo apt upgrade
sudo apt install ros-humble-desktop # use desktop install, this will take some time.

1.1.3. 设置 ROS2 环境

您需要在 bash 终端中运行如下脚本来设置 ROS 2 环境。

source /opt/ros/humble/setup.bash

如果您不希望每次打开终端都需要运行上述脚本,你可以通过将上述脚本内容写入对应的 rc 配置文件中来简化。

bash

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrc

如果您使用 zsh,则相应的脚本如下。

zsh

echo "source /opt/ros/humble/setup.zsh" >> ~/.zshrc
source ~/.zshrc

注意,如果您的设备装有多个不同的 ROS 发行版,您可以通过不同的脚本文件来选择使用不同的发行版。 当您切换时,请重新打开一个新的 Shell

1.2. 安装 ROS2 依赖包

运行如下脚本,安装一些 lebai-ros-sdk 所需要的依赖包。

sudo apt install python3-colcon-common-extensions ros-humble-control-msgs ros-humble-tf-transformations python3-transforms3d python3-roslib ros-humble-moveit

1.3. 安装 python 依赖包

lebai-ros-sdk 依赖于如下 python 包:

通过 pip 可以进行安装

sudo apt install python3-pip # If pip is not install.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple lebai

1.4. 编译 lebai-ros-sdk 开发包

您现在可以开始从github克隆 lebai-ros-sdk 的源代码,并且尝试编译。

运行如下脚本:

mkdir -p  ~/lebai_ws/src
cd  ~/lebai_ws/src
git clone https://github.com/lebai-robotics/lebai-ros-sdk.git -b humble-dev
cd ~/lebai_ws
colcon build

您现在已经完成了 lebai-ros-sdk 的编译。

Note

记住,当您完成编译后,您需要设置您工作空间的环境以便让 ROS 2 发现您的包。

# for bash
source ~/lebai_ws/install/setup.bash
# for zsh
source ~/lebai_ws/install/setup.zsh