0.确定环境
1.设置apt源
nvidia@nvidia-desktop:~$ sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’
[sudo] password for nvidia:
nvidia@nvidia-desktop:~$ cat /etc/apt/sources.list.d/ros-latest.list
deb http://packages.ros.org/ros/ubuntu bionic main
2.设置密钥
从密钥服务器下载密钥并更新:
nvidia@nvidia-desktop:~$ sudo apt-key adv –keyserver ‘hkp://keyserver.ubuntu.com:80’ –recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Executing: /tmp/apt-key-gpghome.0HWJ2hPhsu/gpg.1.sh –keyserver hkp://keyserver.ubuntu.com:80 –recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
gpg: key F42ED6FBAB17C654: public key “Open Robotics <info@osrfoundation.org>” imported
gpg: Total number processed: 1
gpg: imported: 1
3.安装
(1). 更新索引
nvidia@nvidia-desktop:~$ sudo apt update
Get:1 http://packages.ros.org/ros/ubuntu bionic InRelease [4,680 B]
Get:2 http://packages.ros.org/ros/ubuntu bionic/main arm64 Packages [727 kB]
Hit:3 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 Packages [1,228 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 DEP-11 Metadata [290 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 Packages [1,518 kB]
Hit:8 https://repo.download.nvidia.cn/jetson/common r32.5 InRelease
Hit:9 https://repo.download.nvidia.cn/jetson/t194 r32.5 InRelease
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 DEP-11 Metadata [284 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe arm64 DEP-11 Metadata [9,292 B]
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-security/main arm64 DEP-11 Metadata [42.7 kB]
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe arm64 DEP-11 Metadata [55.4 kB]
Fetched 4,411 kB in 7s (621 kB/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
139 packages can be upgraded. Run ‘apt list –upgradable’ to see them.
(2). 安装
有不同版本的 ros,我选择完整版。
nvidia@nvidia-desktop:~$ sudo apt install ros-melodic-desktop-full
4. 环境配置
nvidia@nvidia-desktop:~$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
nvidia@nvidia-desktop:~$ source .bashrc
5. 安装依赖
nvidia@nvidia-desktop:~$ sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
nvidia@nvidia-desktop:~$ sudo apt install python-rosdep
6. 测试一下
nvidia@nvidia-desktop:~$ roscore
… logging to /home/nvidia/.ros/log/800a4c34-9b3f-11eb-9514-00044bcbafe8/roslaunch-nvidia-desktop-20063.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://nvidia-desktop:45855/
ros_comm version 1.14.10
SUMMARY
========
PARAMETERS
* /rosdistro: melodic
* /rosversion: 1.14.10
NODES
auto-starting new master
process[master]: started with pid [20074]
ROS_MASTER_URI=http://nvidia-desktop:11311/
setting /run_id to 800a4c34-9b3f-11eb-9514-00044bcbafe8
process[rosout-1]: started with pid [20085]
started core service [/rosout]