Create a new topic
I'm reading some distances and I want to use them to make a controller, so I read that the best way is to create a new topic, publish there the distances and subscribe to that topic with another node. I'm using Python.
How can I create a new topic? I mean, I have a lot of topics but I need one more
Edit: the topic would receive 7 positions/orientations from a marker: marker.pose.pose.position.x, marker.pose.pose.position.y, marker.pose.pose.position.z, marker.pose.pose.orientation.x, marker.pose.pose.orientation.y, marker.pose.pose.orientation.z, marker.pose.pose.orientation.w
I hate to say it. But if you work through the python publisher tutorial it shows you exactly how to do this.
No, it doesnt say how to create a new TOPIC. I invented a possible solution but its not optimal
@PeteBlackerThe3rd is right, as soon as you create a publisher on a topic even if there are no nodes subscribed to it, it is created, hence it's a new topic.
According to your edit you just need to publish a
geometry_msgs/Pose
. Why does this solution isn't what you want ?To be clear you don't actively create and destroy topics. Simply publishing or subscribing to that topic name brings it into existence.