rttlua and 'rospack find'

Is there a preferred method by which to find the file system path to a
ROS package in RTTLua? The reason I want it is to properly load
configuration files without hard-coding paths into my scripts.

os.execute() outputs the correct value, but I can't seem to capture it
and use it later. Looks like there's a 'roslua' package that has
support for ROS-type things, but I'm worried that roslua and rttlua
might step on each other? Presumably I can just take what roslua is
doing in its find_rospack() method and use the commands directly, but
that seems hackish.

rttlua and 'rospack find'

The find_rospack() method in roslua was actually pretty straight
forward. Here's the good part:
/**
p = io.popen("rospack find packageName")
path = p:read("*a")
configPath = string.gsub(path, "^(.+)\n$", "%1")
p:close()
**/

I guess the question becomes, should I do it this way, or should I use
the roslua package? Are rttlua and roslua compatible?

--
*Dustin Gooding*
NASA/JSC Robotics

On 05/15/2012 03:16 PM, Dustin Gooding wrote:
> Is there a preferred method by which to find the file system path to a
> ROS package in RTTLua? The reason I want it is to properly load
> configuration files without hard-coding paths into my scripts.
>
> os.execute() outputs the correct value, but I can't seem to capture it
> and use it later. Looks like there's a 'roslua' package that has
> support for ROS-type things, but I'm worried that roslua and rttlua
> might step on each other? Presumably I can just take what roslua is
> doing in its find_rospack() method and use the commands directly, but
> that seems hackish.
>

rttlua and 'rospack find'

Hi Dustin,

On Tue, May 15, 2012 at 04:51:53PM -0500, Dustin Gooding wrote:
> The find_rospack() method in roslua was actually pretty straight forward.
> Here's the good part:
> /**
> p = io.popen("rospack find packageName")
> path = p:read("*a")
> configPath = string.gsub(path, "^(.+)\n$", "%1")
> p:close()
> **/
>
> I guess the question becomes, should I do it this way, or should I use the
> roslua package? Are rttlua and roslua compatible?

Yes, it is so simple and generally useful that I just "stole" it and
put it into a tiny module "rttros" which is already in
ocl/lua/modules/rttros.lua

See also here:
http://www.orocos.org/wiki/orocos/toolchain/LuaCookbook#toc122

Alternatively there is also a C++ rospack service you can use after
importing rtt_rosnode:

> print(rtt.provides():provides("rospack"):find("rtt_rosnode"))
/home/mk/src/electric/rtt_ros_integration/rtt_rosnode

(the first 'provides' accesses the global service and the second the
rospack service)

Markus

rttlua and 'rospack find'

Much nicer. I knew there was something simple like that, I just
couldn't find it. Thanks Markus.

--*
Dustin Gooding*
NASA/JSC Robotics

On 05/16/2012 02:26 AM, Markus Klotzbuecher wrote:
> Hi Dustin,
>
> On Tue, May 15, 2012 at 04:51:53PM -0500, Dustin Gooding wrote:
>> The find_rospack() method in roslua was actually pretty straight forward.
>> Here's the good part:
>> /**
>> p = io.popen("rospack find packageName")
>> path = p:read("*a")
>> configPath = string.gsub(path, "^(.+)\n$", "%1")
>> p:close()
>> **/
>>
>> I guess the question becomes, should I do it this way, or should I use the
>> roslua package? Are rttlua and roslua compatible?
> Yes, it is so simple and generally useful that I just "stole" it and
> put it into a tiny module "rttros" which is already in
> ocl/lua/modules/rttros.lua
>
> See also here:
> http://www.orocos.org/wiki/orocos/toolchain/LuaCookbook#toc122
>
> Alternatively there is also a C++ rospack service you can use after
> importing rtt_rosnode:
>
>> print(rtt.provides():provides("rospack"):find("rtt_rosnode"))
> /home/mk/src/electric/rtt_ros_integration/rtt_rosnode
>
> (the first 'provides' accesses the global service and the second the
> rospack service)
>
> Markus
>
>

rttlua and 'rospack find'

2012/5/16 Dustin Gooding <dustin [dot] r [dot] gooding [..] ...>

> Much nicer. I knew there was something simple like that, I just couldn't
> find it. Thanks Markus.
>
>
> --*
> Dustin Gooding*
> NASA/JSC Robotics
>
> On 05/16/2012 02:26 AM, Markus Klotzbuecher wrote:
>
> Hi Dustin,
>
> On Tue, May 15, 2012 at 04:51:53PM -0500, Dustin Gooding wrote:
>
> The find_rospack() method in roslua was actually pretty straight forward.
> Here's the good part:
> /**
> p = io.popen("rospack find packageName")
> path = p:read("*a")
> configPath = string.gsub(path, "^(.+)\n$", "%1")
> p:close()
> **/
>
> I guess the question becomes, should I do it this way, or should I use the
> roslua package? Are rttlua and roslua compatible?
>
> Yes, it is so simple and generally useful that I just "stole" it and
> put it into a tiny module "rttros" which is already in
> ocl/lua/modules/rttros.lua
>
> See also here:http://www.orocos.org/wiki/orocos/toolchain/LuaCookbook#toc122
>
>
Markus, is the 10.2 paragraph up to date ? It's a bit different from what
you suggested

> Alternatively there is also a C++ rospack service you can use after
> importing rtt_rosnode:
>
>
> print(rtt.provides():provides("rospack"):find("rtt_rosnode"))
>
> /home/mk/src/electric/rtt_ros_integration/rtt_rosnode
>
> (the first 'provides' accesses the global service and the second the
> rospack service)
>
> Markus
>
>
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>

rttlua and 'rospack find'

On Tue, May 22, 2012 at 01:42:25PM +0200, Willy Lambert wrote:
>
>
> 2012/5/16 Dustin Gooding <dustin [dot] r [dot] gooding [..] ...>
>
> Much nicer. I knew there was something simple like that, I just couldn't
> find it. Thanks Markus.
>
>
> --
> Dustin Gooding
> NASA/JSC Robotics
>
> On 05/16/2012 02:26 AM, Markus Klotzbuecher wrote:
>
> Hi Dustin,
>
> On Tue, May 15, 2012 at 04:51:53PM -0500, Dustin Gooding wrote:
>
> The find_rospack() method in roslua was actually pretty straight forward.
> Here's the good part:
> /**
> p = io.popen("rospack find packageName")
> path = p:read("*a")
> configPath = string.gsub(path, "^(.+)\n$", "%1")
> p:close()
> **/
>
> I guess the question becomes, should I do it this way, or should I use the
> roslua package? Are rttlua and roslua compatible?
>
> Yes, it is so simple and generally useful that I just "stole" it and
> put it into a tiny module "rttros" which is already in
> ocl/lua/modules/rttros.lua
>
> See also here:
> http://www.orocos.org/wiki/orocos/toolchain/LuaCookbook#toc122
>
>
> Markus, is the 10.2 paragraph up to date ? It's a bit different from what you
> suggested

No not quite, it's missing this alternative:

> Alternatively there is also a C++ rospack service you can use after
> importing rtt_rosnode:
>
>
> print(rtt.provides():provides("rospack"):find("rtt_rosnode"))
>
> /home/mk/src/electric/rtt_ros_integration/rtt_rosnode
>
> (the first 'provides' accesses the global service and the second the
> rospack service)

Feel free to extend it!

Markus