Home | Trees | Indices | Help |
---|
|
1 #!/usr/bin/env python 2 # Software License Agreement (BSD License) 3 # 4 # Copyright (c) 2010, Willow Garage, Inc. 5 # All rights reserved. 6 # 7 # Redistribution and use in source and binary forms, with or without 8 # modification, are permitted provided that the following conditions 9 # are met: 10 # 11 # * Redistributions of source code must retain the above copyright 12 # notice, this list of conditions and the following disclaimer. 13 # * Redistributions in binary form must reproduce the above 14 # copyright notice, this list of conditions and the following 15 # disclaimer in the documentation and/or other materials provided 16 # with the distribution. 17 # * Neither the name of Willow Garage, Inc. nor the names of its 18 # contributors may be used to endorse or promote products derived 19 # from this software without specific prior written permission. 20 # 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 # POSSIBILITY OF SUCH DAMAGE. 33 # 34 # Revision $Id: __init__.py 11676 2010-10-22 02:06:13Z kwc $ 35 """ 36 ROS Shell (rosh). 37 38 Higher-level, interactive scripting environment for ROS. 39 """ 40 41 from __future__ import with_statement 42 import roslib; roslib.load_manifest('rosh') 43 44 import os 45 import sys 46 47 import roslib.packages 48 import roslib.rosenv 49 50 # declare shell globals 51 52 # These are initialized by rosh.impl.ros_graph but declared here due 53 # to get_*() accessors 54 nodes = topics = services = parameters = msg = srv = None 55 56 # - by default, all publishers latch 57 latching = True 58 59 import rosh.plugin 60 import rosh.impl.ros_packages 61 import rosh.impl.ros_graph 62 import rosh.impl.ipy 63 import rosh.impl.namespace 64 65 from rosh.impl.namespace import rostype, info 66 from rosh.impl.show import show 67 from rosh.impl.props import props 68 69 # NOTE: this shadows the rosparam module. Is this an issue? 70 from rosh.impl.param import rosparam, rosparam_str 71 72 # client symbols 73 from rosh.impl.exceptions import ROSHException 74 from rosh.impl.library import findros 75 from rosh.impl.bagy import Bagy, MapBagy 76 from rosh.impl.bag import Bag 77 78 from rosh.impl.service import Service 79 from roslaunch.core import Node 8082 if hasattr(obj, '_kill'): 83 obj._kill() 84 elif type(obj) in (list, tuple): 85 for x in obj: 86 kill(x) 87 else: 88 raise ValueError("Not a kill-able object")8991 """ 92 Load plugin. This loads the plugin into the rosh global symbol 93 table. If globals_ is specified, plugin symbols will also be 94 loaded into the provided dictionary. Common usage is:: 95 96 load_plugin('plugin_name', globals()) 97 98 @param globals_: global symbol table to additionally load plugin to. 99 @type globals_: dict 100 """ 101 rosh.plugin.load_plugin(name, _plugin_context, globals_)102 103 _plugin_context = None105 return _plugin_context106108 """ 109 @return: True if ok to keep executing, False if script should exit. 110 """ 111 return rosh.impl.ros_graph.ok()112114 # context is the heart of the rosh namespace logic 115 global _ctx, _rosh_lock 116 117 _ctx = rosh.impl.namespace.Context() 118 119 import threading 120 _rosh_lock = threading.RLock() 121 122 # plugin context is the loading mechanism for ROSH plugins 123 global _plugin_context 124 _plugin_context = rosh.plugin.PluginContext(globals(), _ctx, _rosh_lock) 125 126 # load symbols for ROS packages layer 127 rosh.impl.ros_packages.load_rosh_plugin('rosh.impl.ros_packages', _plugin_context) 128 129 # load symbols for ROS graph layer. Note: graph layer and package 130 # layer are coupled by both msg/srv and roslaunch, which makes 131 # separating rosh less than useful right now. 132 rosh.impl.ros_graph.load_rosh_plugin('rosh.impl.ros_graph', _plugin_context) 133 134 # initialize IPython Magic 135 rosh.impl.ipy.ipy_magic_init()136 137 # initialize privates 138 139 # lock for member/global initialization 140 _rosh_lock = None 141 # ROSH shared context 142 ctx = None 143
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Jan 11 12:18:00 2013 | http://epydoc.sourceforge.net |