Stopwatch "Average Time" API code: RobotStudio add-in

Hi there,

I am working on a RobotStudio add-in as a part of my thesis project. It involves simulating a given path by some other software and calculating the time taken by the robot to follow the path. This calculated time shall be sent back to the other software. I managed to generate the path given by the other software, simulate it and make a stopwatch that calculates the correct time that I need using C# API codes. (Visual Studio)

The thing is I can see the value that I need when launching the functions I created. I now need to save the “Total Time” or “Average Time” of the stopwatch in a variable inside my add-in to be able to send it to some other software.

So basically I constructed a SimulationStopwatch called stopwatch, configured it how I want it to be and I need something like double time = stopwatch.GetTotalTime(); to store this value when the simulation is finished. (I will read this value when a simulation stopped event is triggered)

Does anyone know the API code to call/get this variable (“Total Time” or “Average Time”)?
(Other solutions to calculate the time of a path are well appreciated too)

Thank you in advance,

Seppe

Hi there,
I have the very same problem, but I didn’t get as far as you did. Can you explain how to set up a stoppwatch from the api?

As far as I understand, one can instantiate the class SimulationConfiguration and then add a SimulationStopwatch to the collection. But How do I parametrize the stopwatch trigger?

Beside the stopwatch I would like to measure other data from the signal analyzer. Can someone provide any help?

Best regards

Hi,
I take over the project from seuv (Seppe). You can see the SimulationStoppwatch code in the txt.file below. I hope it will help you.

But I don’t find a solution to call/get the variable (“Total Time” or “Average Time”) yet.

Have anybody an idea or example for an API code to get this time?

Best regards

Thore

This is the text file with the SimulationStoppwatch code.
SimulationStoppwatch.txt (2.06 KB)