[ros-users] launch node at runtime

Adam Stambler adasta at gmail.com
Wed Nov 17 22:18:42 UTC 2010


Hi Ben,

I have not tried implement a master node like this, but I can help with #5.

5.      What would I need to do to load a package into my manifest at
runtime?  Do the dependencies in a manifest simply get turned into paths in
the PYTHONPATH?

If you look at roslib.load_manifest, it finds all the pkg directories in
your manifest and adds it to your sys.path.   You can simply do that
yourself using the standard roslib functions to find the path and then
append it to the sys.path list.

In the past, I have simply used roslib.load_manifest for any additional pkgs
that I want to use.  It increases the size of the sys.path, but there does
not seem to be any problem for the small number of additional search paths.

To then publish or subscribe to the messages in that pkg, use something like
:

module = __import__( module_name +'.msg')
msg_module = getattr(module, 'msg')
msg = getattr(msg_module, msg_name)



Regards,
Adam

On Wed, Nov 17, 2010 at 5:04 PM, Axelrod, Benjamin <baxelrod at irobot.com>wrote:

>  I have a large system with many nodes for specific purposes.  At any
> given time, many nodes do not need to be running.  I would like to be able
> to start a node from my master rospy code when it determines it needs that
> node up.  I think actually launching the node is as easy as an os.system
> call.  However, I would like to interface with the newly started node, and
> would like it if I did not have to list every package in the master’s
> manifest.  Basically, I would like to take a string names for a package /
> node / etc., then at runtime load it into my manifest, then be able to set
> up a publisher and subscriber to it.
>
>
>
> Here are some questions.
>
> 1.      Has anyone done this type of thing before?
>
> 2.      Do you have any input on best practices?
>
> 3.      It seems like part of the answer is some sort of standard
> interface (or a standard interface to determine what the actual interface to
> that node is).  Any ideas on this?
>
> 4.      Is there anything more elegant that a bunch of eval() statements
> (to turn string names into message types)?
>
> 5.      What would I need to do to load a package into my manifest at
> runtime?  Do the dependencies in a manifest simply get turned into paths in
> the PYTHONPATH?
>
>
>
> Thanks,
>
> -Ben
>
>
>
> Ben Axelrod
>
> Research Scientist
>
> iRobot Corporation
>
> 8 Crosby Drive, Mail Stop 8-1
>
> Bedford, MA 01730
>
> (781) 430-3315 (Tel)
>
> (781) 960-2628 (Fax)
>
> baxelrod at irobot.com <ofitch at irobot.com>
>
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20101117/0c569ebd/attachment-0003.html>


More information about the ros-users mailing list