后更:用的方法已经多到记不清了,但是唯有一点真理!如果安装有问题,先找官网!!解决一大半问题呜呜
上次安装的ROS
还是有问题,测试案例不能正常运行,这次换了教程终于解决了qaq折磨了两周
首先卸载
sudo apt remove ros-foxy-*
sudo apt autoremove
Setup Locale
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
Setup Sources
sudo apt update
sudo apt install curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | sudo apt-key add -
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
Install ROS2 Packages
sudo apt update
sudo apt install ros-foxy-desktop
Setup Environment
SHELL是zsh:
source /opt/ros/foxy/setup.zsh
echo "source /opt/ros/foxy/setup.zsh" >> ~/.zshrc
source ~/.zshrc
如果SHELL是bash就把zsh换成bash。这样每次终端打开时自动加载source /opt/ros/foxy/setup.zsh命令。
其他
sudo apt install python3-argcomplete
sudo apt update
sudo apt install ros-foxy-rmw-connext-cpp
Test Examples
分别打开两个终端:
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_py listener
运行结果:终端通信
大功告成呜呜呜有问题再更新
版权声明:本文为weixin_45717809原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。