Lua: fixing broken rttros.find_rospack (please read if you use it!)

Hi,

the lua rttros.find_rospack function is failing with fuerte and newer
when the rttlua-gnulinux binary is running with elevated privileges
(e.g. setcap). This is because in that case the linux kernel unsets
LD_LIBRARY_PATH for security reasson, which in turn leads to rospack
not finding librospack.so which is in a non-standard location. Argh...

The solution is to determine the package path using RTT's rtt_rospack
service (instead of calling os.execute("rospack find ...")). This
works fine, but has the drawback that rttros no longer is independent
of rtt. I can't imagine this really being a problem for anyone, but if
it is, speak up now.

The new version looks as follows:

local rtt_rospack_find=false
function find_rospack(package)
if not rtt_rospack_find then
if not (rtt and rttlib) then
error("find_rospack: not an rttlua _or_ rttlib not loaded.")
end
depl = rttlib.findpeer("deployer") or rttlib.findpeer("Deployer")
if not depl then error("find_rospack: failed to find a deployer") end
depl:import("rtt_rospack")
rtt_rospack_find=rtt.provides("rospack"):getOperation("find")
end
local res = rtt_rospack_find(package)
if res~="" then return res else return false end
end

The updated version can be found in my git repo:

http://gitorious.org/~markusk/orocos-toolchain/ocl-mk

Markus