Examples for individual ROS2 functionalities inc. Subscribers, Publishers, Timers, Services, Parameters. ...

Overview

ROS2 examples

This example package is meant to explore the possibilities of ROS2 from the point of view of current ROS1 features and how the ROS1 feature translate into the new ROS2 architecture. We investigate the aspects that are currently utilized in MRS UAV System with the intention of a potential future transition.

Meant to be tested on 20.04 Foxy

Minimalistic Examples

Everything is a component. We happily nodelet everything in ROS1, so why otherwise?

  • ServiceClientExample - periodically calls a service
    • TODO retrieving result synchronously. Some solutions are available, none work for me within a component
    • TODO slow and irregular publishing (Timer-driven) with multi-threaded executor (looks like the same problem can appear even with single-threaded executor)
  • PublisherExample - periodically publishes
    • TODO slow and irregular publishing (Timer-driven) with multi-threaded executor (looks like the same problem can appear even with single-threaded executor)
  • ServiceServerExample - getting called, ok
  • SubscriberExample - subscribes, ok
  • TimerExample - runs multiple timers in parallel
    • TODO timer callbacks are not executed in parallel even with multi-threaded container (with multi-threaded executor, looks like the same problem can appear even with single-threaded executor)
  • ParamsExample - load params from yaml and launch file
    • param server callback is hooked up
    • TODO investigate the ros__parameters: namespace, which does not seem to be necessary (and does not work when present)

Running the examples

./tmux/start.sh (change the sourced workspace path in tmux/session.yml)

First ROS2 impressions

  • colcon, the build system... is it really the best we have got? I want my catkin back.
    • creates workspace wherever colcon build is called
    • therefore, cannot build in subdirectories
    • no colcon clean, no colcon init
    • overall not much user friendly
    • immediately aliased it to fix those hurdles
    • TODO workspace-wide profiles with custom flags
  • Sourcing ROS2 workspace
    • ROS2 sourcing
  source /opt/ros/foxy/setup.zsh
  source ~/ros2_workspace/install/setup.zsh
  • if you build ROS2 workspace while ROS1 is sourced, you will need to source ROS1 every time before launching ROS2 programs, otherwise, this error will appear:
[INFO] [launch]: All log files can be found below /home/klaxalk/.ros/log/2021-02-16-09-29-27-258633-klaxalk-desktop2-1671935
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container_mt-1]: process started with pid [1671949]
[component_container_mt-1] [INFO] [1613464167.606666336] [nmspc1_timer_example]: Load Library: /home/klaxalk/ros2_workspace/install/ros2_examples/lib/libtimer_example.so
[component_container_mt-1] /opt/ros/foxy/lib/rclcpp_components/component_container_mt: symbol lookup error: /home/klaxalk/ros2_workspace/install/ros2_examples/lib/libtimer_example.so: undefined symbol: _ZN12class_loader4impl22AbstractMetaObjectBaseC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_
[ERROR] [component_container_mt-1]: process has died [pid 1671949, exit code 127, cmd '/opt/ros/foxy/lib/rclcpp_components/component_container_mt --ros-args -r __node:=nmspc1_timer_example -r __ns:=/'].
[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
  • Topic the subscribers and publisher have to have compatible Quality of Service (QoS) settings -- reliable or best effort. For example RViZ is setting different profile (reliable) that is by default (best effort). QoS
  • mrs_msgs were ported to ROS2
  • ROS bridge installs, compiles, runs (scripts here)
    • TODO check performance and load with images
    • TODO check performance and load high publish rates
  • Why are most examples still using main() when everything in ROS2 should be a component (nodelet)?
  • ComponentContainer
    • try running a component as single node by:
  remap = [('cloud_in', '/livox/lidar')]
  node = Node(package='octomap_server2',
               executable='octomap_server',
               output='screen',
               remappings=remap,
               parameters=[params])
  return LaunchDescription([node])
  • seems like the multi-threaded container (with multi-threaded executor) fails to execute callbacks (at least Timer callbacks) in parallel
  • multi-threaded composer (with multi-threaded executor) produces very uneven and slow rates of timers, Publishing is slow in Docker with MutliThreadedExecutor #1487 (December, 2020)
  • CMakeLists.txt
    • basics are fine
    • TODO building (and using) custom libraries
    • TODO building standalone executable nodelets (should be possible)
  • Launch files
    • they are in python now link
    • remapping, params, nodelets
    • TODO connecting to existing component containers (nodelet managers)
    • TODO launch prefixes (e.g., launching with GDB)
  • Subscribers - work fine, not a big difference from ROS1
    • TODO still problem with multiple callbacks in parallel?
  • Publishers - work fine, not a big difference from ROS1
  • Service client
    • it is asynchronous only!!!!
    • how to make it behave synchronously? wrapper (only in standalone node)
  • Service server - works fine
  • Timers - single timer runs, similarly to ROS1 Timers
  • Parameters
    • basic params work from yaml and launch
    • Beware! loading an empty yaml file causes a long and cryptic error. Solution: add some unused parameter to the file.
    • Nesting is distinguished by "." in the code (it was "/" in ROS1)
    • TODO test overloading multiple configs over each other
    • TODO test more complex types: lists, matrices, ...
  • DRS - has a direct implementation in the default parameters
    • callback hooked to the external change of the parameters works
    • validation of the parameters has to be performed in our code -> we will need a custom wrapper for that, otherwise madness
    • ROS2 rqt_reconfigure is super buggy and wonky, this issue is especially hellish
      • it shows the node's parameters sometimes, seems random
  • why is the terminal output monochromatic? I want my colors back...
    • export RCUTILS_COLORIZED_OUTPUT=1
  • ROS Time
    • TODO test duration, rate, sleep, wall time vs. sim time (we need sim time for faster/slower than real time simulations)
      • To be able to listen sim time, parameter use_sime_time=1 has to be set individually for every node. PR
  • Transformations
    • TODO
    • I really hope that ROS2 will support more than just the TF tree, e.g., an Acyclic graph. We need more parents for a node to allow a robot to being localized within more coordinated systems at a time.
    • What about relativistic transformations? Meaning the frames could have a velocity and, therefore, we could transform a moving object (a ball) from a moving frame (a drone) to a world frame.
  • Tests
    • TODO
  • Pluginlib
    • TODO
  • Actionlib
    • TODO
  • Lifecycles (new feature)
    • TODO
You might also like...
Triton Python and C++ client libraries and example, and client examples for go, java and scala.

Triton Client Libraries and Examples To simplify communication with Triton, the Triton project provides several client libraries and examples of how t

Examples and test programs I made while learning the DPDK.

The DPDK Examples (WIP) Description A small repository I will be using to store my progress and test programs from the DPDK, a kernel bypass library v

Voicemeeter Remote API + Source Code Examples

Voicemeeter-SDK Voicemeeter Remote API + Source Code Examples Voicemeeter Remote API provides a set of functions to control Voicemeeter parameters, to

OTUS C++ course demo day examples

coroutines-epoll-example OTUS C++ course demo day examples Инструкция по сборке Необходимы следующие версии компонентов g++11 cmake = 3.10 git clone

The BNG Blaster is a test tool to simulate thousands of PPPoE or IPoE subscribers including IPTV, traffic verification and convergence testing capabilities.
The BNG Blaster is a test tool to simulate thousands of PPPoE or IPoE subscribers including IPTV, traffic verification and convergence testing capabilities.

RtBrick BNG Blaster The BNG Blaster is a test tool to simulate thousands of PPPoE or IPoE subscribers including IPTV, traffic verification and converg

MINCE is an Emacs-like text editor from Mark of the Unicorn, Inc.

MINCE Is Not Complete[ly] EMACS Overview MINCE is an Emacs-like text editor from Mark of the Unicorn, Inc. Versions were available for many oper

A non-linear trajectory optimization library developed by Optimus Ride, Inc

A non-linear trajectory optimization library developed by Optimus Ride, Inc. This library implements a C++ version of the original open-source ALTRO solver developed by the Robotic Exploration Lab at Stanford and Carnegie Mellon Universities, also available open-source as an official Julia package.

VNN是由欢聚集团(Joyy Inc.)推出的高性能、轻量级神经网络部署框架。目前已为Hago、VOO、VFly、马克相机等App提供20余种AI能力的支持,覆盖直播、短视频、视频编辑等泛娱乐场景和工程场景
VNN是由欢聚集团(Joyy Inc.)推出的高性能、轻量级神经网络部署框架。目前已为Hago、VOO、VFly、马克相机等App提供20余种AI能力的支持,覆盖直播、短视频、视频编辑等泛娱乐场景和工程场景

VNN是由欢聚集团(Joyy Inc.)推出的高性能、轻量级神经网络部署框架。目前已为Hago、VOO、VFly、马克相机等App提供20余种AI能力的支持,覆盖直播、短视频、视频编辑等泛娱乐场景和工程场景

Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all

concurrencpp, the C++ concurrency library concurrencpp is a tasking library for C++ allowing developers to write highly concurrent applications easily

timers and timeline

⏱ Timer and Timeline Utils for C This library provides an easy way to set timers and timeouts. As initial version all timers run in single runloop at

Only algorithms in C and C++ , good for first timers

🎉 Hacktoberfest-2021 - The C Algo Party is Here !!! 🎉 Another year, another Hacktoberfest 2021. I create this repo to help you in the Algorithm less

Software emulated serial using hardware timers for improved compatibility
Software emulated serial using hardware timers for improved compatibility

AltSoftSerial Library Improved software emulated serial, using hardware timers for precise signal timing and availability of CPU time for other librar

Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

🔖 Index What is Libft? List of Functions Technologies ✨ What is Libft? Libft is an individual project at 42 that requires us to re-create some standa

Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.
Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

A universal type for non-type template parameters for C++20 or later.

uninttp A universal type for non-type template parameters for C++20 or later. Installation: uninttp (Universal Non-Type Template Parameters) is a head

A console application using CPP that manages the guest details and check in and quarantine period of individual

A console application using CPP that manages the guest details and check in and quarantine period of individual(14 days). Efficient searching of guest, sorting and availability of room details can be found using the applications.

A collection of individual tools to randomize bdsp sheets

BDSP_Randomisers A collection of tools to randomize BDSP assets Setup (Windows 10 only) Install Ubuntu 18.04 via WSL1 (plenty of tutorials on that) In

This package estimates the calibration parameters that transforms the camera frame (parent) into the lidar frame (child)
This package estimates the calibration parameters that transforms the camera frame (parent) into the lidar frame (child)

Camera-LiDAR Calibration This package estimates the calibration parameters that transforms the camera frame (parent) into the lidar frame (child). We

Comments
  • service_client_example.cpp callback return

    service_client_example.cpp callback return

    In the service client example I notice that you added a callback for the service response future.

    This callback is not void, actually a boolean where a result of true or false can be returned.

    My question is how does anyone invoke any action based on the return of the callback function (true or false) because it is called by the service client itself when the response future is ready.

    Thanks, H

    opened by HarrisonBT 3
  • Synchronous service call

    Synchronous service call

    In ros2_examples/src/service_client_example.cpp you wrote that

    status = result.wait_for(std::chrono::seconds(1));
    

    "BLOCKS THE WHOLE NODE FROM GETTING CALLBACK".

    Is there the same issue with

    status = result.wait_for(std::chrono::seconds(0));
    std::this_thread::sleep_for(std::chrono::seconds(1)));
    

    ?

    opened by galou 2
  • ROS2 xml launch files

    ROS2 xml launch files

    Launch files can be written in Python, but also in xml, see also this tutorial: https://index.ros.org/doc/ros2/Tutorials/Launch-files-migration-guide/

    The syntax changed though :(

    opened by Rayman 1
Owner
Multi-robot Systems (MRS) group at Czech Technical University in Prague
Multi-robot Systems (MRS) group at Czech Technical University in Prague
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 7.2k Dec 30, 2022
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.

evpp Introduction 中文说明 evpp is a modern C++ network library for developing high performance network services using TCP/UDP/HTTP protocols. evpp provid

Qihoo 360 3.2k Jan 5, 2023
Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.

Wangle C++ networking library Wangle is a library that makes it easy to build protocols, application clients, and application servers. It's like Netty

Facebook 2.9k Jan 8, 2023
The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.

InitWare isn't ready to use yet!! Unless you are doing so for fun, to experiment, or to contribute, you most likely do not want to try to install Init

null 164 Dec 21, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.2k Jan 2, 2023
Enabling services on your device 81 Jan 6, 2023
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 48 Oct 13, 2022
A C++ async HTTP client library to use in asynchronous applications while communicating with REST services.

libashttp An asynchronous HTTP library using Boost.ASIO as the backend. This project is licensed under: Usage Here is a example usage which is taken f

Tolga Hoşgör 53 Dec 17, 2022
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
C++ ChrysaLisp services and messaging.

ChrysaLib C++ ChrysaLib ! A version of ChrysaLisp system concepts written in C++. Dependencies Mac via Brew brew install libusb asio Linux via apt-get

Chris Hinsley 3 Jan 10, 2022