ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to enable rosout topic in ROS2?

asked 2019-03-06 08:03:29 -0600

alsora gravatar image


I wanted to try the rosout feature of ROS2.

I built everything from the master branch.

I have a node which continuously logs data. However, there is not rosout topic when I run ros2 topic list. I also tried to use the CLI argument __log_disable_rosout:=false but it does not change the result.

What should I do in order to visualize logs on rosout?

#include "rclcpp/rclcpp.hpp"
#include <memory>
#include <string>

int main(int argc, char ** argv)

    // initialize ros2 and create a node
    rclcpp::init(argc, argv);
    rclcpp::Node::SharedPtr node = rclcpp::Node::make_shared("simple_node");

    rclcpp::WallRate rate(10);
    while (rclcpp::ok()){
        RCLCPP_WARN(node->get_logger(), "This is a RCLCPP_WARN message");

    node = nullptr;
    return 0;
edit retag flag offensive close merge delete


This is a little odd because rosout should be enabled by default if you're building ROS2 from master now.

When you say you built everything from the master branch do you mean that you're doing a complete build from source of all the ROS 2 packages or that you just built rcutils, rcl, and rclcpp? Make sure you're remembering to source the new build if you're creating an overlay.

Do you have an existing release of ROS 2 sourced from somewhere else already? I've had issues building just rclcpp, rcl, and rcutils in a workspace when I already have ROS 2 sourced because colcon wants to use the dependencies from the sourced version instead of the local workspace. So rclcpp ends up building with the older version of rcl that doesn't have rosout logging in it.

nburek gravatar image nburek  ( 2019-03-07 12:16:48 -0600 )edit

No, I'm using a Dockerfile where the only installed ROS2 packages are these ones

alsora gravatar image alsora  ( 2019-03-07 12:21:53 -0600 )edit

Is the rcl_logging_log4cxx package required for this?

alsora gravatar image alsora  ( 2019-03-11 05:57:39 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-13 05:16:27 -0600

alsora gravatar image

Building everything again from scratches worked as a solution to my problem.

Logging to rosout topic is automatically enabled. It can be disabled using the __log_disable_rosout:=true command line argument.

The system dependency liblog4cxx-dev and the related ROS2 package rcl_logging_log4cxx are not needed in order to use this feature.

edit flag offensive delete link more

Question Tools



Asked: 2019-03-06 08:03:29 -0600

Seen: 1,336 times

Last updated: Mar 13 '19