0
$\begingroup$

Rosanswers logo

Hi,

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");
        rate.sleep();
    }

    rclcpp::shutdown();
    node = nullptr;
    return 0;
}

Originally posted by alsora on ROS Answers with karma: 1322 on 2019-03-06

Post score: 0


Original comments

Comment by nburek on 2019-03-07:
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.

Comment by alsora on 2019-03-07:
No, I'm using a Dockerfile where the only installed ROS2 packages are these ones https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos

Comment by alsora on 2019-03-11:
Is the rcl_logging_log4cxx package required for this?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by alsora with karma: 1322 on 2019-03-13

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.