Summary.
I am trying to use roslibpy to publish and subscribe custom messages to/ from a ROS machine.
I try to publish on a custom topic using a custom_message but it doesnt work.
Expected Result
I had expected that when I use rostopic list command on my ROS machine, then it should have showed me /custom_topic in the list but unfortunately it doesnt.
Am I missing something here
Actual Result
It shows me the default 2 topics i.e. /rosout and /rosout_agg
Reproduction Steps
This is my sample code :
`from __future__ import print_function
import time
import roslibpy
from roslibpy import Message, Ros, Topic
def run_topic_pub():
print('entering run_topic_pub')
ros = roslibpy.Ros(host='172.17.0.2', port=9090)
publisher = Topic(ros, '/custom_topic', 'custom_message/float32')
def start_sending():
while True:
if not ros.is_connected:
break
publisher.publish(Message({'data': '1'}))
time.sleep(0.1)
publisher.unadvertise()
ros.on_ready(lambda: print('Is ROS connected ?', ros.is_connected))
ros.on_ready(start_sending, run_in_thread=True)
ros.get_topics(print)
ros.run_forever()
if __name__ == '__main__':
print('main')
run_topic_pub()
`
System Information
Linux (ubuntu 16.04), ROS Melodic
Summary.
I am trying to use roslibpy to publish and subscribe custom messages to/ from a ROS machine.
I try to publish on a custom topic using a custom_message but it doesnt work.
Expected Result
I had expected that when I use
rostopic listcommand on my ROS machine, then it should have showed me/custom_topicin the list but unfortunately it doesnt.Am I missing something here
Actual Result
It shows me the default 2 topics i.e. /rosout and /rosout_agg
Reproduction Steps
System Information
Linux (ubuntu 16.04), ROS Melodic