**Attention** : Read this resource material carefully and in its entirety before use, to ensure it is understood and used properly. Failure to properly follow the instructions in the resource materials DPAM provides may result in damage to your equipment. As a result, by using the resource materials, you are assuming the risks associated with modifying your equipment. DENSO holds no liability, implied or otherwise, for damage, injury or any legal responsibility incurred, directly or indirectly from the use of the resource materials, including any loss of data or damage to property which may occur by your use of the resource materials. The use of the resource materials are not recommended unless you have technical knowledge and functional experience with the equipment and related software. DENSO is unable to provide support, remote or otherwise, for the information included in the resource material, nor for the ancillary topics relating to the information included in the resource materials. Therefore, if you are not fully comfortable with it, we strongly recommend that you send your unit to one of our Regional Support Centers for repair. The information contained in the resource materials are subject to change at the sole discretion of DPAM.
In ORiN2 SDK, DCOM (Distributed Component Object Model) of Microsoft Corporation is adopted as a distributed object technology. The DCOM based CAO can be used from various program languages such as C++, JAVA, and Visual Basic.
Since the RC8 controller, the CAO Engine is natively installed and allows the controller to communicate to not only to other DENSO Controllers but to a variety of devices.
This article is meant to help to gather information on resources that can help you get started with interfacing with the CAO Engine in C# (Visual Studio IDE). This article is not intended to aid you with programming in PACScript nor how to use Wincaps III.
Tools and Parts needed
NOTE: The following sample code is provided "AS IS" under the MIT License. Programming support service of PACScript is out of warranty.
Please make sure that you have reviewed the ORiN2 - Overview article and that your RC controller is properly setup.
|Set up your device to accept messages from your Controller. |
This step talks about what you need to do to the secondary controller you are going to communicate to. For example if you were going to run a program on an RC8 controller to communicate to a COBOTTA via CAO this step is what you need to do to enable communication in your COBOTTA.
|ORiN 2 - Robot Controller Setup (RC8 / RC8A / COBOTTA)|
At this point, you should be ready to begin programming your application to interface with your robot controller. When connecting to the controller, you will need to specify the ORiN provider you are trying to use to establish communication. The provider differs based on the robot controller you are using. RC5, RC7, and RC7M controllers use the NetwoRC provider. RC8, RC8A, and COBOTTA controllers us the RC8 provider.
NetwoRC provider directory
RC8 Provider directory
Built-in Providers (RC8 / RC8A / COBOTTA)
The RC8, RC8A, COBOTTA come with an extended number of built-in providers that you can use to interface with a variety of devices or messaging protocols. You can find information of what providers are available for each controller under the owner's manual:
RC8 / RC8A
NOTE: Please consult the Owner's manual for information on how to program your DENSO Robot or details on specific robot commands.
Programming using the Provider
The following samples are for performing various basic but essential operations. The samples are for connecting using the RC8 Provider.
For more information you can reference Section 4 RC8 Programming Using the Provider from the RC8 Provider User's Guide PDF document.
RC8 Provider User Guide Samples in PACScript
|This document intends to give you a better experience when trying to implement a command in the provider. We have "translated" the original VB6 samples in Section 5.0 from the RC8 provider guide into PACScript language. Click here to download a copy.|
The sample program uses the automatically created workspace and reads/writes the variable IO150 (the 150th I/O variable). IP should be set to the value for the target controller. This sample program uses the following value. IP:192.168.0.1
For more information, reference Section 4.1 RC8 controller variable access.
'!TITLE "Variable" Sub Main Dim g_eng As Object Dim g_ctrl As Object Dim g_val as Object 'Connect RC: IP Setting depends on your RC setting g_ctrl = cao.AddController("RC", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1") 'Variable Name "IO150" g_val = g_ctrl.AddVariable("IO150", "") 'Loop Starts Do While 1 Select Case I 'Read CaoVariable Case 1 IO = g_val.Value I = 0 'Write to CaoVariable Case 2 g_val.Value = IO I = 0 'Exit Program Case 3 'Delete Variable Object g_ctrl.Variables.Remove g_val.Index 'Delete Controller Object cao.Controllers.Remove g_ctrl.Index Exit Do End Select Loop End Sub
This sample code will start or stop a robot program (Pro1.pcs), also known as tasks.
- Controller must have a program named Pro1.pcs
- Controller must be set to Auto mode
For more information, reference Section 4.2 Task controller with RC8 controller.
'!TITLE "Task" Sub Main Dim g_eng As Object Dim g_ctrl As Object Dim g_task As Object 'Connect RC: IP Setting depends on your RC setting g_ctrl = cao.AddController("RC", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1") 'Task Name PRO1 g_task = g_ctrl.AddTask("PRO1","") Do While 1 Select Case I 'Start Task Case 1 g_task.start 1 I = 0 'Stop Task Case 2 g_task.stop 2 I = 0 'Exit Program Case 3 g_ctrl.tasks.Remove g_task.Index cao.Controllers.Remove g_ctrl.Index Exit Do End Select Loop End Sub
Robot Motion Sample
This sample code will turn the motor ON or OFF. When the Start Robot button is pressed, the robot will Move to position P10 and then to position P11.
- Global variables P10 and P11 must have valid coordinate data
- Robot state must be set to Auto mode
For more information, reference Section 4.3 Robot control with RC8 controller.
'!TITLE "RobotProgram" Sub Main Dim g_eng As Object Dim g_ctrl As Object Dim g_robot As Object Dim g_robotVar As Object Dim g_haltFlag As Integer 'Connect RC: IP Setting depends on your RC setting g_ctrl = cao.AddController("RC", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1") 'Create CaoRobot object g_robot = g_ctrl.AddRobot("Arm") 'Argument used to check arm running status g_robotVar = g_robot.AddVariable("@BUSY_STATUS") 'Get arm control authority g_robot.Execute "Takearm" 'Start Motor g_robot.Execute "Motor", Array(1,0) Do While 1 Select Case I 'Start motor if arm is stationary Case 1 If g_robotVar.Value = False Then g_robot.Execute "Motor", Array(1,0) End If I = 0 'Stop motor if arm is stationary Case 2 If g_robotVar.Value = False Then g_robot.Execute "Motor", Array(0,0) End If I = 0 'Stop Robot Case 3 g_robot.Halt 'Record robot stop g_haltFlag = 1 I = 0 'Start Motion Case 4 'Do not run new operation instruction if arm is running If g_robotVar.Value = True Then I = 0 Exit Do End If g_haltFlag = 0 'Run robot g_robot.Move 1, "@P P10", "Next" 'Do not start new motion until previous motion is completed Do Delay 100 Loop Until g_robotVar.Value = False 'Do not start new motion if robot has stopped If g_haltFlag = 1 Then I = 0 Exit Do End If 'Run Robot g_robot.Move 1, "@P P11", "Next" I = 0 'Exit Loop Case 5 'Stop Motor g_robot.Execute "Motor", Array(0,0) 'Release arm control authority g_robot.Execute "Givearm" g_robot.Variables.Remove g_robotVar.Index g_ctrl.Robots.Remove g_robot.Index cao.Controllers.Remove g_ctrl.Index Exit Do End Select Loop End Sub
You can find PACScript samples in your install of the ORiN 2 SDK. Here are some recommendations:
RC8 Provider Samples
|Sample Name||Directory Path|
NetwoRC Provider Samples
|Sample Name||Directory Path|
Built-in Provider Samples
RC8 / RC8A - Sample Data of Providers
COBOTTA - Sample Data of Providers