[ros-users] Python version of rospack
Ken Conley
kwc at willowgarage.com
Thu Mar 3 16:59:07 UTC 2011
On Thu, Mar 3, 2011 at 7:55 AM, Mike Purvis
<mpurvis at clearpathrobotics.com> wrote:
> Hey,
> I'm doing a bit of experimenting with getting ros_comm running on an
> embedded Linux platform. For the moment, I'm ignoring roscpp (and the
> roscpp-based eros project), and just concentrating on a rospy-based client,
> since the platform already has a working Python 2.6 environment with expat
> and yaml. This is similar work to what has been done to get rospy running on
> Android devices: http://www.ros.org/wiki/android.
> It seems to be basically working. The one major frustration at this point
> stems from rospack being a compiled utility. Has there been any work (or
> desire) to port this program to Python? I note that in roslib/packages.py,
> there's a note to move the get_pkg_dir function to something not based on
> rospack---would there be the possibility of them both deriving from common
> library code? The ROS-android project would benefit from this as
> well---manifests are currently unsupported there, possibly for this reason?
> What I've done so far to get it up at all is dump the packages and stacks I
> need into the root directory, and then implement a trivial stub rospack,
> like so:
> #!/usr/bin/env python
> import sys, os
> cmd = sys.argv[1]
> if cmd == 'find':
> paths = ["/root/", "/root/messages/", "/root/common_msgs/",
> "/root/ros/core/"]
> pkg = sys.argv[2]
> for path in paths:
> if os.path.exists(path + pkg):
> print(path + pkg)
> exit()
> Doesn't look like much, but with manual dependency resolution and running of
> genmsg_py.py, that's enough to launch a rospy node which communicates to an
> offboard roscore.
> Any thoughts?
Most of the code you would need to do a complete implementation of
rospack is in roslib.packages and roslib.manifest, but the code isn't
user-facing. i.e. there are routines for performing the directory
crawls, parsing the manifest, etc... they just have to be assembled in
a different way. If you look at list_pkgs() is basically a "rospack
find" implementation. ROSPackages implements the higher level code,
but it currently assumes a native rospack implementation in-between.
You'd just need to replace _safe_load_manifest with code that use the
Python rospack instead. The main thing is that you'll want to add
code to write the .rospackcache code as the performance of the Python
codebase would make that even more necessary.
HTH,
Ken
>
> --
>
> Mike Purvis | Software Architect | Clearpath Robotics, Inc.
>
> 295 Hagey Blvd. Waterloo, Ontario N2L 6R5 Canada
> T: +1 (800) 301-3863 x805 | E: mpurvis at clearpathrobotics.com | W:
> clearpathrobotics.com
>
> Your Unmanned Experts TM
>
> This electronic communication (including any attachments) is CONFIDENTIAL
> AND LEGALLY PRIVILEGED. Any unauthorized use or disclosure is strictly
> prohibited. If you are not the intended recipient, you are hereby notified
> that any review, retransmission, conversion to hard copy, copying,
> circulation or other use of this message and any attachments is strictly
> prohibited. The recipient should check this email and any attachments for
> the presence of viruses. The company accepts no liability for any damage
> caused by any virus transmitted by this email. Thank you.
>
>
>
>
> _______________________________________________
> 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