Howto Install and Configure ROS on Ubuntu

本文详细介绍如何在Ubuntu上安装并配置ROS Groovy版本,包括设置源列表、安装密钥、安装ROS桌面完整版等步骤,并指导如何初始化rosdep、设置ROS环境变量以及创建和构建ROS工作空间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HowtoInstall and Configure ROS Groovy on Ubuntu

Followthe instruction http://www.ros.org/wiki/groovy/Installation/Ubuntuto install ROS Groovy:

  1. Setupsources.list:

    $sudosh -c 'echo "deb http://packages.ros.org/ros/ubuntu precisemain" > /etc/apt/sources.list.d/ros-latest.list'

  2. Setupkeys:

    $wgethttp://packages.ros.org/ros.key -O - | sudo apt-key add -

  3. Installation:

    1. $sudoapt-get update

    2. $sudoapt-get install ros-groovy-desktop-full

  4. Initializerosdep:

    1. $sudorosdep init

    2. $rosdepupdate

  5. Environmentsetup:

    1. Addthe ROS environment variables to the bash session every time a newshell is launched:

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

    2. Resourceto enable ros environment variables:

      $source~/.bashrc

    3. Checkthe ros environment variable to test the installation:

      $echo$ROS_DISTRO

      $export| grep ROS

      You will getsomething like:

      declare-x ROS_DISTRO="groovy"

      declare-x ROS_ETC_DIR="/opt/ros/groovy/etc/ros"

      declare-x ROS_MASTER_URI="http://localhost:11311"

      declare-x ROS_PACKAGE_PATH="/opt/ros/groovy/share:/opt/ros/groovy/stacks"

      declare-x ROS_ROOT="/opt/ros/groovy/share/ros"

      Everytime a new shell is launched, the environment variables will beloaded automatically.

  6. Getrosinstall:

    $sudoapt-get install python-rosinstall


Followthe instructionhttp://www.ros.org/wiki/ROS/Tutorials/InstallingandConfiguringROSEnvironmentto configure ros environment:

  1. Createa ROS Workspace:

    1. Createdirectories:

      $mkdir-p /program/ros_workspace/src

    2. Initializethe workspace:

      $cd/program/ros_workspace/src

      $catkin_init_workspace

      thiscommand will create one CMakeList.txt link;

    3. Buildthe workspace:

      $cd/program/ros_workspace

      $catkin_make

      thiscommand will create another two folders build and devel in theworkspace, refer tohttp://www.ros.org/wiki/ROS/Tutorials/InstallingandConfiguringROSEnvironmentfor detailed information about these folders.

  2. Changethe source command in ~/.bashrc:

    $gedit~/.bashrc

    Commentthe last line with '#',add new source and save the file. That is,changing the last part of ~/.bashrc into:

    #source/opt/ros/groovy/setup.bash

    source/program/ros_workspace/devel/setup.bash

    Byadding this line, every time you start a new shell, it willautomatically load ros environment variables. And roscd willdirectly take you to /program/ros_workspace/devel.

cjx0409@rog:~$ sudo apt update 命中:1 http://mirrors.aliyun.com/ubuntu jammy InRelease 命中:2 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease 命中:3 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease 获取:4 http://mirrors.aliyun.com/ubuntu jammy-security InRelease [129 kB] 已下载 129 kB,耗时 1秒 (183 kB/s) 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 有 3 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。 cjx0409@rog:~$ cat /etc/apt/sources.list # deb cdrom:[Ubuntu 22.04.5 LTS _Jammy Jellyfish_ - Release amd64 (20240911)]/ jammy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ jammy universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy universe deb http://mirrors.aliyun.com/ubuntu/ jammy-updates universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://mirrors.aliyun.com/ubuntu/ jammy multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted # deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted deb http://mirrors.aliyun.com/ubuntu/ jammy-security universe # deb-src http://security.ubuntu.com/ubuntu jammy-security universe deb http://mirrors.aliyun.com/ubuntu/ jammy-security multiverse # deb-src http://security.ubuntu.com/ubuntu jammy-security multiverse # This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual. cjx0409@rog:~$ ls /etc/apt/sources.list.d/ cjx0409@rog:~$ ls /etc/apt/sources.list.d cjx0409@rog:~$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ jammy main" > /etc/apt/sources.list.d/ros-latest.list' [sudo] cjx0409 的密码: cjx0409@rog:~$ cat /etc/apt/sources.list.d/ros-latest.list deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ jammy main cjx0409@rog:~$ sudo rm /usr/share/keyrings/ros-archive-keyring.gpg [sudo] cjx0409 的密码: cjx0409@rog:~$ sudo apt update 忽略:1 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu jammy InRelease 错误:2 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu jammy Release 404 Not Found [IP: 101.6.15.130 80] 命中:3 http://mirrors.aliyun.com/ubuntu jammy InRelease 命中:4 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease 命中:5 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease 命中:6 http://mirrors.aliyun.com/ubuntu jammy-security InRelease 正在读取软件包列表... 完成 E: 仓库 “http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu jammy Release” 没有 Release 文件。 N: 无法安全地用该源进行更新,所以默认禁用该源。 N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。 cjx0409@rog:~$ 这个是我的操作步骤你分析一下
最新发布
07-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值