UnderAutomation
Une question ?

[email protected]

Contactez-nous
UnderAutomation
⌘Q
Cette page est disponible uniquement en anglais.

VAL 3 tasks

List the VAL 3 tasks with their state, program line and runtime error, then suspend, resume or kill a task.

  • List the tasks
  • Suspend, resume and kill
  • Try it in the demo application
  • Reference

This page shows how to follow and control the VAL 3 tasks of a Staubli CS8 or CS9 controller: list them with their state, their program line and their runtime error, then suspend, resume or kill a task.

List the tasks

GetTasks() returns every task of the controller.

var controller = new StaubliController();
controller.Connect("192.168.0.254");
ControllerTask[] tasks = controller.Soap.GetTasks();
foreach (ControllerTask task in tasks)
{
// State: Idle, Transition, Running, Stepping, Stopped
Console.WriteLine($"{task.Name} ({task.State}), priority {task.Priority}, created by {task.CreatedBy}");
// Line of the VAL 3 program that the task executes
ProgramLine line = task.ProgramLine;
if (line != null)
Console.WriteLine($" {line.ProgramName}:{line.LineNumber} {line.LineContent}");
// Runtime error of the task, 0 when there is none
if (task.RuntimeError != 0)
Console.WriteLine($" Error {task.RuntimeError}: {task.RuntimeErrorDescription}");
}
controller.Disconnect();
}
Click to see the full code
PropertyMeaning
NameName of the task
CreatedByThe project that created the task
StateIdle, Transition, Running, Stepping or Stopped
PriorityPriority of the task
ProgramLineApplication, program, line number and text of the current line
RuntimeErrorCode of the runtime error of the task, 0 when there is none
RuntimeErrorDescriptionText of the runtime error

RuntimeError is the way to detect that a VAL 3 program stopped on an error. See Monitor the state of the robot.

Suspend, resume and kill

A task is identified by its name and by the project that created it: pass Name and CreatedBy as they come from GetTasks().

var controller = new StaubliController();
controller.Connect("192.168.0.254");
// A task is identified by its name and by the project that created it
ControllerTask task = controller.Soap.GetTasks().First(t => t.Name == "myTask");
// Pause the task
controller.Soap.TaskSuspend(task.Name, task.CreatedBy);
// Continue it
controller.Soap.TaskResume(task.Name, task.CreatedBy);
// Stop it for good
controller.Soap.TaskKill(task.Name, task.CreatedBy);
controller.Disconnect();
}
Click to see the full code
  • TaskSuspend pauses the task.
  • TaskResume continues a suspended task.
  • TaskKill stops the task for good.

When the task does not exist, the method throws a CustomSoapException with the code TaskNotFound.

Try it in the demo application

Everything on this page can be tried without writing code, in the VAL Applications page of the demo application.

VAL Applications page of the Staubli SDK demo application

The demo application is open source. The C# source of this page is ValApplicationsControl.cs.

Reference

Methods of SoapClientBase :
C#
// Get all the tasks available on the controller
ControllerTask[] GetTasks();
// Kill a task on the controller
void TaskKill(string taskName, string createdBy);
// Resume a task on the controller
void TaskResume(string taskName, string createdBy);
// Suspend a task on the controller
void TaskSuspend(string taskName, string createdBy);
Class
ControllerTask
C#Python

Represents a task running on the controller.

MemberTypeDescription
ControllerTask()
Constructor
Initializes a new instance of the ControllerTask class.
CreatedBy
Property
string
Name of the entity that created the task.
Name
Property
string
Name of the task.
Priority
Property
int
Priority level of the task.
ProgramLine
Property
ProgramLine
Current program line being executed by the task.
RuntimeError
Property
int
Runtime error code (0 if no error).
RuntimeErrorDescription
Property
string
Human-readable description of the runtime error.
State
Property
ControllerTaskState
Current execution state of the task.
Equals(object)
Method
bool
GetHashCode()
Method
int
ToString()
Method
string
Enum
ControllerTaskState
C#Python

Execution state of a controller task.

NameValueDescription
Idle
0
Task is idle and not executing.
Running
2
Task is currently running.
Stepping
3
Task is executing step by step.
Stopped
4
Task is stopped.
Transition
1
Task is transitioning between states.
Class
ProgramLine
C#Python

Represents a line of a VAL3 program being executed on the controller.

MemberTypeDescription
ProgramLine()
Constructor
Initializes a new instance of the ProgramLine class.
ApplicationName
Property
string
Name of the application containing the program.
LineContent
Property
string
Content of the line being executed.
LineNumber
Property
int
Line number currently being executed.
ProgramName
Property
string
Name of the program.
Equals(object)
Method
bool
GetHashCode()
Method
int
ToString()
Method
string

Intégrez facilement les robots Universal Robots, Fanuc, Yaskawa, ABB ou Staubli dans vos applications .NET, Python, LabVIEW ou Matlab

UnderAutomation
Contactez-nousLegal

© All rights reserved.