How to enable rosout topic in ROS2?
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;
}
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.
No, I'm using a Dockerfile where the only installed ROS2 packages are these ones
https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
Is the
rcl_logging_log4cxx
package required for this?