初探Ros2

Related tech arcicles

Design

 ROS1 vs ROS2, Practical Overview For ROS Developers - The Robotics Back-End


Summary

1.The ROS API – rclcpp, rclpy

In ROS1, for Cpp you use roscpp, and for Python, rospy. Both libraries are completely independent and built from scratch. It means that the API is not necessarily the same between roscpp and rospy, and some features are developed for one, and not the other. (Really bad!)

ROS2 has more layers. There is only one base library, named rcl, and implemented in C. This is the foundation which contains all of the ROS2 core features.

You won’t use the rcl library directly in your programs. You’ll use another client library built on top of rcl. For example: rclcpp for Cpp, rclpy for Python.

What’s great about it? Well any new functionality only needs to be implemented with rcl. Then, the client libraries on top of rcl just need to provide the binding.

For you, as a developer, it means that:

  • The API between rclcpp and rclpy will be much more similar than the API between roscpp and rospy.
  • It will be easier to create and use other language client libraries, for example rclnodejs, rcljava, etc. No need to reinvent the wheel, you just need to make a C binding with rcl. And all clients in all languages will have a similar API.
  • When a new core feature is released, it will be available sooner in different languages, so you won’t have to wait too much.

2. No more ROS master

One thing you’ve learned with ROS1: always start a ROS master before you run a node. The ROS1 master will act as a DNS server for your nodes, so they can retrieve each other.

In ROS2, no more ROS master! This is no more a centralized system. Each node has the capacity to discover other nodes. You can simply start a node without having to worry if you have a master running or not.

This change is great because it allows you to create a fully distributed system. Each node is independent and not tight to a global master.

When creating a multi-machine ROS2 application, you won’t have to define one machine as the “master”. Each machine will be independent and able to start on its own, connect and disconnect with each other, with less setup than in ROS1.
 

3. Building your nodes

The build system in ROS1 is catkin. You use “catkin_make” or “catkin build” in order to build and install your packages.

In ROS2, no more catkin. Ament is the new building system, and on top of that you get the colcon command line tool.

To compile, you’ll use the command “colcon build” in your ROS2 workspace.

4...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

First Snowflakes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值