Sync to station using API

I have an automatically generated RAPID file, which I need to test for collisions using RobotStudio. I can load and run the program file on the virtual controller using the RAB API. The problem is that the program runs on the virtual controller in real time - because I have many RAPID files to test, running in real time significantly increases simulation time of my application.

For this reason I would like to synchronize to the station and run the simulation in RS.

The way I was going to try this is as follows:

  1. read RAPID file (StreamReader)

  2. extract jointtarget values/names and path name from file

  3. create RSJointTargets and MoveAbsJ objects, with extracted values/names

  4. Add objects to Station.ActiveTask

  5. Call Start() method in Simulator class

Is it neccessary to program all of these steps or is there a faster method available using the RS API?

Thanks for the help,
Neil

None of the methods in the ABB.Robotics.RobotStudio.Stations.Simulator class are available (start, stop, pause etc.) after creating an instance. When I try to build, I get the error:

“The type ‘ABB.Robotics.RobotStudio.Stations.Simulator’ has no constructors defined”

Is this class available?

Are there any methods within the RS API to synchronize to station?

Are there any methods within the RS API to play the simulation in RS (not Robotics.Controllers.RapidDomain.Task.Start())?

Thanks again,
Neil

Hi Neil,

The virtual controller is the core technology that is driving the simulation in RobotStudio. Running the simulation from RobotStudio will not be faster than running the virtual controller outside RobotStudio. There may be a minor difference in execution time if you use the “Free Run” mode of RS, but only marginally.

The Simulator methods are static, so you just call them like this:
Simulator.Start();

Hi Henrik and Johannes,

The static Simulator.Start() method works as you said.

I’ve also tried 2 different ways of running the robot program in RS:

  1. RS API:
    Simulator.Start()

  2. RAB API

Task tasks = null;
//controller object created from Scan() method
tasks = controller.Rapid.GetTasks();

using (Mastership m = Mastership.Request(controller.Rapid))
{
tasks[0].ResetProgramPointer();
tasks[0].Start(RegainMode.Continue, ExecutionMode.Continuous, ExecutionCycle.Once);
}

  1. The program is executed much faster than real time (total execution time is approximately 2s)

  2. The program appears to execute in real time (total execution time is approximately 12s)

Both methods are running the same RAPID program on the same virtual controller, but the Simulator.Start() will significantly decrease the execution time of my application.

Thanks for the help!
Neil

Hi Neil,

Thank you for the input. I am surprised to find such a big difference, that pleases me.