[ros-users] rosh not showing all topics

Patrick Bouffard bouffard at eecs.berkeley.edu
Wed Dec 8 07:49:50 UTC 2010


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.

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.

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()

... etc

Cheers,
Pat

On Tue, Dec 7, 2010 at 11:27 PM, Ken Conley <kwc at willowgarage.com> wrote:
> It's probably b/c rosh is currently only tab completes published
> topics.  I honestly can't recall if this was:
>
> a) by design, so that you only tab complete to topics that you can get data from
>
> or
>
> b) due to the fact that in the very first prototype of rosh,
> subscribers in ROS didn't declare topic type (which meant that rosh
> couldn't do any initialization of subscriber-only topics).
>
> .. though I'm leaning towards (b).
>
> I welcome your feedback (I'll probably spend some time with rosh later
> this month to incorporate the API review feedback and freeze it, so
> now is the time to blast away).
>
> In the event that the theory above is wrong (i.e. it is a published
> topic), please send the output of:
>
> python -c "import os, xmlrpclib; s =
> xmlrpclib.ServerProxy(os.environ['ROS_MASTER_URI']); print
> s.getPublishedTopics('/test', '/')"
>
> and
>
> python -c "import os, xmlrpclib; s =
> xmlrpclib.ServerProxy(os.environ['ROS_MASTER_URI']); print
> s.getSystemState('/test')"
>
> cheers,
> Ken
>
> On Tue, Dec 7, 2010 at 11:10 PM, Patrick Bouffard
> <bouffard at eecs.berkeley.edu> wrote:
>> In rosh:
>>
>> In [2]: topics.pelican1. <pressed TAB>
>> topics.pelican1.asctec_proc                topics.pelican1.controller_mux
>> topics.pelican1.autopilot                  topics.pelican1.downlink
>> topics.pelican1.control_mode_attitude      topics.pelican1.estimator
>> topics.pelican1.control_mode_autosequence  topics.pelican1.joy
>> topics.pelican1.control_mode_hover         topics.pelican1.teleop_flyer
>> topics.pelican1.control_mode_idle          topics.pelican1.vicon_recv_direct
>> topics.pelican1.controller
>>
>> .. quit out of rosh and in the same terminal:
>>
>> bouffard at lipschitz:~/kinect-devel-unstable$ rostopic list | grep pelican1
>> /pelican1/asctec_adapter/land_now
>> /pelican1/asctec_proc/imu
>> /pelican1/asctec_proc/pressure_height
>> ...
>>
>> back into rosh, and try another way:
>>
>> In [1]: topics['/pelican1/asctec_adapter/land_now']
>> Out[1]:
>> bool data
>>
>> Which is what it should say (it's of type std_msgs/Bool). Why can rosh
>> 'see' that topic one way but not the other, even when rostopic list
>> can see it? This is using unstable maverick debs.
>>
>> Thanks,
>> Pat
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list