Last active
February 26, 2021 18:39
-
-
Save clope031/89e696ed18cbea71b2c4295e1eb5dd40 to your computer and use it in GitHub Desktop.
CAO_RC8PRovider_Python_RobotArm_Variable.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# Send "Move" command to RC8 | |
#b-cap Lib URL | |
# https://github.com/DENSORobot/orin_bcap | |
import pybcapclient.bcapclient as bcapclient | |
### set IP Address , Port number and Timeout of connected RC8 | |
host = "127.0.0.1" | |
port = 5007 | |
timeout = 2000 | |
### Connection processing of tcp communication | |
m_bcapclient = bcapclient.BCAPClient(host,port,timeout) | |
print("Open Connection") | |
### start b_cap Service | |
m_bcapclient.service_start("") | |
print("Send SERVICE_START packet") | |
### set Parameter | |
Name = "" | |
Provider="CaoProv.DENSO.VRC" | |
Machine = ("localhost") | |
Option = ("") | |
### Connect to RC8 (RC8(VRC)provider) | |
hCtrl = m_bcapclient.controller_connect(Name,Provider,Machine,Option) | |
print("Connect RC8") | |
### get Robot Object Handl | |
HRobot = m_bcapclient.controller_getrobot(hCtrl,"Arm","") | |
print("AddRobot") | |
# get CurPos Object Handl | |
CurPosHandl = 0 | |
CurPosHandl = m_bcapclient.robot_getvariable(HRobot, "@CURRENT_POSITION", "") | |
# read value of CurPos | |
readCurPos = m_bcapclient.variable_getvalue(CurPosHandl) | |
print("Current Robot Position = ", readCurPos) | |
# Disconnect | |
if(CurPosHandl != 0): | |
m_bcapclient.variable_release(PHandl) | |
print("Release @CURRENT_POSITION Handler") | |
#End If | |
if(HRobot != 0): | |
m_bcapclient.robot_release(HRobot) | |
print("Release Robot Object") | |
#End If | |
if(hCtrl != 0): | |
m_bcapclient.controller_disconnect(hCtrl) | |
print("Release Controller") | |
#End If | |
m_bcapclient.service_stop() | |
print("B-CAP service Stop") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment