{"action":"created","issue":{"url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/11","repository_url":"https://api.github.com/repos/gramaziokohler/roslibpy","labels_url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/11/comments","events_url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/11/events","html_url":"https://github.com/gramaziokohler/roslibpy/issues/11","id":365400438,"node_id":"MDU6SXNzdWUzNjU0MDA0Mzg=","number":11,"title":"Publishing and subscribing on custom messages","user":{"login":"aakashsehgal","id":36532026,"node_id":"MDQ6VXNlcjM2NTMyMDI2","avatar_url":"https://avatars0.githubusercontent.com/u/36532026?v=4","gravatar_id":"","url":"https://api.github.com/users/aakashsehgal","html_url":"https://github.com/aakashsehgal","followers_url":"https://api.github.com/users/aakashsehgal/followers","following_url":"https://api.github.com/users/aakashsehgal/following{/other_user}","gists_url":"https://api.github.com/users/aakashsehgal/gists{/gist_id}","starred_url":"https://api.github.com/users/aakashsehgal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakashsehgal/subscriptions","organizations_url":"https://api.github.com/users/aakashsehgal/orgs","repos_url":"https://api.github.com/users/aakashsehgal/repos","events_url":"https://api.github.com/users/aakashsehgal/events{/privacy}","received_events_url":"https://api.github.com/users/aakashsehgal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-10-01T10:32:21Z","updated_at":"2018-10-18T16:01:03Z","closed_at":"2018-10-08T10:05:51Z","author_association":"NONE","body":"Summary.\r\nI am trying to use roslibpy to publish and subscribe custom messages to/ from a ROS machine.\r\n\r\nI try to publish on a custom topic using a custom_message but it doesnt work.\r\n\r\n## Expected Result\r\nI 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. \r\n\r\nAm I missing something here\r\n\r\n## Actual Result\r\nIt shows me the default 2 topics i.e. /rosout and /rosout_agg\r\n\r\n## Reproduction Steps\r\n```python\r\nThis is my sample code : \r\n\r\n`from __future__ import print_function\r\nimport time\r\nimport roslibpy\r\nfrom roslibpy import Message, Ros, Topic\r\n\r\ndef run_topic_pub():\r\n    print('entering run_topic_pub')\r\n    ros = roslibpy.Ros(host='172.17.0.2', port=9090)\r\n    publisher = Topic(ros, '/custom_topic', 'custom_message/float32')\r\n\r\n\r\n    def start_sending():\r\n        while True:\r\n            if not ros.is_connected:\r\n                break\r\n            publisher.publish(Message({'data': '1'}))\r\n            time.sleep(0.1)\r\n        publisher.unadvertise()\r\n\r\n    \r\n    ros.on_ready(lambda: print('Is ROS connected ?', ros.is_connected))\r\n    ros.on_ready(start_sending, run_in_thread=True)\r\n    ros.get_topics(print)\r\n\r\n    ros.run_forever()\r\n\r\nif __name__ == '__main__':\r\n\r\n    print('main')\r\n\r\n    run_topic_pub()\r\n`\r\n\r\n```\r\n\r\n## System Information\r\nLinux (ubuntu 16.04), ROS Melodic\r\n"},"comment":{"url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/comments/431065897","html_url":"https://github.com/gramaziokohler/roslibpy/issues/11#issuecomment-431065897","issue_url":"https://api.github.com/repos/gramaziokohler/roslibpy/issues/11","id":431065897,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTA2NTg5Nw==","user":{"login":"aakashsehgal","id":36532026,"node_id":"MDQ6VXNlcjM2NTMyMDI2","avatar_url":"https://avatars0.githubusercontent.com/u/36532026?v=4","gravatar_id":"","url":"https://api.github.com/users/aakashsehgal","html_url":"https://github.com/aakashsehgal","followers_url":"https://api.github.com/users/aakashsehgal/followers","following_url":"https://api.github.com/users/aakashsehgal/following{/other_user}","gists_url":"https://api.github.com/users/aakashsehgal/gists{/gist_id}","starred_url":"https://api.github.com/users/aakashsehgal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakashsehgal/subscriptions","organizations_url":"https://api.github.com/users/aakashsehgal/orgs","repos_url":"https://api.github.com/users/aakashsehgal/repos","events_url":"https://api.github.com/users/aakashsehgal/events{/privacy}","received_events_url":"https://api.github.com/users/aakashsehgal/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T16:01:03Z","updated_at":"2018-10-18T16:01:03Z","author_association":"NONE","body":"@gonzalocasas : can I also somehow obtain the subscribed messages ? Something like this : \r\n\r\nI am publishing in ROS on topic custom_topic with Msg2 and I need to subscribe these using roslibpy.\r\n\r\n```\r\nlistener = Topic(ros, 'custom_topic', 'ros_tutorials/Msg2')\r\n\r\ndef receive_message(message)\r\n    a = message['x']\r\n    print(a)\r\n\r\n\r\nlistener.subscribe(receive_message) \r\n```\r\n\r\nI need to process the messages received. So how can I access these messages ?"}}
{"actor":{"display_login":"aakashsehgal"}}