Show / Hide Table of Contents

Synchronizing to Station

This example provides information to synchronize data from virtual controller into RobotStudio Station. An active Station and Controller is required for this example.

RsTask and RsPathProcedure are passed as parameters. To check the result of the addin, ensure that the data appears in RobotStudio Home tab.

Use this procedure to Synchronize to Station :

  1. Get virtual controller Instance based on RsIrc5Controller object's SystemId .

  2. Request for RAPID Mastership from controller.

  3. If RAPID Mastership is granted then call SyncPathProcedure(string, SyncDirection, ArrayList) in the direction of Station.

Solution

  1. Get virtual controller Instance based on RsIrc5Controller object's SystemId.

    RsIrc5Controller rsIrc5Controller = (RsIrc5Controller)task.Parent;
    //Get Controller object
    ABB.Robotics.Controllers.Controller controller =
        new ABB.Robotics.Controllers.Controller(new Guid(rsIrc5Controller.SystemId.ToString()));
    
  2. Request for RAPID Mastership from controller.

    using (ABB.Robotics.Controllers.Mastership m =
        ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))
    
  3. If RAPID Mastership is granted then call SyncPathProcedure in the direction of Station.

    result = task.SyncPathProcedure(path.ModuleName + "/" + path.Name,
        SyncDirection.ToStation,
        messages);
    

Example

This example provides information to synchronize data from virtual controller into RobotStudio Station.

private static bool SynchronizeToStation(RsPathProcedure path, RsTask task)
{
    Project.UndoContext.BeginUndoStep("SynchronizeToStation");
    bool result = false;

    try
    {
        //Get RobotStudio Controller     
        RsIrc5Controller rsIrc5Controller = (RsIrc5Controller)task.Parent;
        //Get Controller object
        ABB.Robotics.Controllers.Controller controller =
            new ABB.Robotics.Controllers.Controller(new Guid(rsIrc5Controller.SystemId.ToString()));

        //Request for Mastership from controller 
        //If granted then call SyncPathProcedure instance method of RsTask     
        using (ABB.Robotics.Controllers.Mastership m =
            ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))
        {
            try
            {
                ArrayList messages = new ArrayList();

                //Synchronization to Station        
                result = task.SyncPathProcedure(path.ModuleName + "/" + path.Name,
                    SyncDirection.ToStation,
                    messages);

            }
            catch (Exception)
            {
                result = false;
            }
        }
    }
    catch (Exception ex)
    {
        Logger.AddMessage(new LogMessage(ex.Message.ToString()));
        Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    }
    finally
    {
        Project.UndoContext.EndUndoStep();
    }
    
    return result;
}

Required Namespaces

ABB.Robotics.RobotStudio.Environment

ABB.Robotics.Controllers.RapidDomain

See Also

  • Importing MoveInstruction
  • Loading Program
  • Synchronizing to Controller
In this article
Back to top Copyright © 2024 ABB