How to create custom topic?
I want to create custom topic to visualize data from sensors.
I want to create custom topic to visualize data from sensors.
Create a gazebo node:
gznode_ = gazebo::transport::NodePtr(new gazebo::transport::Node());
and advertise a new publisher:
pub = gznode_->Advertise<gazebo::msgs::"message_type">("custom_topic_name");
change "message_type" and custom_topic_name to your own needs. Now you can publish a message by:
pub->Publish(msg);
The types depend on the Gazebo Version you are using. For all versions < 9 you need to include:
#include "gazebo/transport/transport.hh"
and the variable declaration look like this:
gazebo::transport::NodePtr gznode_;
gazebo::transport::PublisherPtr pub;
Asked: 2018-07-11 08:34:03 -0600
Seen: 326 times
Last updated: Aug 15 '18
Information from Topic Visualization to a text file ?
How to avoid Queue limit reached warning when subscribing to a topic.
How to get image of wide-angle camera
How to ECHO an specific field of the link_states topic?
How to pass the topic data to external application directly via not ROS2
How to modify a model plugin to publish data to a rostopic or ros node?
How to receive position feedback from joints?
Neither "gz topic --hz ~/scene" nor "gz topic --echo ~/scene" work