call "quit" from a component

Hi all,
I would like to launch and close an orocos application from a ros node.
the solution that i have in mind is to issue command on an xterm console
from the the ros node:

std::system("xterm -e \"rosrun ocl deployer-gnulinux -s run.ops \" &");

and then make an orocos component (possibly realized in lua) to close
the orocos application (kind of suicide).

is this realizable? how?

Cheers, Gianni.

Re: call "quit" from a component

It can be done in a very ugly way. But I really needed the stophook to be performed for safety reasons.

void Component::updateHook()
{
        // Stuff
 
    // The component is finished
    if(done == true) 
    {
        stop();
    }
}
 
void Component::stopHook()
{
    //Do stuff here, disable amplifiers etc.
 
    if ( suicidemode )
    {
        fatal();
    }
 
}
 
void Component::fatal()
{
    cout << "AAAAAAHHHHH!";
    vector<double> oeps;
    oeps[0] = oeps[1]; // Component and deployer will crash here
}

But I am hoping for a more elegant solution in the future :)

call "quit" from a component

My request was slightly different:
i would like that one component, after calling stop hooks, etc...
close the whole application, e.g. as quit in task browser.
Cheers, Gianni.

On 11/08/2012 11:33 AM, t [dot] t [dot] g [dot] clephas [..] ... wrote:
> It can be done in a very ugly way. But I really needed the stophook to be
> performed for safety reasons.
>
>
> void Component::updateHook()
> {
> // Stuff
>
> // The component is finished
> if(done == true)
> {
> stop();
> }
> }
>
> void Component::stopHook()
> {
> //Do stuff here, disable amplifiers etc.
>
> if ( suicidemode )
> {
> fatal();
> }
>
> }
>
> void Component::fatal()
> {
> cout
>

call "quit" from a component

2012/11/8 Gianni Borghesan <gianni [dot] borghesan [..] ...>

> My request was slightly different:
> i would like that one component, after calling stop hooks, etc...
> close the whole application, e.g. as quit in task browser.
> Cheers, Gianni.
>

(don't top post or some guys will get angry ^^)

I'm sorry if I was not clear, but tried to answered to that.

You have 2 way to quit the deployer :
_ sending a "std::system("xterm -e \"rosrun ocl deployer-gnulinux -s
run.ops \" &");" from the stopHook of your component to the default
OCL::deployer (the one you are using). It is quite dirty IMO and will not
tell properly to the other components in your system (do you have only one
component ?)
_ writing your own deployer (that is a child of ocl::deployer), and add him
an Inputport "quitApplication", writing proper behaviors to reacts to this
port inside the deployer (like stopping components in a special order, ...
). Then creating an output to your component that you will publish at the
end of the updateHook or in the StopHook.

If you have a simple use case the first solution will fill your needs. But
for more complex system I think it's a bit dirty and will a day produce
problems.

Maybe a default implementation of such a nice exit would be welcome in the
ocl::deployer ?

> On 11/08/2012 11:33 AM, t [dot] t [dot] g [dot] clephas [..] ... wrote:
> > It can be done in a very ugly way. But I really needed the stophook to be
> > performed for safety reasons.
> >
> >
> > void Component::updateHook()
> > {
> > // Stuff
> >
> > // The component is finished
> > if(done == true)
> > {
> > stop();
> > }
> > }
> >
> > void Component::stopHook()
> > {
> > //Do stuff here, disable amplifiers etc.
> >
> > if ( suicidemode )
> > {
> > fatal();
> > }
> >
> > }
> >
> > void Component::fatal()
> > {
> > cout
> >
>
> --
> ------------------------------------------------
> Gianni Borghesan, PhD
> Robot Assisted Surgery group
> Robotics Research group
> KU Leuven,
> Department of Mechanical Engineering,
> Division of PMA
> Room 01.017
> Celestijnenlaan 300B, B-3001 Heverlee, Belgium.
> Tel: +32 16 322515.
> Fax: +32 16 322987
> ------------------------------------------------
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

call "quit" from a component

hi

On 11/08/2012 05:27 PM, Willy Lambert wrote:
>
>
> 2012/11/8 Gianni Borghesan <gianni [dot] borghesan [..] ... <mailto:gianni [dot] borghesan [..] ...>>
>
> My request was slightly different:
> i would like that one component, after calling stop hooks, etc...
> close the whole application, e.g. as quit in task browser.
> Cheers, Gianni.
>
>
> (don't top post or some guys will get angry ^^)
>
> I'm sorry if I was not clear, but tried to answered to that.
>
> You have 2 way to quit the deployer :
> _ sending a "std::system("xterm -e \"rosrun ocl deployer-gnulinux -s run.ops \" &");" from the stopHook of your component to the default OCL::deployer (the one you are
> using). It is quite dirty IMO and will not tell properly to the other components in your system (do you have only one component ?)
> _ writing your own deployer (that is a child of ocl::deployer), and add him an Inputport "quitApplication", writing proper behaviors to reacts to this port inside the
> deployer (like stopping components in a special order, ... ). Then creating an output to your component that you will publish at the end of the updateHook or in the StopHook.
>
> If you have a simple use case the first solution will fill your needs. But for more complex system I think it's a bit dirty and will a day produce problems.
>
> Maybe a default implementation of such a nice exit would be welcome in the ocl::deployer ?
I'm also interested in this case: I've a nice statemachine that stops and cleanups everything safely, but the components are still there, doing nothing.
I want it to stop the full process as you would type 'quit' in the task browser.
Is there really no command for that? something like deployer.quit? what happens behind the scene if you type quit? can this 'typing quit' be scripted somehow (lua?)?
The xterm call is not really the 'nice' way and the second proposed solution won't do the quit either.
>
>
> On 11/08/2012 11:33 AM, t [dot] t [dot] g [dot] clephas [..] ... <mailto:t [dot] t [dot] g [dot] clephas [..] ...> wrote:
> > It can be done in a very ugly way. But I really needed the stophook to be
> > performed for safety reasons.
> >
> >
> > void Component::updateHook()
> > {
> > // Stuff
> >
> > // The component is finished
> > if(done == true)
> > {
> > stop();
> > }
> > }
> >
> > void Component::stopHook()
> > {
> > //Do stuff here, disable amplifiers etc.
> >
> > if ( suicidemode )
> > {
> > fatal();
> > }
> >
> > }
> >
> > void Component::fatal()
> > {
> > cout
> >
>
> --
> ------------------------------------------------
> Gianni Borghesan, PhD
> Robot Assisted Surgery group
> Robotics Research group
> KU Leuven,
> Department of Mechanical Engineering,
> Division of PMA
> Room 01.017
> Celestijnenlaan 300B, B-3001 Heverlee, Belgium.
> Tel: +32 16 322515 <tel:%2B32%2016%20322515>.
> Fax: +32 16 322987 <tel:%2B32%2016%20322987>
> ------------------------------------------------
> --
> Orocos-Users mailing list
> Orocos-Users [..] ... <mailto:Orocos-Users [..] ...>
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
nick
>
>
>
>

call "quit" from a component

On Thu, Nov 08, 2012 at 06:46:02PM +0100, Dominick Vanthienen wrote:
> hi
>
> On 11/08/2012 05:27 PM, Willy Lambert wrote:
> >
> >
> > 2012/11/8 Gianni Borghesan <gianni [dot] borghesan [..] ... <mailto:gianni [dot] borghesan [..] ...>>
> >
> > My request was slightly different:
> > i would like that one component, after calling stop hooks, etc...
> > close the whole application, e.g. as quit in task browser.
> > Cheers, Gianni.
> >
> >
> > (don't top post or some guys will get angry ^^)
> >
> > I'm sorry if I was not clear, but tried to answered to that.
> >
> > You have 2 way to quit the deployer :
> > _ sending a "std::system("xterm -e \"rosrun ocl deployer-gnulinux -s run.ops \" &");" from the stopHook of your component to the default OCL::deployer (the one you are
> > using). It is quite dirty IMO and will not tell properly to the other components in your system (do you have only one component ?)
> > _ writing your own deployer (that is a child of ocl::deployer), and add him an Inputport "quitApplication", writing proper behaviors to reacts to this port inside the
> > deployer (like stopping components in a special order, ... ). Then creating an output to your component that you will publish at the end of the updateHook or in the StopHook.
> >
> > If you have a simple use case the first solution will fill your needs. But for more complex system I think it's a bit dirty and will a day produce problems.
> >
> > Maybe a default implementation of such a nice exit would be welcome in the ocl::deployer ?
> I'm also interested in this case: I've a nice statemachine that stops and cleanups everything safely, but the components are still there, doing nothing.
> I want it to stop the full process as you would type 'quit' in the task browser.
> Is there really no command for that? something like deployer.quit? what happens behind the scene if you type quit? can this 'typing quit' be scripted somehow (lua?)?
> The xterm call is not really the 'nice' way and the second proposed solution won't do the quit either.

I think you guys are looking for the exit(3) system call. You could
add a deployer operation quit that calls it. In Lua, just run
"os.exit()".

Markus

call "quit" from a component

2012/11/2 Gianni Borghesan <gianni [dot] borghesan [..] ...>

> Hi all,
> I would like to launch and close an orocos application from a ros node.
> the solution that i have in mind is to issue command on an xterm console
> from the the ros node:
>
> std::system("xterm -e \"rosrun ocl deployer-gnulinux -s run.ops \" &");
>
>
> and then make an orocos component (possibly realized in lua) to close
> the orocos application (kind of suicide).
>

Sending a kill signal to the deployer is different from having a component
that requests a stop to *your* deployer.

In the first case (that you could do in ROS directly without having to let
a component calling std::system("xterm -e \"...) ) the deployer will quit
quite brutally. I'm not sure about the possible call of stopHooks and
cleanupHooks (in any way they won't be ordered as you wish).

In the second case (AFAIK only possible if you have inherited the standard
deployer) you ask the deployer from a component (certainly via a port) to
trigger a managed stop that will do things, stop all nodes, in a special
order, and then call cleanups, in a special order, do some things, and
stops cleanly.

Moreover, when you have a special port on your special deployer, you don't
need any component to relay datas since you can connect it directly to a
ros message.

It depends on your application. In most case quiting the deployer brutaly
(quite equivalent to a Ctrl+C in cmd line ?) is enougth. But if you have a
robot moving in security, sending a ctrl+C is not wised ;).

> is this realizable? how?
>

Cheers, Gianni.
> --
> ------------------------------------------------
> Gianni Borghesan, PhD
> Robot Assisted Surgery group
> Robotics Research group
> KU Leuven,
> Department of Mechanical Engineering,
> Division of PMA
> Room 01.017
> Celestijnenlaan 300B, B-3001 Heverlee, Belgium.
> Tel: +32 16 322515.
> Fax: +32 16 322987
> ------------------------------------------------
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>