{"action":"created","issue":{"url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/378","labels_url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/378/labels{/name}","comments_url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/378/comments","events_url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/378/events","html_url":"https://github.com/jsk-ros-pkg/jsk_roseus/pull/378","id":112012478,"number":378,"title":"[roseus] Add topic-listener helper class to write ros program in procedual manner","user":{"login":"garaemon","id":40454,"avatar_url":"https://avatars.githubusercontent.com/u/40454?v=3","gravatar_id":"","url":"https://api.github.com/users/garaemon","html_url":"https://github.com/garaemon","followers_url":"https://api.github.com/users/garaemon/followers","following_url":"https://api.github.com/users/garaemon/following{/other_user}","gists_url":"https://api.github.com/users/garaemon/gists{/gist_id}","starred_url":"https://api.github.com/users/garaemon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garaemon/subscriptions","organizations_url":"https://api.github.com/users/garaemon/orgs","repos_url":"https://api.github.com/users/garaemon/repos","events_url":"https://api.github.com/users/garaemon/events{/privacy}","received_events_url":"https://api.github.com/users/garaemon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-18T10:31:37Z","updated_at":"2015-10-18T14:01:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/pulls/378","html_url":"https://github.com/jsk-ros-pkg/jsk_roseus/pull/378","diff_url":"https://github.com/jsk-ros-pkg/jsk_roseus/pull/378.diff","patch_url":"https://github.com/jsk-ros-pkg/jsk_roseus/pull/378.patch"},"body":"I think a lot code has these structure.\r\n```lisp\r\n(defun hoge-topic-callback (msg)\r\n   (setq *hoge* msg))\r\n\r\n(ros::subscribe \"hoge\" foo_msgs::Foo #'hoge-topic-callback)\r\n(ros::spin-once)\r\n(send *hoge* :hoge)\r\n...\r\n```\r\n\r\n\r\n`topic-listener` class can help these program.\r\n```lisp\r\n(setq *hoge* (instance topic-listener :init \"hoge\" foo_msgs::Foo)\r\n(ros::spin-once)\r\n(send (send *hoge* :value) :hoge)\r\n...\r\n```\r\n\r\nIn fact, programmer should not write program which requires this `topic-listener` class but it's a kind of unavoidable hack."},"comment":{"url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/comments/149019111","html_url":"https://github.com/jsk-ros-pkg/jsk_roseus/pull/378#issuecomment-149019111","issue_url":"https://api.github.com/repos/jsk-ros-pkg/jsk_roseus/issues/378","id":149019111,"user":{"login":"garaemon","id":40454,"avatar_url":"https://avatars.githubusercontent.com/u/40454?v=3","gravatar_id":"","url":"https://api.github.com/users/garaemon","html_url":"https://github.com/garaemon","followers_url":"https://api.github.com/users/garaemon/followers","following_url":"https://api.github.com/users/garaemon/following{/other_user}","gists_url":"https://api.github.com/users/garaemon/gists{/gist_id}","starred_url":"https://api.github.com/users/garaemon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garaemon/subscriptions","organizations_url":"https://api.github.com/users/garaemon/orgs","repos_url":"https://api.github.com/users/garaemon/repos","events_url":"https://api.github.com/users/garaemon/events{/privacy}","received_events_url":"https://api.github.com/users/garaemon/received_events","type":"User","site_admin":false},"created_at":"2015-10-18T14:01:23Z","updated_at":"2015-10-18T14:01:23Z","body":"> I think that function of this class and one-shot function are same.\r\n\r\nLooks almost same.\r\nBut one-shot-subscribe runs:\r\n1. subscribe topic\r\n2. wait-for callback\r\n\r\nThis procedure may have overhead. \r\nbecause it always need to communicate with roscore.\r\nAnd topic should be published between 1-2.\r\nIf the topic is published by latched publisher, the overhead is reduced \r\nbecause it does not  need to wait for new publication. \r\nBut we need to call `ros::spin-once` once at least and some callback requires much time to compute, it will be another overhead."}}