版本对应关系

UbuntuROSGazebo
16.04ROS KineticGazebo 7.x
18.04ROS MelodicGazebo 9.x
20.04ROS NoeticGazebo 11.x
18.04ROS2 DashingGazebo 9.x
18.04ROS2 EloquentGazebo 9.x
20.04ROS2 FoxyGazebo 11.x

. ~/ros2_foxy/install/local_setup.bash source /opt/ros/foxy/setup.bash

ROS与ROS2之间的切换

  • 使用ROS,修改.bashrc:
    source /opt/ros/noetic/setup.bash
    source ~/catkin_ws/devel/setup.bash
    
  • 使用ROS2,修改.bashrc:
    source /opt/ros/foxy/setup.bash
    source ~/dev_ws/install/setup.bash
    

Setup

从ROS升级至ROS2,包的配置

  • 官方
  • AWS提供的工具?
  • 官方Checklist:
    • package.xml如果用的是format1要升级为format 2
    • 删除<metapackage /> tag
    • msgsrvaction
    • 用colcon替代catkin
      • 编译时用colcon命令
      • ?Python包的处理
      • 在CmakeLists.txt中
        • 修改package.xml中的export section
          <export>
            <build_type>ament_cmake</build_type>
          </export>
          
        • 修改find_package
          • find_package(catkin REQUIRED) -> find_package(ament_cmake REQUIRED)
          • ?component可能也要根据情况进行修改?(如果有对应的ROS2升级本本的话)
  • Move and update the catkin_package invocation with:
    • Invoke ament_package instead but after all targets have been registered.
    • The only valid argument for ament_package is CONFIG_EXTRAS. All other arguments are covered by separate functions which all need to be invoked before ament_package:
      • Instead of passing CATKIN_DEPENDS … call ament_export_dependencies(…) before.
      • Instead of passing INCLUDE_DIRS … call ament_export_include_directories(…) before.
      • Instead of passing LIBRARIES … call ament_export_libraries(…) before.
    • TODO document ament_export_targets (ament_export_interfaces in Eloquent and older)?
  • Replace the invocation of add_message_files, add_service_files and generate_messages with rosidl_generate_interfaces.
    • The first argument is the target_name. If you’re building just one library it’s ${PROJECT_NAME}
    • Followed by the list of message filenames, relative to the package root.
      • If you will be using the list of filenames multiple times, it is recommended to compose a list of message files and pass the list to the function for clarity.
    • The final multi-value-keyword argument fpr generate_messages is DEPENDENCIES which requires the list of dependent message packages.
rosidl_generate_interfaces(${PROJECT_NAME}
 ${msg_files}
 DEPENDENCIES std_msgs
)
  • Remove any occurrences of the devel space. Related CMake variables like CATKIN_DEVEL_PREFIX do not exist anymore.
    • The CATKIN_DEPENDS and DEPENDS arguments are passed to the new function ament_export_dependencies.
    • CATKIN_GLOBAL_BIN_DESTINATION: bin
    • CATKIN_GLOBAL_INCLUDE_DESTINATION: include
    • CATKIN_GLOBAL_LIB_DESTINATION: lib
    • CATKIN_GLOBAL_LIBEXEC_DESTINATION: lib
    • CATKIN_GLOBAL_SHARE_DESTINATION: share
    • CATKIN_PACKAGE_BIN_DESTINATION: lib/${PROJECT_NAME}
    • CATKIN_PACKAGE_INCLUDE_DESTINATION: include/${PROJECT_NAME}
    • CATKIN_PACKAGE_LIB_DESTINATION: lib
    • CATKIN_PACKAGE_SHARE_DESTINATION: share/${PROJECT_NAME}