ORiN 2 – Programming in Python 3 (bCAP Packets)

  1. Home
  2. Knowledge Base
  3. PC Communication
  4. ORiN 2 – Programming in Python 3 (bCAP Packets)

**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.

Overview

b-CAP is a communication protocol to access CAO provider and improve the transmission rate. b-CAP has the same service structure as the object of CAO provider. b-CAP is mounted as TCP stream communication. Since b-CAP packet does not contain check code, and error-free protocol is required at the lower-layer protocol.

This article is meant to help to gather information on resources that can help you get started with interfacing with the library to build bCAP packets in Python 3 (bCAPClient). This article is not intended to aid you with programming in Python.

Tools and Parts needed

NOTE:
The following sample code is provided “AS IS” under the MIT License. Programming support service of Python is out of warranty. Please note that we do not provide any programming support service beyond basic setup and troubleshooting.

Previous Steps…

Please make sure that you have reviewed the ORiN 2 – Overview article and that your RC controller is properly setup. You can use the CAOTester to make sure that your PC is ready to communicate with the controller.

Setup your controller to accept messages from your PC.
Test communication using bCAP Tester application (Windows OS only)

RC7 bCAP Tester
C:\ORiN2\CAP\b-CAP\CapLib\DENSO\RC7\Bin\b-CAP Tester.exe

RC8 (VRC) bCAP Tester
C:\ORiN2\CAP\b-CAP\CapLib\DENSO\RC8\Bin\b-CAP Tester_RC8.exe

Locate bCAP Library (bCAPClient.py) for Python

C:\ORiN2\CAP\b-CAP\CapLib\DENSO\RC8\Include\Python

Programming References

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
C:\ORiN2\CAO\ProviderLib\DENSO\NetwoRC

RC8 Provider provider directory
C:\ORiN2\CAO\ProviderLib\DENSO\RC8

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.

Variable Sample

This sample code shows how to read from and write to various the global variable data types from the Global Variable in the controller. several global variables (integer, single precision real number, double precision real number, position, and string.

  • The write value for integer variable I1 will be >> write value = current value + 1
  • The write value for single precision variable F1 and double precision D1 will be >> write value = current value + 1.1
  • The write value for position variable P1 will be >> write value = P(current x + 1.1, current y + 2.2, current z + 3.3, current rx + 4.4, current ry + 5.5, current rz + 6.6, current fig + 0)
  • The write value for string variable S1 will be >> write value = current text + the word “hoge”

For more information reference Section 4.1 RC8 controller variable access.

Task Sample

This sample code will start or stop a robot program (Pro1.pcs), also known as tasks, based on the mode value.

Prerequisites:

  • Controller must have a program named Pro1.pcs
  • Controller must be set to Auto mode
  • Set program variable mode to the desired value.

For more information reference Section 4.2 Task controller with RC8 controller.

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 P1 and then to position P2.

Prerequisites:

  • 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.

More samples…

You can find Python on GitHub. Here are some recommendations:

RC8 Provider Samples
Sample NameDirectory Path
Read / Write Single Variableshttps://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/01_00_ReadWrite.py
Read / Write All Variableshttps://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/01_01_ReadWrite.py
Set / Reset IOhttps://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/02_00_IOReadWrite.py
Taskhttps://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/03_00_Task.py
Task (loop)https://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/03_01_Task.py
Robot Motionhttps://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/04_00_Move.py
Robot Motion (bCAP Slave)https://github.com/DENSO-2DLab/orin_bcap_python_samples/blob/master/SimpleSamples/05_00_slvMove.py
3D Mouse Controlhttps://github.com/DENSO-2DLab/orin_bcap_python_samples/tree/master/3DMouse_Controll
MasterSlavehttps://github.com/DENSO-2DLab/orin_bcap_python_samples/tree/master/MasterSlave
Othershttps://github.com/DENSO-2DLab/orin_bcap_python_samples/tree/master/others

Owner’s Manual Reference

https://www.fa-manuals.denso-wave.com/en/usermanuals/001102/


Was this article helpful?

Related Articles