Ros2关于如何编译rmf----已成功
环境
日期:2022/4/22
ubuntu版本:20.4
ros2版本:foxy (源码下载)
gcc:9
python:3.8
官网上说用Galactic版本的ros2更好,一开始我就用的Galactic,期间遇到了很多错误,我就想换个版本试试吧,结果很快成功编译了,这里有可能是笔者才疏学浅不知道怎么build,也可能是官方未对新版本适配,反正现在是可以了。hhh
1.设置gazebo库
sudo apt update
sudo apt install -y wget
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
2.从源码开始构建
官网显示可以通过Demos安装一个简化版本,这里介绍完整版的内容
1.下载依赖项:
此处不要下载rmf!
sudo apt update && sudo apt install \
git cmake python3-vcstool curl \
qt5-default \
-y
python3 -m pip install flask-socketio
sudo apt-get install python3-colcon*
2.下载 rosdep
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
3.下载源码(这一部分极其重要!)
mkdir -p ~/rmf_ws/src
cd ~/rmf_ws
wget https://raw.githubusercontent.com/open-rmf/rmf/main/rmf.repos
这是下载的rmf.repos内容:
repositories:
rmf/rmf_battery:
type: git
url: https://github.com/open-rmf/rmf_battery.git
version: main
rmf/rmf_internal_msgs:
type: git
url: https://github.com/open-rmf/rmf_internal_msgs.git
version: main
rmf/rmf_api_msgs:
type: git
url: https://github.com/open-rmf/rmf_api_msgs.git
version: main
rmf/rmf_ros2:
type: git
url: https://github.com/open-rmf/rmf_ros2.git
version: main
rmf/rmf_task:
type: git
url: https://github.com/open-rmf/rmf_task.git
version: main
rmf/rmf_traffic:
type: git
url: https://github.com/open-rmf/rmf_traffic.git
version: main
rmf/rmf_utils:
type: git
url: https://github.com/open-rmf/rmf_utils.git
version: main
rmf/ament_cmake_catch2:
type: git
url: https://github.com/open-rmf/ament_cmake_catch2.git
version: main
rmf/rmf_visualization:
type: git
url: https://github.com/open-rmf/rmf_visualization.git
version: main
rmf/rmf_visualization_msgs:
type: git
url: https://github.com/open-rmf/rmf_visualization_msgs.git
version: main
rmf/rmf_building_map_msgs:
type: git
url: https://github.com/open-rmf/rmf_building_map_msgs.git
version: main
rmf/rmf_simulation:
type: git
url: https://github.com/open-rmf/rmf_simulation.git
version: main
rmf/rmf_traffic_editor:
type: git
url: https://github.com/open-rmf/rmf_traffic_editor.git
version: main
demonstrations/rmf_demos:
type: git
url: https://github.com/open-rmf/rmf_demos.git
version: main
thirdparty/menge_vendor:
type: git
url: https://github.com/open-rmf/menge_vendor.git
version: master
thirdparty/nlohmann_json_schema_validator_vendor:
type: git
url: https://github.com/open-rmf/nlohmann_json_schema_validator_vendor.git
version: main
thirdparty/pybind11_json_vendor:
type: git
url: https://github.com/open-rmf/pybind11_json_vendor.git
version: main
thirdparty/ros_ign:
type: git
url: https://github.com/ignitionrobotics/ros_ign.git
version: ros2
我对其稍微进行了更改:
repositories:
rmf/rmf_battery:
type: git
url: https://github.com/open-rmf/rmf_battery.git
version: main
rmf/rmf_internal_msgs:
type: git
url: https://github.com/open-rmf/rmf_internal_msgs.git
version: main
rmf/rmf_api_msgs:
type: git
url: https://github.com/open-rmf/rmf_api_msgs.git
version: main
rmf/rmf_ros2:
type: git
url: https://github.com/open-rmf/rmf_ros2.git
version: main
rmf/rmf_task:
type: git
url: https://github.com/open-rmf/rmf_task.git
version: main
rmf/rmf_traffic:
type: git
url: https://github.com/open-rmf/rmf_traffic.git
version: main
rmf/rmf_utils:
type: git
url: https://github.com/open-rmf/rmf_utils.git
version: main
rmf/ament_cmake_catch2:
type: git
url: https://github.com/open-rmf/ament_cmake_catch2.git
version: main
rmf/rmf_visualization:
type: git
url: https://github.com/open-rmf/rmf_visualization.git
version: main
rmf/rmf_visualization_msgs:
type: git
url: https://github.com/open-rmf/rmf_visualization_msgs.git
version: main
rmf/rmf_building_map_msgs:
type: git
url: https://github.com/open-rmf/rmf_building_map_msgs.git
version: main
rmf/rmf_simulation:
type: git
url: https://github.com/open-rmf/rmf_simulation.git
version: main
rmf/rmf_traffic_editor:
type: git
url: https://github.com/open-rmf/rmf_traffic_editor.git
version: 1.3.0
demonstrations/rmf_demos:
type: git
url: https://github.com/open-rmf/rmf_demos.git
version: main
thirdparty/menge_vendor:
type: git
url: https://github.com/open-rmf/menge_vendor.git
version: master
thirdparty/nlohmann_json_schema_validator_vendor:
type: git
url: https://github.com/open-rmf/nlohmann_json_schema_validator_vendor.git
version: main
thirdparty/pybind11_json_vendor:
type: git
url: https://github.com/open-rmf/pybind11_json_vendor.git
version: main
thirdparty/ros_ign:
type: git
url: https://github.com/ignitionrobotics/ros_ign.git
version: foxy
然后下载就可以了!
vcs import src < rmf.repos
编译
编译的时候报错:ignition-gazebo3Config 这个玩意没有
所以:
sudo apt install ros-foxy-ros-ign
之后就没有报错了。
现在就可以编译了:
cd ~/rmf_ws
rosdep install --from-paths src --ignore-src --rosdistro galactic -y
source /opt/ros/galactic/setup.bash
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
成功!
可以开心的学习rmf了!希望看到这里的小伙伴都可以编译成功!
rmf网站:
https://github.com/open-rmf/rmf_demos/tree/main
https://osrf.github.io/ros2multirobotbook/intro.html
以上内容参考:
https://github.com/open-rmf/rmf/tree/main