Package roslib :: Module scriptutil
[frames] | no frames]

Module scriptutil

source code

Common ros script utilities, such as methods convenience methods for creating master xmlrpc proxies and executing rospack. This library is relatively immature and much of the functionality here will likely be moved elsewhere as the API solidifies.

Functions
 
set_interactive(interactive)
General API for a script specifying that it is being run in an interactive environment.
source code
bool
is_interactive()
General API for a script specifying that it is being run in an interactive environment.
source code
[str]
myargv(argv=None)
Remove ROS remapping arguments from sys.argv arguments.
source code
str
script_resolve_name(script_name, name)
Name resolver for scripts.
source code
xmlrpclib.ServerProxy
get_master()
Get an XMLRPC handle to the Master.
source code
xmlrpclib.ServerProxy
get_param_server()
Returns: ServerProxy XML-RPC proxy to ROS parameter server
source code
bool
is_subscriber(topic, subscriber_id)
Check whether or not master think subscriber_id subscribes to topic
source code
bool
is_publisher(topic, publisher_id)
Predicate to check whether or not master think publisher_id publishes topic
source code
 
ask_and_call(cmds, cwd=None)
Pretty print cmds, ask if they should be run, and if so, runs them using subprocess.check_call.
source code
Variables
  PRODUCT = 'ros'
  __package__ = 'roslib'
Function Details

set_interactive(interactive)

source code 

General API for a script specifying that it is being run in an interactive environment. Many libraries may wish to change their behavior based on being interactive (e.g. disabling signal handlers on Ctrl-C).

Parameters:
  • interactive (bool) - True if current script is being run in an interactive shell

is_interactive()

source code 

General API for a script specifying that it is being run in an interactive environment. Many libraries may wish to change their behavior based on being interactive (e.g. disabling signal handlers on Ctrl-C).

Returns: bool
True if interactive flag has been set

myargv(argv=None)

source code 

Remove ROS remapping arguments from sys.argv arguments.

Returns: [str]
copy of sys.argv with ROS remapping arguments removed

script_resolve_name(script_name, name)

source code 

Name resolver for scripts. Supports ROS_NAMESPACE. Does not support remapping arguments.

Parameters:
  • name (str) - name to resolve
  • script_name (str) - name of script. script_name must not contain a namespace.
Returns: str
resolved name

get_master()

source code 

Get an XMLRPC handle to the Master. It is recommended to use the `rosgraph.masterapi` library instead, as it provides many conveniences.

Returns: xmlrpclib.ServerProxy
XML-RPC proxy to ROS master

get_param_server()

source code 
Returns: xmlrpclib.ServerProxy
ServerProxy XML-RPC proxy to ROS parameter server

is_subscriber(topic, subscriber_id)

source code 

Check whether or not master think subscriber_id subscribes to topic

Returns: bool
True if still register as a subscriber
Raises:

is_publisher(topic, publisher_id)

source code 

Predicate to check whether or not master think publisher_id publishes topic

Returns: bool
True if still register as a publisher
Raises:

ask_and_call(cmds, cwd=None)

source code 

Pretty print cmds, ask if they should be run, and if so, runs them using subprocess.check_call.

Parameters:
  • cwd (str) - (optional) set cwd of command that is executed
Returns:
True if cmds were run.