Skip to main content

Toolsuite for running ROS environments directly from python code, without any specific requirements outside of usual python

Project description

https://travis-ci.org/asmodehn/pyros-setup.svg?branch=indigo

Toolsuite for running ROS environments directly from python code, without any specific requirements outside of usual python.

This WILL BE a pure python package, to be installed in your system, in order to allow easy ROS access from your python environment.

To install it:

sudo pip install -i https://testpypi.python.org/pypi pyros_setup

However it is usable from source for ease of development and compatibility testing. Just use the branch matching your rosdistro.

Basically it allows you to do this:

try:
    import rospy
    import roslaunch
    import rosgraph
    import rosnode
except ImportError:  # if ROS environment is not setup, we emulate it.
    import pyros_setup
    pyros_setup = pyros_setup.delayed_import_auto(base_path=os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', '..'))
    import rospy
    import roslaunch
    import rosgraph
    import rosnode

A ROS package WILL BE also provided ( should BECOME a Third Party Release to minimize changes between the two versions ) This package is only useful if you use the extra functionnalities ( like get_master ) even if your ROS system is already loaded:

import pyros_setup

try:
    import rospy
    import rosgraph
except ImportError:  # if ROS environment is not setup, we emulate it.
    import sys
    sys.modules["pyros_setup"] = pyros_setup.delayed_import_auto(base_path=os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', '..'))
    import rospy
    import rosgraph


roscore_process = None
master = None
launch = None


def setup_module():
    global master
    global roscore_process
    master, roscore_process = pyros_setup.get_master()
    assert master.is_online()

Note: If you know any easier / less tricky / more pythonic way of handling dynamic imports, let me know!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyros_setup-0.0.12.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file pyros_setup-0.0.12.tar.gz.

File metadata

File hashes

Hashes for pyros_setup-0.0.12.tar.gz
Algorithm Hash digest
SHA256 8fa20d61461b8835aa087815bb1063075e4bb9fbda7b5521033b5fdd9c78987a
MD5 a9e40ef3971fb4fa1363983d1614ac46
BLAKE2b-256 1c6bc6d41b2e8eb9bd9d4597a17df5295d66e32587f1fe90317bc5481cdbb2b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page