偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.
全部博文(1747)
分类: 其他平台
2020-07-30 20:38:19
系统部署方面参见 nuc 上部署 ROS2 foxy
sudo
locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl -s | sudo apt-key add -
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
可以换成清华源 mirror.tuna.tsinghua.edu.cn 替换 packages.ros.org
ros-rolling-rmw-connext-cpp 这个一定不要装, 切记不要装, 绝对不能装. 除非你确认会改写dds环境
sudo apt update
sudo apt install ros-rolling-desktop python3-argcomplete
测试:
source /opt/ros/rolling/setup.bash
ros2 run demo_nodes_cpp talker
source /opt/ros/rolling/setup.bash
ros2 run demo_nodes_py listener
*********************************************************************************************************************************************************************************************************************************
编译环境
sudo apt install python3-colcon-common-extensions python3-rosdep libpython3-dev python3-argcomplete
mkdir –p /work/ROS2/rolling_ridley/src
cd /work/ROS2/rolling_ridley/
范例
git clone src/examples
编译
colcon build --symlink-install
*********************************************************************************************************************************************************************************************************************************
部署开发环境
sudo rosdep init
rosdep update ### /etc/hosts 添加 151.101.84.133 raw.githubusercontent.com
rosdep install --from-paths /opt/ros/rolling/share --ignore-src --rosdistro rolling -y --skip-keys "console_bridge fastcdr fastrtps osrf_testing_tools_cpp poco_vendor rmw_connext_cpp rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp rti-connext-dds-5.3.1 tinyxml_vendor tinyxml2_vendor urdfdom urdfdom_headers"
//开机环境
cat /etc/ROS2_ENV
#!/bin/sh
export ROS_DOMAIN_ID=91
export ROS_LOCALHOST_ONLY=1 ##因为目前场景不需要分布式
source /opt/ros/rolling/setup.bash
source /work/ROS2/rolling_ridley/install/setup.bash
export GIT_SSL_NO_VERIFY=1
export SLAM_MAP_DIR=/work/ROS2/rolling_ridley/SlamMap
export VP_CALLBACK_ECHO=everything_is_OK
//添加到.bashrc
source /etc/ROS2_ENV
alias gw='cd /work/ROS2/rolling_ridley'
alias gs='cd /work/ROS2/rolling_ridley/src'
alias gm='cd /work/ROS2/rolling_ridley && colcon build'
确认环境正确性
$ printenv | grep ROS
ROS_VERSION=2
ROS_PYTHON_VERSION=3
SLAM_MAP_DIR=/work/ROS2/rolling_ridley/SlamMap
ROS_DOMAIN_ID=91
ROS_LOCALHOST_ONLY=1
ROS_DISTRO=rolling
开始自己的包.
gs #进入工作空间的代码目录.
ros2 pkg create big_bringup --build-type ament_cmake #创建big_bringup包空间. 然后在 下面一级的 src 中添加代码.
gw # 进入工作空间目录
rosdep install -i --from-path src --rosdistro rolling –y ## 安装依赖
olcon build --packages-up-to big_bringup ## 编译 big_bringup
OK, 参考 example 进行 big_bringup 的代码之旅吧.