Difference between revisions of "COBOTTA Rest API"

From RobotinoWiki
m (LDWR moved page User:LDWR to COBOTTA Rest API without leaving a redirect: Release and rename)
m
Line 13: Line 13:
 
* Get a list of robot programs <br>
 
* Get a list of robot programs <br>
 
The API is acessable on localhost port 8280.
 
The API is acessable on localhost port 8280.
All return values will be json object style.
+
All parameters and return values will be json object style.
 
|}
 
|}
  
==PUT==
+
==POST==
===/cobotta/Connect/<host>/, defaults={'port': 5007, 'timeout':2000} ===
+
===/cobotta/Connect/, defaults={'port': 5007, 'timeout':2000} ===
===/cobotta/Connect/<host>/<port>/<timeout>===
+
A connection to a COBOTTA is established.
A connection to the COBOTTA is established.
 
  
'''Arguments:'''<br>
+
'''Parameter:'''<br>
 
''host:'' (str) IP address of COBOTTA<br>
 
''host:'' (str) IP address of COBOTTA<br>
 
''port:'' (int) TCP communication port -- default: 5007<br>
 
''port:'' (int) TCP communication port -- default: 5007<br>
Line 28: Line 27:
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Connect/172.21.0.30/
+
     http://127.0.0.1:8280/cobotta/Connect/
 +
    Parameter:
 +
        {"host" : "172.21.0.30"}
 
</pre>
 
</pre>
 
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 36: Line 36:
 
</pre>
 
</pre>
  
===/cobotta/StartProgram/<progname>/, defaults={'mode': 1}===
+
 
===/cobotta/StartProgram/<progname>/<mode>===
+
==PUT==
 +
===/cobotta/Program/Start, defaults={'mode': 1}===
 
Starts a CobottaWorld robot program.  
 
Starts a CobottaWorld robot program.  
 
The program name is handled internally as upper case.  
 
The program name is handled internally as upper case.  
  
'''Arguments:'''<br>
+
'''Parameter:'''<br>
 
''progname:'' (str) name of CobottaWorld robot program<br>
 
''progname:'' (str) name of CobottaWorld robot program<br>
 
''mode:'' (int) execution mode -- default: 1 <br>
 
''mode:'' (int) execution mode -- default: 1 <br>
Line 49: Line 50:
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/StartProgram/HOME/
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Program/Start/
 +
    Parameter:
 +
        {"progname" : "HOME"}
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 56: Line 60:
 
</pre>
 
</pre>
  
===/cobotta/Override/<ovrd>===
+
===/cobotta/Override/===
 
Set COBOTTA override to specified value.
 
Set COBOTTA override to specified value.
  
 
'''Example'''
 
'''Example'''
    http://127.0.0.1:8280/cobotta/Override/50
 
 
'''Return'''
 
 
<pre>
 
<pre>
     {"result" : "OK"}
+
     http://127.0.0.1:8280/cobotta/Override/
 +
    Parameter:
 +
        {"ovrd" : 50}  
 
</pre>
 
</pre>
 
===/cobotta/Io/<number>===
 
Read IO variable from COBOTTA.
 
Some IO signals are predefined. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.
 
 
'''Arguments:''' <br>
 
''number:'' (int) number of IO <br>
 
Returns: <br>
 
(bool) IO variable value
 
 
'''Example'''
 
    http://127.0.0.1:8280/cobotta/Io/128
 
 
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
     {"result" : "OK",
+
     {"result" : "OK"}
    "value" : True}
 
 
</pre>
 
</pre>
  
===/cobotta/Io/<number>/<value>===
+
===/cobotta/Io/<num>/===
 
Write IO variable to COBOTTA.  
 
Write IO variable to COBOTTA.  
 
Some IO signals are predefined and restricted to use. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.
 
Some IO signals are predefined and restricted to use. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.
  
'''Arguments:''' <br>
+
'''Parameter:''' <br>
''number:'' (int) number of IO <br>
+
''num:'' (int) number of IO <br>
''value:'' (bool) value of IO variable  
+
''val:'' (bool) value of IO variable  
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/Io/128/True
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Io/128
 +
    Parameter:
 +
        {"val" : True}
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 101: Line 93:
 
</pre>
 
</pre>
  
===/cobotta/Errors/<errorIndex>===
+
===/cobotta/Errors/===
 
Read a more detailed error inforamtion from robot error list.
 
Read a more detailed error inforamtion from robot error list.
  
'''Arguments:''' <br>
+
'''Parameter:''' <br>
 
''errorIndex:'' (int) 0-based index of the error list <br>
 
''errorIndex:'' (int) 0-based index of the error list <br>
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/Errors/1
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Errors/
 +
    Parameter:
 +
        {"errorIndex" : 0}
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
     {"errorCode"    : info[0],         #(VT_I4)
+
     {"errorCode"    : info[0],
     "errorMessage"  :  info[1],        #(VT_BSTR)
+
     "errorMessage"  :  info[1]}
    "errorDescription" : description,  #(VT_BSTR)
 
    "subCode"      :  info[2],        #(VT_I4)
 
    "fileID"        :  file_id,        #(VT_I4)
 
    "lineNumber"    :  line_number,    #(VT_I4)
 
    "programName"  :  info[4],        #(VT_BSTR)
 
    "lineNumber"    :  info[5],        #(VT_I4)
 
    "fileID"        :  info[6]          #(VT_I4)}
 
 
</pre>
 
</pre>
  
Line 126: Line 114:
 
===/cobotta/Disconnect/===
 
===/cobotta/Disconnect/===
 
'''Example'''
 
'''Example'''
 +
<pre>
 
     http://127.0.0.1:8280/cobotta/Disconnect/
 
     http://127.0.0.1:8280/cobotta/Disconnect/
 
+
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 141: Line 130:
  
 
'''Example'''
 
'''Example'''
 +
<pre>
 
     http://127.0.0.1:8280/cobotta/StartMotionPreparation/
 
     http://127.0.0.1:8280/cobotta/StartMotionPreparation/
 
+
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 148: Line 138:
 
</pre>
 
</pre>
  
===/cobotta/GetProgramList/===
+
===/cobotta/Program/GetList/===
 
Get the program names of CobottaWorld programs and returns them as string array.
 
Get the program names of CobottaWorld programs and returns them as string array.
 
The update is also done during the instantiation.
 
The update is also done during the instantiation.
Line 154: Line 144:
  
 
'''Example'''
 
'''Example'''
    http://127.0.0.1:8280/cobotta/GetProgramList/
 
 
'''Return'''
 
 
<pre>
 
<pre>
     {"result" : "OK",
+
     http://127.0.0.1:8280/cobotta/Program/GetList/
    "programs" : "HOME", "PickPart", "PropPart"}
 
 
</pre>
 
</pre>
 
===/cobotta/StartHome/===
 
Starts the HOME program. HOME program has to be defined in CobottaWorld app.
 
This method is also used internally to drive to HOME position in MotionPreparation method.
 
 
'''Example'''
 
    http://127.0.0.1:8280/cobotta/StartHome/
 
 
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
     {"result" : "OK"}
+
     {"result" : "OK",
 +
    "programs" : ["HOME", "PickPart", "PropPart"]}
 
</pre>
 
</pre>
  
===/cobotta/ResumeProgram/===
+
===/cobotta/Program/Resume/===
 
Continues a CobottaWorld robot program. E.g. after error reset.
 
Continues a CobottaWorld robot program. E.g. after error reset.
 
The program has to be started with "StartProgram" method, first.  
 
The program has to be started with "StartProgram" method, first.  
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/ResumeProgram/
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Program/Resume/
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 186: Line 166:
 
</pre>
 
</pre>
  
===/cobotta/StopPrograms/===
+
===/cobotta/Program/Stop/===
 
Stops all running robot programs.  
 
Stops all running robot programs.  
 
Programs will be stopped immediately.  
 
Programs will be stopped immediately.  
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/StopPrograms/
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Program/Stop/
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 198: Line 179:
 
</pre>
 
</pre>
  
===/cobotta/CycleEnd/===
+
===/cobotta/Program/CycleEnd/===
 
End all running robot programs.
 
End all running robot programs.
 
Programs will be stopped at the end of the program.  
 
Programs will be stopped at the end of the program.  
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/CycleEnd/
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Program/CycleEnd/
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 210: Line 192:
 
</pre>
 
</pre>
  
===/cobotta/ResetError/===
+
===/cobotta/Errors/Reset===
 
Resets all errors of COBOTTA.  
 
Resets all errors of COBOTTA.  
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/ResetError/
+
<pre>
 
+
     http://127.0.0.1:8280/cobotta/Errors/Reset/
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 226: Line 209:
  
 
'''Example'''
 
'''Example'''
 +
<pre>
 
     http://127.0.0.1:8280/cobotta/Errors/
 
     http://127.0.0.1:8280/cobotta/Errors/
 
+
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 238: Line 222:
  
 
'''Example'''
 
'''Example'''
 +
<pre>
 
     http://127.0.0.1:8280/cobotta/Override/
 
     http://127.0.0.1:8280/cobotta/Override/
 
+
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 250: Line 235:
  
 
'''Example'''
 
'''Example'''
 +
<pre>
 
     http://127.0.0.1:8280/cobotta/Status/
 
     http://127.0.0.1:8280/cobotta/Status/
 
+
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
Line 259: Line 245:
 
     "normalStatus" : status[2],
 
     "normalStatus" : status[2],
 
     "servoStatus" : status[3] }
 
     "servoStatus" : status[3] }
 +
   
 +
    status will be True or False
 
</pre>
 
</pre>
  
===/cobotta/BusyStatus/===
+
===/cobotta/Status/Busy/===
 
During motion preperation the communication to COBOTTA is blocked by motion preperation task. For this reason status update with /cobotta/Status doesn't work. /cobotta/BusyStatus uses in that case a flag which is set before and reset after motion preperation is done.   
 
During motion preperation the communication to COBOTTA is blocked by motion preperation task. For this reason status update with /cobotta/Status doesn't work. /cobotta/BusyStatus uses in that case a flag which is set before and reset after motion preperation is done.   
  
 
'''Example'''
 
'''Example'''
     http://127.0.0.1:8280/cobotta/BusyStatus/
+
<pre>
 +
     http://127.0.0.1:8280/cobotta/Status/Busy
 +
</pre>
 +
'''Return'''
 +
<pre>
 +
    {"result" : "OK",
 +
    "busy" : status}
 +
   
 +
    status will be True or False
 +
</pre>
  
 +
===/cobotta/Io/<num>===
 +
Read IO variable from COBOTTA.
 +
Some IO signals are predefined. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.
 +
 +
'''Parameter:''' <br>
 +
''num:'' (int) number of IO <br>
 +
Returns: <br>
 +
(bool) IO variable value
 +
 +
'''Example'''
 +
<pre>
 +
    http://127.0.0.1:8280/cobotta/Io/128
 +
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "busy" : True}
+
     "val" : value}
 +
 
 +
    value will be True or False
 
</pre>
 
</pre>
  

Revision as of 14:14, 16 April 2021

Introduction

This RESTful API which uses cobottabcap python class to communicate with denso robotics COBOTTA.

It provides several PUT/GET methods to control the COBOTTA such as

  • Connect/Dissconnect to COBOTTA
  • Start/Stop CobottaWorld program
  • Read/Write IOs
  • Get COBOTTA error status, description
  • Reset COBOTTA error
  • Get COBOTTA status information
  • Get/Set COBOTTA override
  • Get a list of robot programs

The API is acessable on localhost port 8280. All parameters and return values will be json object style.

POST

/cobotta/Connect/, defaults={'port': 5007, 'timeout':2000}

A connection to a COBOTTA is established.

Parameter:
host: (str) IP address of COBOTTA
port: (int) TCP communication port -- default: 5007
timeout: (int) time to connection timeout [10ms] -- default: 2000

Example

    http://127.0.0.1:8280/cobotta/Connect/
    Parameter:
        {"host" : "172.21.0.30"}

Return

    {"result" : "OK"}


PUT

/cobotta/Program/Start, defaults={'mode': 1}

Starts a CobottaWorld robot program. The program name is handled internally as upper case.

Parameter:
progname: (str) name of CobottaWorld robot program
mode: (int) execution mode -- default: 1
1:One cycle execution
2:Continuous execution
3:Step forward

Example

    http://127.0.0.1:8280/cobotta/Program/Start/
    Parameter:
        {"progname" : "HOME"} 

Return

    {"result" : "OK"}

/cobotta/Override/

Set COBOTTA override to specified value.

Example

    http://127.0.0.1:8280/cobotta/Override/
    Parameter:
        {"ovrd" : 50} 

Return

    {"result" : "OK"}

/cobotta/Io/<num>/

Write IO variable to COBOTTA. Some IO signals are predefined and restricted to use. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.

Parameter:
num: (int) number of IO
val: (bool) value of IO variable

Example

    http://127.0.0.1:8280/cobotta/Io/128
    Parameter:
        {"val" : True}

Return

    {"result" : "OK"}

/cobotta/Errors/

Read a more detailed error inforamtion from robot error list.

Parameter:
errorIndex: (int) 0-based index of the error list

Example

    http://127.0.0.1:8280/cobotta/Errors/
    Parameter:
        {"errorIndex" : 0}

Return

    {"errorCode"     : info[0],
     "errorMessage"  :  info[1]}

GET

/cobotta/Disconnect/

Example

    http://127.0.0.1:8280/cobotta/Disconnect/

Return

    {"result" : "OK"}

/cobotta/StartMotionPreparation/

This method sould be called once after switching on the COBOTTA or if the COBOTTA had a hard collision. The COBOTTA prepares it's system for operation and drives to the CALSET position. Make sure that there are no obstacles around the COBOTTA before running the motion preperation. Refer to manual ID : 7291 for detaild information about COBOTTA startup. After axis calibration the "HOME" program is started. HOME program has to be defined in CobottaWorld app.

Example

    http://127.0.0.1:8280/cobotta/StartMotionPreparation/

Return

    {"result" : "OK"}

/cobotta/Program/GetList/

Get the program names of CobottaWorld programs and returns them as string array. The update is also done during the instantiation. If your program isn't listed you may need to update the "Job_PCS.h" file.

Example

    http://127.0.0.1:8280/cobotta/Program/GetList/

Return

    {"result" : "OK",
     "programs" : ["HOME", "PickPart", "PropPart"]}

/cobotta/Program/Resume/

Continues a CobottaWorld robot program. E.g. after error reset. The program has to be started with "StartProgram" method, first.

Example

    http://127.0.0.1:8280/cobotta/Program/Resume/

Return

    {"result" : "OK"}

/cobotta/Program/Stop/

Stops all running robot programs. Programs will be stopped immediately.

Example

    http://127.0.0.1:8280/cobotta/Program/Stop/

Return

    {"result" : "OK"}

/cobotta/Program/CycleEnd/

End all running robot programs. Programs will be stopped at the end of the program.

Example

    http://127.0.0.1:8280/cobotta/Program/CycleEnd/

Return

    {"result" : "OK"}

/cobotta/Errors/Reset

Resets all errors of COBOTTA.

Example

    http://127.0.0.1:8280/cobotta/Errors/Reset/

Return

    {"result" : "OK"}

/cobotta/Errors/

Returns the number of currently issued errors. If it returns an error count of 0 than there is no error.

Example

    http://127.0.0.1:8280/cobotta/Errors/

Return

    {"result" : "OK",
     "errorCount" : count }

/cobotta/Override/

Read current COBOTTA override.

Example

    http://127.0.0.1:8280/cobotta/Override/

Return

    {"result" : "OK",
     "override" : 50 }

/cobotta/Status/

Read status variables from COBOTTA.

Example

    http://127.0.0.1:8280/cobotta/Status/

Return

    {"result" : "OK",
     "emergencyStop" : status[0],
     "busyStatus" : status[1],
     "normalStatus" : status[2],
     "servoStatus" : status[3] }
    
     status will be True or False

/cobotta/Status/Busy/

During motion preperation the communication to COBOTTA is blocked by motion preperation task. For this reason status update with /cobotta/Status doesn't work. /cobotta/BusyStatus uses in that case a flag which is set before and reset after motion preperation is done.

Example

    http://127.0.0.1:8280/cobotta/Status/Busy

Return

    {"result" : "OK",
     "busy" : status}
    
     status will be True or False 

/cobotta/Io/<num>

Read IO variable from COBOTTA. Some IO signals are predefined. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.

Parameter:
num: (int) number of IO
Returns:
(bool) IO variable value

Example

    http://127.0.0.1:8280/cobotta/Io/128

Return

    {"result" : "OK",
     "val" : value}

     value will be True or False

Change Log

This are the changes in cobottabcap class.
You can check your version with cobotta/version/.

Date Version Changes
22.01.2021 1.0.0 first Release

COBOTTA® is a registered trademark of Denso Corporation in certain countries.