RobotStudio event

Reading Rapid Data from RS API

Options
Hello,
  So here is what I'm trying to do.  While running my RS simulation  I have three different tools active at different times.  When these tools are active it does not change the active tool for the station.  I am able to change the station active tool through the use of API Macros but it does not fulfill what I want to accomplish.  I want to know which tool is active in the simulation while it is executing.  Is this possible?  If so how because I cannot figure it out. 

 

Thank You,

Rick
Rick Lemberg

Comments

  • Seriously no one has a response to this????
    Rick Lemberg
  • mattdavis
    Options
    Sorry have't checked for a while, i use multiple tools and have a tool changer setup with 4 tools mounted in it. I tied events to the inputs and outputs of the tool changer to show/hide the correct tool. I couldn't figure out how to make the tool image change just depending on which tool the current command was using. 

    For testing i just have all four tools (8 actually because i have two different angle welding necks and have them with and without wire stickout for touch sensing) attached to the robot and show/hide the one i am using, the only way i can control it in the rapid program was to use event manager and tie inputs and outputs to events.
  • Thanks for the response.  Is there anyway for an API Macro to read rapid data from the TP?
     

    Thanks,
    Rick Lemberg
  • Hi Rick,
     

    you can use PC SDK to read the content of a RAPID variable from the controller, and to search for variables.

     

    Here is a snippet from an example in the PC SDK Reference Manual.

    It calculates the sum of the variable "reg1" in all tasks.

     

     int result = 0;
           try { // Get all tasks
               Task[] tasks = _controller.Rapid.GetTasks();
              
               foreach (Task t in tasks)
               {
                   RapidData rdReg1 = t.GetRapidData("user", "reg1");
                  
                   result += int.Parse(rdReg1.Value.ToString());
               }
           }

    For some RAPID datatypes there are specific PC SDK classes, for example robtarget and tooldata.

    If you have found a tooldata you can cast the RapidData object returned from GetRapiData() to a ToolData object which makes it easier to read and write individual members of the tooldata instead of interpreting the value as string.

     

    In order to use PC SDK you must add references to the ABB.Robotics.dll and ABB.Robotics.Controllers.dll to your project. They can be found in the GAC and in the RAB installation folder for example "C:Program FilesABB Industrial ITRobotics ITRobot Application Builder 5.12PC SDK"
    Niklas Skoglund2009-10-27 15:10:36

    Best Regards, Niklas Skoglund
    ABB Robotics

    Developer Center
    RobotStudio Blog