Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How do I collect the joints that moved when my program runs?

How can I load an rdk file with the RoboDK API and run a program to collect the path data that the robot's tool traveled?

I'm developing using the example here and wondering if there is a full reference to the commands used to socket communicate with robodk in the api source.
You can find some examples that use the RoboDK API here:

To accomplish what you described you can use AddFile to load an existing RoboDK project, you can use RunProgram to run a program and check if it finished using Busy. Also, you can use Joints or Pose to read the current pose of a robot.
private void btnRun_Program_Click(object sender, EventArgs e)
    // Check that there is a link with RoboDK:
    if (!Check_RDK()) { return; }

    string progname = txtRunProgram.Text;

    // Retrieve the program item program
    RoboDK.Item prog = RDK.getItem(progname);

    if (prog.Valid() && (prog.Type() == RoboDK.ITEM_TYPE_PROGRAM_PYTHON || prog.Type() == RoboDK.ITEM_TYPE_PROGRAM))
        while (ROBOT.Busy())
            Console.WriteLine($"Program running...{ROBOT.Pose().ToString()}");
            if (!ROBOT.Busy())
                Console.WriteLine("Program end");
        notifybar.Text = "The program " + txtRunProgram.Text + " does not exist.";
        //MessageBox.Show("The program does not exist.");

Thanks for the advice
As shown above, when I click the program execution button, if I check Busy, it outputs joints data, but this ends faster than the actual robot's behavior, and I can't synchronize it.
Instead of checking if the robot is busy you should check if the program is Busy. While the program may be running (busy), the robot may not always be busy.

To monitor robot joints while the program moves I recommend you to implement a loop like this in C#.
while (prog.Busy())
    Console.WriteLine($"Program running... Robot joints: {ROBOT.Joints().ToString()}");

Also, you can control the speed of the simulation by using setSimulationSpeed.

Users browsing this thread:
1 Guest(s)