Fwd: Arguments for rosrun ocl deployer-gnulinux

Hi,

I was wondering if there is a way to add an extra argument (apart from the
.ops file) to the rosrun ocl deployer-gnulinux command and to be able to
use that argument in the .ops file.

Example: rosrun ocl deployer-gnulinux -s startup.ops 5
And then somewhere in the startup.ops file:

....
if ARGUMENT == 5 then loadComponent(...,...)
...

Apparently for the lua deployer there is something like that:
rosrun ocl rttlua-gnulinux -i deploy.lua $1
And then in the deploy.lua file:

...
if opttab['-1'] then youbot_id=1; youbot_peer_id=2 end
...

Thanks,

Bert

Fwd: Arguments for rosrun ocl deployer-gnulinux

On Mon, Dec 3, 2012 at 2:37 PM, Bert Willaert
<bert [dot] willaert [..] ...> wrote:
>
> Hi,
>
> I was wondering if there is a way to add an extra argument (apart from the
> .ops file) to the rosrun ocl deployer-gnulinux command and to be able to use
> that argument in the .ops file.

You can already in C++, see below for scripting...

>
> Example: rosrun ocl deployer-gnulinux -s startup.ops 5

That would need to be:

rosrun ocl deployer-gnulinux -s startup.ops -- 5

> And then somewhere in the startup.ops file:
>
> ....
> if ARGUMENT == 5 then loadComponent(...,...)

With the patch in attachment for OCL, you could do this:

require("os")
var int argc = os.argc() // number of arguments
var strings argv = os.argv() // array of strings for each argument,
0th element is executable path+name

if (argc > 1 )
if ( argv[1] == "5" ) then loadComponent(...)

Peter

Fwd: Arguments for rosrun ocl deployer-gnulinux

Hi Bert,

On Mon, Dec 03, 2012 at 02:37:18PM +0100, Bert Willaert wrote:

> I was wondering if there is a way to add an extra argument (apart from the .ops
> file) to the rosrun ocl deployer-gnulinux command and to be able to use that
> argument in the .ops file.
>
> Example: rosrun ocl deployer-gnulinux -s startup.ops 5
> And then somewhere in the startup.ops file:

> ....
> if ARGUMENT == 5 then loadComponent(...,...)
> ...

I don't think deployer-gnulinux currently provides access to
command-line arguments.

> Apparently for the lua deployer there is something like that:
> rosrun ocl rttlua-gnulinux -i deploy.lua $1
> And then in the deploy.lua file:
>
> ...
> if opttab['-1'] then youbot_id=1; youbot_peer_id=2 end
> ...

Actually that's after processing, before there's just an 'arg' table
as described here:

http://www.lua.org/pil/1.4.html

Markus

Fwd: Arguments for rosrun ocl deployer-gnulinux

If rosrun doesn't pass the argument to the deployer-gnulinux binary,
you can always just run the deployer directly. If you are just using
this to pass in UUID's for each robot to your code, the recommended
way to do this is probably to use the properties mechanism to load
configuration info from xml files (that are different on each robot).
If you're running on linux and want ALL of the code on each robot to
be identical, you could also read /etc/hostname (which can be set by
your DNS, which in turn uses the MAC addresses of the network
interface of your robot, and is thus unique).

On Mon, Dec 3, 2012 at 3:12 PM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> Hi Bert,
>
> On Mon, Dec 03, 2012 at 02:37:18PM +0100, Bert Willaert wrote:
>
>> I was wondering if there is a way to add an extra argument (apart from the .ops
>> file) to the rosrun ocl deployer-gnulinux command and to be able to use that
>> argument in the .ops file.
>>
>> Example: rosrun ocl deployer-gnulinux -s startup.ops 5
>> And then somewhere in the startup.ops file:
>
>> ....
>> if ARGUMENT == 5 then loadComponent(...,...)
>> ...
>
> I don't think deployer-gnulinux currently provides access to
> command-line arguments.
>
>> Apparently for the lua deployer there is something like that:
>> rosrun ocl rttlua-gnulinux -i deploy.lua $1
>> And then in the deploy.lua file:
>>
>> ...
>> if opttab['-1'] then youbot_id=1; youbot_peer_id=2 end
>> ...
>
> Actually that's after processing, before there's just an 'arg' table
> as described here:
>
> http://www.lua.org/pil/1.4.html
>
> Markus
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users