Hello,
I have a simple question, can we kill the running application with a simple Command ( function abort for exemple or something like that ) ?
Thanks
Hello,
I have a simple question, can we kill the running application with a simple Command ( function abort for exemple or something like that ) ?
Thanks
You can stop it, then simply close the program from the icon on the screenShot.
Thank for the reply, but i want to do it in soft, for exemple, stop the application if a condition isn't fulfilled.
edit: You can also use something like .triggerWhen(...) and program your desired action.
e.g.:
//Trigger
ICallbackAction ica = new ICallbackAction() {
@Override
public void onTriggerFired(IFiredTriggerInfo triggerInformation)
{
getLogger().info("TriggerTime: "+ triggerInformation.getTriggerTime().toString());
getLogger().info("TriggerCondition: "+ triggerInformation.getFiredCondition().toString());
getApplicationControl().pause();
};
}; //End ICallbackAction ica
//Condition for Cartesian force from all directions (Frame below the robot flange)
ForceCondition flangecollision = ForceCondition.createSpatialForceCondition(lbr.getFlange(), 15);
lbr.move(ptp(getApplicationData().getFrame("/Frame_Z2")).triggerWhen(flangecollision, ica));
Display More
----
You can pause the application with the .pause() command:
Is this what you are looking for?
Thank for the reply, but i want to do it in soft, for exemple, stop the application if a condition isn't fulfilled.
Thank for the reply, but i want to do it in soft, for exemple, stop the application if a condition isn't fulfilled.
Can you elaborate on what you want to do? There are a lot of possibilities here. What's the condition you want to check to stop your program? Do you know it in advance? Is it an event? etc.
You can use the following code lines to singal the current application to stop and in your main thread, the InterruptedException shouldn't be caught.
It isn't a decent way.
final Thread mainThread = Thread.currentThread();
ICondition c = ForceCondition.createSpatialForceCondition(_lbr.getFlange(), 15.0d);
getObserverManager().createAndEnableConditionObserver(c, NotificationType.OnEnable, new IRisingEdgeListener()
{
@Override
public void onRisingEdge(ConditionObserver conditionObserver, Date time, int missedEvents)
{
// Stop the current application
mainThread.interrupt();
}
});
......
Display More
Hello,
I have a simple question, can we kill the running application with a simple Command ( function abort for exemple or something like that ) ?
Thanks
Thanks for reply
Here is my function, if the user answer is "Oui", the application is still running, but if the answer is "non", i wan't to quit the application, here i made a boolean Abort that i set on true if the answer is "non", so it kill the application because i put an IF loop with the (!Abort) condition.
My question is, Can we do that more simply ? ( I know that on ABB robot there is an "Abort" Function who quit the application ).
int CyManu = getApplicationUI().displayModalDialog(ApplicationDialogType.QUESTION, "Voulez-vous éxécuter le cycle en mode T1 ?", "Oui", "Non");
switch(CyManu) {
case 0:
//oui
break;
case 1:
//non
abort = true ;
break;
Generally speaking, in any programming language, it is not a good habit to kill a thread(application) abruptly, because you never know what it is doing. If it is operating some critical object or data and is killed in the midst, these critical object will be dirty.
Actually there are 4 ways to terminate a thread in java
(1)Normal return
But sometimes it can't handle complicated scenario.
(2)Monitoring a flag. If it is time to exit the thread, you set the flag true to break the outer loop, which is the choice you have made.
Its defect is that you can't terminate a blocked thread in this way.
(3)interrupt() method of thread
When a thread's interrupt() method is called, the thread's code branch will throw an InterruptException exception if it was blocked or its method isInterrupted()/interrupted() will return true if it was running.
(4)stop() method of thread
It kills thread immediately but not safe, as mentioned. Also it is marked as depreciated.
Thanks,
So i'll keep my solution, i don't want to take risk .
Bye