示例#1
0
def standalone(name, script, plugins):
    """
    Execute roshlet standalone. This method blocks until roshlet exits.

    @param name: roshlet name
    @type  name: str
    @param package: roshlet package
    @type  package: str
    @param type_: roshlet type
    @type  type_: str
    @param plugins: list of roshlet plugins to load for roshlet
    @type  plugins: [str]
    @raise roslib.packages.InvalidROSPkgException: If package does not exist
    @raise IOError: If roshlet cannot be located
    """
    # clean plugin list
    plugins = [p for p in plugins if p]

    # load rosh symbols
    rosh.rosh_init()

    # Load roshlet and execute blocking in this thread
    pc = rosh.get_default_plugin_context()
    args = rosh.impl.roshlets.load_roshlet(script, pc, plugins)
    rosh.impl.roshlets.exec_roshlet(*args)
示例#2
0
#!/usr/bin/env python
import rosh
import time
import rospy

rosh.rosh_init()

power = 0
steer = 0.0

power_cmd = rosh.msg.std_msgs.Float64()
steer_cmd = rosh.msg.std_msgs.Float64()

power_cmd.data = power
steer_cmd.data = steer

left_steer = getattr(rosh.topics,
                     '/robot_gazebo/left_wheel_steering_controller/command')
left_power = getattr(rosh.topics,
                     '/robot_gazebo/left_wheel_power_controller/command')
right_steer = getattr(rosh.topics,
                      '/robot_gazebo/right_wheel_steering_controller/command')
right_power = getattr(rosh.topics,
                      '/robot_gazebo/right_wheel_power_controller/command')

extend_cmd = getattr(rosh.topics,
                     '/robot_gazebo/central_cylinder_controller/command')

while True:

    left_steer(steer_cmd)
示例#3
0
#!/usr/bin/env python
import roslib; roslib.load_manifest('rosh')

# this changes the behavior of rospy/roslaunch/etc... on SIGINT to just be a normal KeyboardInterrupt
roslib.set_interactive(True)

import rosh
rosh.rosh_init()

# import all symbols after initialization
from rosh import *

import os, sys
plugins = sys.argv[1:]

for p in plugins:
    load(p, globals())

# load the user's roshrc file, if present
import roslib.rosenv as _rosenv
_roshrcp = os.path.join(_rosenv.get_ros_home(), 'rosh', 'roshrc.py')
if os.path.isfile(_roshrcp):
    print "loading roshrc"
    try:
        _f = open(_roshrcp)
        _plugins_copy = plugins[:]
        exec _f.read()
        if plugins and plugins != _plugins_copy:
            for p in plugins:
                try:
                    load(p, globals())