• ROS2-IRON Ubuntu-22.0 源码下载失败解决方法 vcs import --input


    一.ROS2 IRON环境搭建

    虚拟机系统:Ubuntu22.04
    虚拟机:VMware-player-full-16.2.5-20904516 (这个是非商用就可以免费使用的哦)
    电脑系统:WIN10
    以下操作都是在虚拟机下的Ubuntu22.04环境中。
    详细步骤参考ROS2官网

    1.设置系统字符集为UTF-8
    locale  # check for UTF-8
    
    sudo apt update && sudo apt install locales
    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
    
    locale  # verify settings
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    2.将RO2 apt 库添加到系统中
    sudo apt install software-properties-common
    sudo add-apt-repository universe
    
    • 1
    • 2
    3.添加ROS2 GPG key
    sudo apt update && sudo apt install curl -y
    sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
    
    • 1
    • 2
    4.添加ROS 2 的软件源

    这个命令的作用是将 ROS 2 的软件源添加到/etc/apt/sources.list.d/ros2.list 文件中。这样系统就可以从这个源中获取 ROS 2 相关的软件包。

    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
    
    • 1
    安装开发工具
    sudo apt update && sudo apt install -y \
      python3-flake8-docstrings \
      python3-pip \
      python3-pytest-cov \
      python3-flake8-blind-except \
      python3-flake8-builtins \
      python3-flake8-class-newline \
      python3-flake8-comprehensions \
      python3-flake8-deprecated \
      python3-flake8-import-order \
      python3-flake8-quotes \
      python3-pytest-repeat \
      python3-pytest-rerunfailures \
      ros-dev-tools
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    二.下载ROS2sh源代码

    创建ros2_iron/src目录,并下载相关源码。

    mkdir -p ~/ros2_iron/src
    cd ~/ros2_iron
    vcs import --input https://raw.githubusercontent.com/ros2/ros2/iron/ros2.repos src
    
    • 1
    • 2
    • 3

    这一步我尝试了很多方法,各种换源。但是因为电脑不能翻墙的原因,一直下失败。我的解决方法是在浏览器中访问

    https://raw.githubusercontent.com/ros2/ros2/iron/ros2.repos

    可以看到以下信息:

    repositories:
     ament/ament_cmake:
       type: git
       url: https://github.com/ament/ament_cmake.git
       version: iron
     ament/ament_index:
       type: git
       url: https://github.com/ament/ament_index.git
       version: iron
     ament/ament_lint:
       type: git
       url: https://github.com/ament/ament_lint.git
       version: iron
     ament/ament_package:
       type: git
       url: https://github.com/ament/ament_package.git
       version: iron
     ament/google_benchmark_vendor:
       type: git
       url: https://github.com/ament/google_benchmark_vendor.git
       version: iron
     ament/googletest:
       type: git
       url: https://github.com/ament/googletest.git
       version: iron
     ament/uncrustify_vendor:
       type: git
       url: https://github.com/ament/uncrustify_vendor.git
       version: iron
     eProsima/Fast-CDR:
       type: git
       url: https://github.com/eProsima/Fast-CDR.git
       version: v1.0.27
     eProsima/Fast-DDS:
       type: git
       url: https://github.com/eProsima/Fast-DDS.git
       version: 2.10.x
     eProsima/foonathan_memory_vendor:
       type: git
       url: https://github.com/eProsima/foonathan_memory_vendor.git
       version: master
     eclipse-cyclonedds/cyclonedds:
       type: git
       url: https://github.com/eclipse-cyclonedds/cyclonedds.git
       version: releases/0.10.x
     eclipse-iceoryx/iceoryx:
       type: git
       url: https://github.com/eclipse-iceoryx/iceoryx.git
       version: release_2.0
     gazebo-release/gz_cmake2_vendor:
       type: git
       url: https://github.com/gazebo-release/gz_cmake2_vendor.git
       version: iron
     gazebo-release/gz_math6_vendor:
       type: git
       url: https://github.com/gazebo-release/gz_math6_vendor.git
       version: iron
     osrf/osrf_pycommon:
       type: git
       url: https://github.com/osrf/osrf_pycommon.git
       version: master
     osrf/osrf_testing_tools_cpp:
       type: git
       url: https://github.com/osrf/osrf_testing_tools_cpp.git
       version: iron
     ros-perception/image_common:
       type: git
       url: https://github.com/ros-perception/image_common.git
       version: iron
     ros-perception/laser_geometry:
       type: git
       url: https://github.com/ros-perception/laser_geometry.git
       version: iron
     ros-planning/navigation_msgs:
       type: git
       url: https://github.com/ros-planning/navigation_msgs.git
       version: iron
     ros-tooling/keyboard_handler:
       type: git
       url: https://github.com/ros-tooling/keyboard_handler.git
       version: iron
     ros-tooling/libstatistics_collector:
       type: git
       url: https://github.com/ros-tooling/libstatistics_collector.git
       version: iron
     ros-visualization/interactive_markers:
       type: git
       url: https://github.com/ros-visualization/interactive_markers.git
       version: iron
     ros-visualization/python_qt_binding:
       type: git
       url: https://github.com/ros-visualization/python_qt_binding.git
       version: iron
     ros-visualization/qt_gui_core:
       type: git
       url: https://github.com/ros-visualization/qt_gui_core.git
       version: iron
     ros-visualization/rqt:
       type: git
       url: https://github.com/ros-visualization/rqt.git
       version: iron
     ros-visualization/rqt_action:
       type: git
       url: https://github.com/ros-visualization/rqt_action.git
       version: iron
     ros-visualization/rqt_bag:
       type: git
       url: https://github.com/ros-visualization/rqt_bag.git
       version: iron
     ros-visualization/rqt_console:
       type: git
       url: https://github.com/ros-visualization/rqt_console.git
       version: iron
     ros-visualization/rqt_graph:
       type: git
       url: https://github.com/ros-visualization/rqt_graph.git
       version: iron
     ros-visualization/rqt_msg:
       type: git
       url: https://github.com/ros-visualization/rqt_msg.git
       version: iron
     ros-visualization/rqt_plot:
       type: git
       url: https://github.com/ros-visualization/rqt_plot.git
       version: iron
     ros-visualization/rqt_publisher:
       type: git
       url: https://github.com/ros-visualization/rqt_publisher.git
       version: iron
     ros-visualization/rqt_py_console:
       type: git
       url: https://github.com/ros-visualization/rqt_py_console.git
       version: iron
     ros-visualization/rqt_reconfigure:
       type: git
       url: https://github.com/ros-visualization/rqt_reconfigure.git
       version: iron
     ros-visualization/rqt_service_caller:
       type: git
       url: https://github.com/ros-visualization/rqt_service_caller.git
       version: iron
     ros-visualization/rqt_shell:
       type: git
       url: https://github.com/ros-visualization/rqt_shell.git
       version: iron
     ros-visualization/rqt_srv:
       type: git
       url: https://github.com/ros-visualization/rqt_srv.git
       version: iron
     ros-visualization/rqt_topic:
       type: git
       url: https://github.com/ros-visualization/rqt_topic.git
       version: iron
     ros-visualization/tango_icons_vendor:
       type: git
       url: https://github.com/ros-visualization/tango_icons_vendor.git
       version: iron
     ros/class_loader:
       type: git
       url: https://github.com/ros/class_loader.git
       version: iron
     ros/kdl_parser:
       type: git
       url: https://github.com/ros/kdl_parser.git
       version: iron
     ros/pluginlib:
       type: git
       url: https://github.com/ros/pluginlib.git
       version: iron
     ros/resource_retriever:
       type: git
       url: https://github.com/ros/resource_retriever.git
       version: iron
     ros/robot_state_publisher:
       type: git
       url: https://github.com/ros/robot_state_publisher.git
       version: iron
     ros/ros_environment:
       type: git
       url: https://github.com/ros/ros_environment.git
       version: iron
     ros/ros_tutorials:
       type: git
       url: https://github.com/ros/ros_tutorials.git
       version: iron
     ros/urdfdom:
       type: git
       url: https://github.com/ros/urdfdom.git
       version: iron
     ros/urdfdom_headers:
       type: git
       url: https://github.com/ros/urdfdom_headers.git
       version: iron
     ros2/ament_cmake_ros:
       type: git
       url: https://github.com/ros2/ament_cmake_ros.git
       version: iron
     ros2/common_interfaces:
       type: git
       url: https://github.com/ros2/common_interfaces.git
       version: iron
     ros2/console_bridge_vendor:
       type: git
       url: https://github.com/ros2/console_bridge_vendor.git
       version: iron
     ros2/demos:
       type: git
       url: https://github.com/ros2/demos.git
       version: iron
     ros2/eigen3_cmake_module:
       type: git
       url: https://github.com/ros2/eigen3_cmake_module.git
       version: iron
     ros2/example_interfaces:
       type: git
       url: https://github.com/ros2/example_interfaces.git
       version: iron
     ros2/examples:
       type: git
       url: https://github.com/ros2/examples.git
       version: iron
     ros2/geometry2:
       type: git
       url: https://github.com/ros2/geometry2.git
       version: iron
     ros2/launch:
       type: git
       url: https://github.com/ros2/launch.git
       version: iron
     ros2/launch_ros:
       type: git
       url: https://github.com/ros2/launch_ros.git
       version: iron
     ros2/libyaml_vendor:
       type: git
       url: https://github.com/ros2/libyaml_vendor.git
       version: iron
     ros2/message_filters:
       type: git
       url: https://github.com/ros2/message_filters.git
       version: iron
     ros2/mimick_vendor:
       type: git
       url: https://github.com/ros2/mimick_vendor.git
       version: iron
     ros2/orocos_kdl_vendor:
       type: git
       url: https://github.com/ros2/orocos_kdl_vendor.git
       version: iron
     ros2/performance_test_fixture:
       type: git
       url: https://github.com/ros2/performance_test_fixture.git
       version: iron
     ros2/pybind11_vendor:
       type: git
       url: https://github.com/ros2/pybind11_vendor.git
       version: iron
     ros2/python_cmake_module:
       type: git
       url: https://github.com/ros2/python_cmake_module.git
       version: iron
     ros2/rcl:
       type: git
       url: https://github.com/ros2/rcl.git
       version: iron
     ros2/rcl_interfaces:
       type: git
       url: https://github.com/ros2/rcl_interfaces.git
       version: iron
     ros2/rcl_logging:
       type: git
       url: https://github.com/ros2/rcl_logging.git
       version: iron
     ros2/rclcpp:
       type: git
       url: https://github.com/ros2/rclcpp.git
       version: iron
     ros2/rclpy:
       type: git
       url: https://github.com/ros2/rclpy.git
       version: iron
     ros2/rcpputils:
       type: git
       url: https://github.com/ros2/rcpputils.git
       version: iron
     ros2/rcutils:
       type: git
       url: https://github.com/ros2/rcutils.git
       version: iron
     ros2/realtime_support:
       type: git
       url: https://github.com/ros2/realtime_support.git
       version: iron
     ros2/rmw:
       type: git
       url: https://github.com/ros2/rmw.git
       version: iron
     ros2/rmw_connextdds:
       type: git
       url: https://github.com/ros2/rmw_connextdds.git
       version: iron
     ros2/rmw_cyclonedds:
       type: git
       url: https://github.com/ros2/rmw_cyclonedds.git
       version: iron
     ros2/rmw_dds_common:
       type: git
       url: https://github.com/ros2/rmw_dds_common.git
       version: iron
     ros2/rmw_fastrtps:
       type: git
       url: https://github.com/ros2/rmw_fastrtps.git
       version: iron
     ros2/rmw_implementation:
       type: git
       url: https://github.com/ros2/rmw_implementation.git
       version: iron
     ros2/ros2_tracing:
       type: git
       url: https://github.com/ros2/ros2_tracing.git
       version: iron
     ros2/ros2cli:
       type: git
       url: https://github.com/ros2/ros2cli.git
       version: iron
     ros2/ros2cli_common_extensions:
       type: git
       url: https://github.com/ros2/ros2cli_common_extensions.git
       version: iron
     ros2/ros_testing:
       type: git
       url: https://github.com/ros2/ros_testing.git
       version: iron
     ros2/rosbag2:
       type: git
       url: https://github.com/ros2/rosbag2.git
       version: iron
     ros2/rosidl:
       type: git
       url: https://github.com/ros2/rosidl.git
       version: iron
     ros2/rosidl_core:
       type: git
       url: https://github.com/ros2/rosidl_core.git
       version: iron
     ros2/rosidl_dds:
       type: git
       url: https://github.com/ros2/rosidl_dds.git
       version: iron
     ros2/rosidl_defaults:
       type: git
       url: https://github.com/ros2/rosidl_defaults.git
       version: iron
     ros2/rosidl_dynamic_typesupport:
       type: git
       url: https://github.com/ros2/rosidl_dynamic_typesupport
       version: iron
     ros2/rosidl_dynamic_typesupport_fastrtps:
       type: git
       url: https://github.com/ros2/rosidl_dynamic_typesupport_fastrtps
       version: iron
     ros2/rosidl_python:
       type: git
       url: https://github.com/ros2/rosidl_python.git
       version: iron
     ros2/rosidl_runtime_py:
       type: git
       url: https://github.com/ros2/rosidl_runtime_py.git
       version: iron
     ros2/rosidl_typesupport:
       type: git
       url: https://github.com/ros2/rosidl_typesupport.git
       version: iron
     ros2/rosidl_typesupport_fastrtps:
       type: git
       url: https://github.com/ros2/rosidl_typesupport_fastrtps.git
       version: iron
     ros2/rpyutils:
       type: git
       url: https://github.com/ros2/rpyutils.git
       version: iron
     ros2/rviz:
       type: git
       url: https://github.com/ros2/rviz.git
       version: iron
     ros2/spdlog_vendor:
       type: git
       url: https://github.com/ros2/spdlog_vendor.git
       version: iron
     ros2/sros2:
       type: git
       url: https://github.com/ros2/sros2.git
       version: iron
     ros2/system_tests:
       type: git
       url: https://github.com/ros2/system_tests.git
       version: iron
     ros2/test_interface_files:
       type: git
       url: https://github.com/ros2/test_interface_files.git
       version: iron
     ros2/tinyxml2_vendor:
       type: git
       url: https://github.com/ros2/tinyxml2_vendor.git
       version: iron
     ros2/tinyxml_vendor:
       type: git
       url: https://github.com/ros2/tinyxml_vendor.git
       version: iron
     ros2/tlsf:
       type: git
       url: https://github.com/ros2/tlsf.git
       version: iron
     ros2/unique_identifier_msgs:
       type: git
       url: https://github.com/ros2/unique_identifier_msgs.git
       version: iron
     ros2/urdf:
       type: git
       url: https://github.com/ros2/urdf.git
       version: iron
     ros2/yaml_cpp_vendor:
       type: git
       url: https://github.com/ros2/yaml_cpp_vendor.git
       version: iron
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425

    url对应的就是github上所在的源代码。把github上的这些源代码仓库转移到gitee上,这个gitee提供了这一部分的功能。
    在ros2_iron路径下,用vim新建ros2.repos文件。

    vim ros2.repos 
    
    • 1

    vim 在normal模式下,输入"+p将https://raw.githubusercontent.com/ros2/ros2/iron/ros2.repos中的内容复制到本地(前提是已经复制到系统内存中了,才能使用这个命令)。用vim查找替换url地址。

    :%s/https\/\/github.com\/\(.*\)\//gitee.com:makuswork\//g
    
    • 1

    这样本地中ros2.repos中的url中的内容全部修改成我自己的gitee仓库中了。我把地址改成了ssh的通信。下载源代码时就不用一直的输入帐号和密码了。保存关闭。

    在ros2_iron路径下

    vcs import --input ros2.repos src
    
    • 1

    ros2sourcecodedownload
    请添加图片描述

    编译
    sudo apt upgrade
    
    • 1
    sudo rosdep init
    rosdep update
    rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
    
    • 1
    • 2
    • 3
    colcon build --symlink-install
    
    • 1

    如果编译报错,EasyInstallDeprecationWarning,可以参考colcon build --symlink-install ,编译失败解决方法

  • 相关阅读:
    数据标注工具 Label-Studio
    在centos7上搭建hadoop大数据平台
    外设驱动库开发笔记43:GPIO模拟SPI驱动
    【微机接口】中断系统:中断响应和处理的过程
    【面试指南】AI算法面试
    持续集成和持续部署(CI/CD)
    驱动通信:通过PIPE管道与内核层通信
    智慧酒店解决方案-最新全套文件
    OneNote 教程,如何在 OneNote 中创建更多空间?
    spring cloud 工程管理系统源码+二次开发+定制化服务
  • 原文地址:https://blog.csdn.net/m0_49302377/article/details/132693496