Maintaining a source checkout of ROS 2 Rolling
如果您是从源文件安装的ROS 2,则自源文件检出以来,可能已经对其进行了更改。为了使检出的源文件保持最新,您必须定期的更新您的 ros2.repos
文件,下载最新的源文件,并重新编译您的工作区。 [Alyssa@5439]
更新您的仓库列表
每个ROS 2的发行版本都包含一个 ros2.repos
文件,其中包含这个发行版所需的仓库及其版本的列表。 [Alyssa@5441]
发布版本 [待校准@5442]
如果您希望更新特定版本,可以通过在以下步骤的URL中指定该版本的代号 (例如foxy) 来获取其仓库列表: [待校准@5443]
cd ~/ros2_ws
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/foxy-release/ros2.repos
cd ~/ros2_ws
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/foxy-release/ros2.repos
# CMD
cd \dev\ros2
curl -sk https://raw.githubusercontent.com/ros2/ros2/foxy-release/ros2.repos -o ros2.repos
# PowerShell
cd \dev\ros2
curl https://raw.githubusercontent.com/ros2/ros2/foxy-release/ros2.repos -o ros2.repos
发行版的名称格式是与发行版 here 相关联的标签。 [Alyssa@5447]
发布的开发版本分支 [Alyssa@5448]
如果您希望检出特定版本的开发版分支,可以通过在以下步骤的URL (例如foxy) 中指定发行版的代号来获取其仓库列表: [Alyssa@5449]
cd ~/ros2_ws
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
cd ~/ros2_ws
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
# CMD
cd \dev\ros2
curl -sk https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos -o ros2.repos
# PowerShell
cd \dev\ros2
curl https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos -o ros2.repos
Latest ROS 2 Rolling branches
If you wish to checkout the latest code for ROS 2 Rolling, you can get the relevant repository list by running:
cd ~/ros2_rolling
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
cd ~/ros2_rolling
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
# CMD
cd \dev\ros2_rolling
curl -sk https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos -o ros2.repos
# PowerShell
cd \dev\ros2_rolling
curl https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos -o ros2.repos
更新您的仓库
You will notice that in the ros2.repos file, each repository has a version
associated with it that points to a particular commit hash, tag, or branch name.
It is possible that these versions refer to new tags/branches that your local copy of the repositories will not recognize as they are out-of-date.
Because of this, you should update the repositories that you have already checked out with the following command:
vcs custom --args remote update
下载新的源文件代码 [待校准@5454]
现在,您应该可以通过以下方式下载与新仓库列表关联的源文件: [待校准@5455]
vcs import src < ros2.repos
vcs pull src
vcs import src < ros2.repos
vcs pull src
# CMD
vcs import src < ros2.repos
vcs pull src
# PowerShell
vcs import --input ros2.repos src
vcs pull src
重新编译您的工作空间 [Alyssa@5456]
现在工作空间已经更新了源文件,请删除以前的install文件并使用以下命令重新编译工作空间: [Alyssa@5457]
colcon build --symlink-install
检查您的源文件检出 [待校准@5458]
在开发期间,您的工作空间可能已经偏离了导入仓库列表时的原始状态。如果您想知道工作空间中仓库集的版本,可以使用以下命令导出信息: [Alyssa@5459]
cd ~/ros2_rolling
vcs export src > my_ros2.repos
cd ~/ros2_rolling
vcs export src > my_ros2.repos
cd \dev\ros2_rolling
vcs export src > my_ros2.repos
该 my_ros2.repos
文件可以与其他人共享,以便他们可以重现您工作空间中的仓库状态。 [Alyssa@5460]