roslua: ROS client library for Lua

Module roslua.utils

General roslua utilities. This module contains useful functions used in roslua.

Copyright© Tim Niemueller, Carnegie Mellon University, Intel Research Pittsburgh

Release: Released under BSD license

Functions

assert_rospack () Assert availability of rospack.
c_package_loader (module) Package loader to find Lua modules written in C in ROS packages.
find_rospack (package) Get path for a package.
package_loader (module) Package loader to find Lua modules in ROS packages.
split (s, sep) Split string.


Functions

assert_rospack ()
Assert availability of rospack. Throws an error if rospack cannot be executed, for example because ROS is not installed or the binary is not in the PATH.
c_package_loader (module)
Package loader to find Lua modules written in C in ROS packages. This will use the first part of the module name and assume it to be the name of a ROS package. It will then try to determine the path using rospack and if found try to load the module in the package directory. Additionally it appends the string "_lua" to the package name, thus allowing a module named my_module in the ROS package my_module_lua. This is done to allow to mark Lua ROS packages, but avoid having to have the _lua suffix in module names. The suffixed version takes precedence.

Parameters

  • module: module name as given to require()

Return value:

function of loaded code if module was found, nil otherwise
find_rospack (package)
Get path for a package. Uses rospack to find the path to a certain package. The path is cached so that consecutive calls will not trigger another rospack execution, but are rather handled directly from the cache. An error is thrown if the package cannot be found.

Parameters

  • package:

Return value:

path to give package
package_loader (module)
Package loader to find Lua modules in ROS packages. This will use the first part of the module name and assume it to be the name of a ROS package. It will then try to determine the path using rospack and if found try to load the module in the package directory. Additionally it appends the string "_lua" to the package name, thus allowing a module named my_module in the ROS package my_module_lua. This is done to allow to mark Lua ROS packages, but avoid having to have the _lua suffix in module names. The suffixed version takes precedence.

Parameters

  • module: module name as given to require()

Return value:

function of loaded code if module was found, nil otherwise
split (s, sep)
Split string. Splits a string at a given separator and returns the parts in a table.

Parameters

  • s: string to split
  • sep: separator to split at

Return value:

table with splitted parts

Valid XHTML 1.0!