Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.

How to control the axes of mechanical units with SDK?

Hello everyone, I am trying to control a mechanical unit, like a robot, via an add-in. I tried the following code, but without success. The code works fine, but I cannot use the SetJointValues function to move the axes of my mechanical units. Does anyone have an example or any ideas, please?

 Station station = Station.ActiveStation;

 List<ProjectObject> objets = new List<ProjectObject>(station.GetGraphicComponents());

 foreach (ProjectObject objet in objets)
 {

     if (objet is Mechanism mecha1)
     {
         Logger.AddMessage("Flag 0");
         double[] jointValues = new double[] { 30.00, 30.00, 30.00, 30.00 };
         Logger.AddMessage(mecha1.Name);
         Logger.AddMessage(mecha1.NumActiveJoints.ToString());
         Logger.AddMessage("Flag 1");
         mecha1.SetJointValues(jointValues, false);
         Logger.AddMessage("Flag 2");
         


     }

 }



Answers

  • DenisFR
    DenisFR ✭✭✭
    Hello,

    You can have a look how I've done Here.


    ☑️2024 - RobotStudio® User Group

  • Request for the mastership before setting the values?