rosh overview: Roshlets | Basics | Messages | Parameters | Topics | Services | Nodes | Topic Tools | Packages | Bags | Bagys | roslaunch

Basics

findros(package_name, resource_name)

  • Return filesystem path to resource in a package, such as a rosparam file or a roslaunch file. e.g.

    In [1]: findros('rosparam', 'example.yaml')
    Out[1]: '/home/kwc/ros/tools/rosparam/example.yaml'

ok()

  • Return True if it is okay to keep executing. If False, calling code should terminate, e.g.

    while ok():
      do stuff...

info(obj)

  • Get information about a resource, e.g. a node, topic, or service:

    info(nodes.rosout)

kill(obj)

  • Kill a resource, e.g. a node or process:

    kill(nodes.chatter)

rostype(obj)

  • Get the type of an object, e.g. the message class for a topic:

    In [1]: rostype(topics.chatter)
    Out[1]: <class 'std_msgs.msg._String.String'>

rostype(obj, type)

  • Set the type of an object, e.g. the message class for a topic. You may need to use this if publishing to a topic where the type cannot be inferred:

    In [1]: rostype(topics.echo, msg.std_msgs.String)
    In [2]: topics.echo('hello world')

loginfo(msg, *args), logerr(msg, *args), logdebug(msg, *args), logfatal(msg, *args)

  • Alias for rospy.log*().

Time and Duration

now()

  • Get the current Time

Time

  • Alias for rospy.Time

Duration

  • Alias for rospy.Duration

Rate(hz)

  • Alias for rospy.Rate

sleep(duration)

  • Sleep for the specified duration (Duration or float seconds). Alias for rospy.sleep()

Other useful aliases

Header

  • Alias for rospy.Header

autoheader(frame_id='base_link')

  • Generate a new Header with the timestamp set to the current time and the frame_id set to base_link. Optionally, you can pass in your own frame_id.

Wiki: rosh/Overview/Basics (last edited 2010-10-22 07:58:37 by KenConley)