On Tue, Dec 7, 2010 at 11:49 PM, Patrick Bouffard wrote: > You're right, it's not a published topic. Still it's a bit odd to have > that asymmetry between rosh and rostopic. Is there ever a case where a > topic is advertised but it has no type? Even if that's the case, I > think that if it shows up in rostopic list, I'd expect it (unless > there's a real difficulty in making it possible, but since I know > there's nothing that Python can't do I doubt that's likely ;) to be > tab-completable in rosh. https://code.ros.org/trac/ros/ticket/3183 > Minor nits like this one aside, nice work with rosh. It nicely > complements the other tools and is just the sort of thing I need when > prototyping new stuff. Thanks! Just the sort of thing that's useful to hear. We kept rosh out of ROS proper partly b/c we weren't sure if it had reached 'usefulness' yet. > One suggestion that would be helpful for quick & dirty ad hoc > scripting work--since start up time in ROS land is a bit, shall we > say, nondeterministic, it would be helpful to have a little library of > helper functions available to the rosh user for some of the common > things one needs, e.g. stuff like: > > def is_publishing(node_name, topic_name): >    topics_published = [info(s).name for s in > info(nodes[node_name]).subs] # <-- this one was a bit tricky to work > out >    return True in [s.find(topic_name) >= 0 for s in topics_published] > > def wait_for_topic(node_name, topic_name, sleep_time=0.5): >    loginfo("Waiting for topic %s from node %s" % (topic_name, node_name)) >    while not is_publishing(node_name, topic_name): >        sleep(sleep_time) >    loginfo("Topic found!") > > Along the same lines it would be *really* useful in a lot of > situations to be able to do something like: > > wait_for(lambda x: x.fieldname > 42, '/some/topic') > do_cool_stuff() I added your helpers here. Feel free to keep adding more. When these start to take some shape I'll think about how to best incorporate them. The hard thing about rosh is that the addition of a single API often has widespread consequences due to the the overloaded nature of the design. It will help to see if the helpers take a general shape before immediately including them. http://www.ros.org/wiki/Helper%20functions - Ken