跳转至

🔧 环境配置

💡 主控计算机已预装所有环境。以下教程专为需要配置新设备时使用。

📋 前置要求

💻 软件环境

  • Ubuntu 22.04 LTS
  • ROS2 Humble

1.1 安装 ROS2 Humble

如已安装可跳过,详细安装步骤请参考 ROS2安装教程

1.2 安装系统依赖

# 更新系统
sudo apt update -y

# 安装 ROS2 依赖包
sudo apt-get install ros-humble-moveit -y
sudo apt-get install ros-humble-gripper-controllers -y
sudo apt-get install ros-humble-position-controllers -y
sudo apt-get install ros-humble-joint-state-broadcaster -y
sudo apt-get install ros-humble-joint-trajectory-controller -y
sudo apt-get install ros-humble-xacro -y
sudo apt-get install ros-humble-hardware-interface -y
sudo apt-get install ros-humble-controller-manager -y
sudo apt-get install ros-humble-moveit-plugins ros-humble-moveit-ros-perception -y

# 安装 Qt/PySide6 图形界面依赖
sudo apt-get install libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-keysyms1 libxcb-render-util0 -y

# 安装 CAN 和 git
sudo apt-get install can-utils -y
sudo apt-get install git -y

# 安装 vcs 工具
sudo apt-get install python3-vcstool -y

# 安装 Python 依赖
python3 -m pip install python-can -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install pyside6 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install openarmx_arm_driver -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install placo -i https://pypi.tuna.tsinghua.edu.cn/simple
# 更新系统
sudo apt update -y

# 安装 ROS2 依赖包
sudo apt-get install ros-humble-moveit -y
sudo apt-get install ros-humble-gripper-controllers -y
sudo apt-get install ros-humble-position-controllers -y
sudo apt-get install ros-humble-joint-state-broadcaster -y
sudo apt-get install ros-humble-joint-trajectory-controller -y
sudo apt-get install ros-humble-xacro -y
sudo apt-get install ros-humble-hardware-interface -y
sudo apt-get install ros-humble-controller-manager -y
sudo apt-get install ros-humble-moveit-plugins ros-humble-moveit-ros-perception -y

# 安装 Qt/PySide6 图形界面依赖
sudo apt-get install libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-keysyms1 libxcb-render-util0 -y

# 安装 CAN 和 git
sudo apt-get install can-utils -y
sudo apt-get install git -y

# 安装 vcs 工具
sudo apt-get install python3-vcstool -y

# 安装 Python 依赖
python3 -m pip install python-can -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install pyside6 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install openarmx_arm_driver -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install placo -i https://pypi.tuna.tsinghua.edu.cn/simple
# 更新系统
sudo apt update -y

# 安装 ROS2 依赖包
sudo apt-get install ros-humble-moveit -y
sudo apt-get install ros-humble-gripper-controllers -y
sudo apt-get install ros-humble-position-controllers -y
sudo apt-get install ros-humble-joint-state-broadcaster -y
sudo apt-get install ros-humble-joint-trajectory-controller -y
sudo apt-get install ros-humble-xacro -y
sudo apt-get install ros-humble-hardware-interface -y
sudo apt-get install ros-humble-controller-manager -y
sudo apt-get install ros-humble-moveit-plugins ros-humble-moveit-ros-perception -y

# 安装 Qt/PySide6 图形界面依赖
sudo apt-get install libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-keysyms1 libxcb-render-util0 -y

# 安装 CAN 和 git
sudo apt-get install can-utils -y
sudo apt-get install git -y

sudo apt install libfuse2

# 安装 vcs 工具
sudo apt-get install python3-vcstool -y

# 安装 Python 依赖
python3 -m pip install python-can -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install pyside6 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install openarmx_arm_driver -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python3 -m pip install placo -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install websockets -i https://pypi.tuna.tsinghua.edu.cn/simple

# 配置当前用户,用于运行外骨骼上位机,配置完毕后需重启才能生效
sudo usermod -a -G dialout $USER  

# 附权
sudo chmod +x 'Qnbot HMI Control-1.2.2.AppImage'

1.3 安装 KCAN 驱动(如已安装可跳过)

可参考 KCAN 驱动安装

1.4 构建工作空间

# 创建工作空间
cd
mkdir -p ~/openarmx_ws/src
cd ~/openarmx_ws/src

拉取代码

# 克隆
git clone https://github.com/openarmx/openarmx_ros2.git
# 拉取完整的选项包
vcs import < openarmx_ros2/openarmx.repos

编译

# 编译工作空间
cd ~/openarmx_ws
colcon build
配置环境变量(为后续方便使用设置,如不需要可跳过)

# 配置环境变量(pro max 版本专用)
echo "alias sc='source install/local_setup.bash'" >> ~/.bashrc
echo "alias cb='colcon build --packages-select'" >> ~/.bashrc
source ~/.bashrc