Difference between revisions of "COBOTTA Rest API"

From RobotinoWiki
m
Line 10: Line 10:
 
* Reset COBOTTA error  
 
* Reset COBOTTA error  
 
* Get COBOTTA status information
 
* Get COBOTTA status information
* Get/Set COBOTTA override
+
* Get/Set COBOTTA speed
 
* 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.
Line 16: Line 16:
 
|}
 
|}
  
==POST==
+
==PUT==
===/cobotta/Connect/, defaults={'port': 5007, 'timeout':2000} ===
+
===/cobotta/Reference/===
A connection to a COBOTTA is established.
+
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.
  
 
'''Parameter:'''<br>
 
'''Parameter:'''<br>
''host:'' (str) IP address of COBOTTA<br>
+
''execute:'' (bool as int 0/1) execute the operation <br>
''port:'' (int) TCP communication port -- default: 5007<br>
 
''timeout:'' (int) time to connection timeout [10ms] -- default: 2000<br>
 
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Connect/
+
     http://127.0.0.1:8280/cobotta/Reference/
 
     Parameter:
 
     Parameter:
         {"host" : "172.21.0.30"}
+
         {"execute" : 1}
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 36: Line 38:
 
</pre>
 
</pre>
  
 
+
===/cobotta/Program/Start===
==PUT==
+
Start a CobottaWorld program.
===/cobotta/Program/Start, defaults={'mode': 1}===
 
Starts a CobottaWorld robot program.  
 
 
The program name is handled internally as upper case.  
 
The program name is handled internally as upper case.  
  
 
'''Parameter:'''<br>
 
'''Parameter:'''<br>
 +
''execute:'' (bool as int 0/1) execute the operation <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:'' (optional)(int) execution mode -- default: 1 <br>
 
1:One cycle execution <br>
 
1:One cycle execution <br>
 
2:Continuous execution <br>
 
2:Continuous execution <br>
Line 53: Line 54:
 
     http://127.0.0.1:8280/cobotta/Program/Start/
 
     http://127.0.0.1:8280/cobotta/Program/Start/
 
     Parameter:
 
     Parameter:
         {"progname" : "HOME"}  
+
         {"execute" : 1,
 +
        "progname" : "HOME"}  
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 60: Line 62:
 
</pre>
 
</pre>
  
===/cobotta/Override/===
+
===/cobotta/Program/Stop/===
Set COBOTTA override to specified value.
+
Stops all running robot programs. <br>
 +
Programs will be stopped immediately and connot be continued.  
 +
 
 +
'''Parameter:'''<br>
 +
''execute:'' (bool as int 0/1) execute the operation <br>
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Override/
+
     http://127.0.0.1:8280/cobotta/Program/Stop/
 
     Parameter:
 
     Parameter:
         {"ovrd" : 50}  
+
         {"execute" : 1}  
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 74: Line 80:
 
</pre>
 
</pre>
  
===/cobotta/Io/<num>/===
+
===/cobotta/Program/Hold/===
Write IO variable to COBOTTA.  
+
End all running robot programs.<br>
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.
+
Program will be stopped. The program can be continued by issuing Resume command.  
  
'''Parameter:''' <br>
+
'''Parameter:'''<br>
''num:'' (int) number of IO <br>
+
''execute:'' (bool as int 0/1) execute the operation <br>
''val:'' (bool) value of IO variable
 
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Io/128
+
     http://127.0.0.1:8280/cobotta/Program/Hold/
 
     Parameter:
 
     Parameter:
         {"val" : True}
+
         {"execute" : 1}  
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 93: Line 98:
 
</pre>
 
</pre>
  
===/cobotta/Errors/===
+
===/cobotta/Program/Resume/===
Read a more detailed error inforamtion from robot error list.
+
Continues a CobottaWorld robot program. E.g. after error reset.<br>
 +
The program has to be started with "StartProgram" method, first.  
  
'''Parameter:''' <br>
+
'''Parameter:'''<br>
''errorIndex:'' (int) 0-based index of the error list <br>
+
''execute:'' (bool as int 0/1) execute the operation <br>
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Errors/
+
     http://127.0.0.1:8280/cobotta/Program/Resume/
 
     Parameter:
 
     Parameter:
         {"errorIndex" : 0}
+
         {"execute" : 1}
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
     {"errorCode"     : info[0],
+
     {"result" : "OK"}
    "errorMessage" :  info[1]}
 
 
</pre>
 
</pre>
  
==GET==
+
===/cobotta/Speed/===
===/cobotta/Disconnect/===
+
Set COBOTTA speed to specified value.
 +
 
 +
'''Parameter:'''<br>
 +
''value:'' (int) Speed set value [%]
 +
 
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Disconnect/
+
     http://127.0.0.1:8280/cobotta/Speed/
 +
    Parameter:
 +
        {"speed" : 50}
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 122: Line 133:
 
</pre>
 
</pre>
  
===/cobotta/StartMotionPreparation/===
+
===/cobotta/Io/<number>/===
This method sould be called once after switching on the COBOTTA or if the COBOTTA had a hard collision.
+
Write IO variable to COBOTTA. <br>
The COBOTTA prepares it's system for operation and drives to the CALSET position.
+
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.
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.
+
'''Parameter:''' <br>
After axis calibration the "HOME" program is started. HOME program has to be defined in CobottaWorld app.
+
''number:'' (int) number of IO <br>
 +
''value:'' (bool as int 0/1) value of IO variable
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/StartMotionPreparation/
+
     http://127.0.0.1:8280/cobotta/Io/128
 +
    Parameter:
 +
        {"value" : 1}
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 138: Line 152:
 
</pre>
 
</pre>
  
 +
 +
==GET==
 
===/cobotta/Program/GetList/===
 
===/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.<br>
The update is also done during the instantiation.
+
The update is also done during the instantiation.<br>
 
If your program isn't listed you may need to update the "Job_PCS.h" file.
 
If your program isn't listed you may need to update the "Job_PCS.h" file.
  
Line 153: Line 169:
 
</pre>
 
</pre>
  
===/cobotta/Program/Resume/===
+
===/cobotta/Error/Reset===
Continues a CobottaWorld robot program. E.g. after error reset.
+
Resets all errors of COBOTTA.  
The program has to be started with "StartProgram" method, first.  
 
  
'''Example'''
+
'''Parameter:'''<br>
<pre>
+
''execute:'' (bool as int 0/1) execute the operation <br>
    http://127.0.0.1:8280/cobotta/Program/Resume/
 
</pre>
 
'''Return'''
 
<pre>
 
    {"result" : "OK"}
 
</pre>
 
 
 
===/cobotta/Program/Stop/===
 
Stops all running robot programs.
 
Programs will be stopped immediately.
 
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Program/Stop/
+
     http://127.0.0.1:8280/cobotta/Error/Reset/
 +
    Parameter:
 +
        {"execute" : 1}   
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
Line 179: Line 186:
 
</pre>
 
</pre>
  
===/cobotta/Program/CycleEnd/===
+
===/cobotta/Error/===
End all running robot programs.
+
Returns the number of currently issued errors. <br>
Programs will be stopped at the end of the program.  
+
If it returns an error count of 0 then there is no error.<br>
 
+
Also returns an array of error deails. Containing an error code and a description text.
'''Example'''
 
<pre>
 
    http://127.0.0.1:8280/cobotta/Program/CycleEnd/
 
</pre>
 
'''Return'''
 
<pre>
 
    {"result" : "OK"}
 
</pre>
 
  
===/cobotta/Errors/Reset===
+
'''Returns:''' <br>
Resets all errors of COBOTTA.  
+
''errorCount:'' (int) number of currently issued errors<br>
 +
''details:'' (obj[]) array of error details containing errorCode and errorMessage<br>
 +
''errorCode:'' (int) COBOTTA error number<br>
 +
''errorMessage:'' (str) error description text.<br>
  
'''Example'''
 
<pre>
 
    http://127.0.0.1:8280/cobotta/Errors/Reset/
 
</pre>
 
'''Return'''
 
<pre>
 
    {"result" : "OK"}
 
</pre>
 
  
===/cobotta/Errors/===
 
Returns the number of currently issued errors.
 
If it returns an error count of 0 than there is no error.
 
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Errors/
+
     http://127.0.0.1:8280/cobotta/Error/
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "errorCount" : count }
+
     "errorCount" : count,
 +
    "details" : [{ "errorCode": code,
 +
                    "errorMessage": description
 +
                  }] }
 
</pre>
 
</pre>
  
===/cobotta/Override/===
+
===/cobotta/Speed/===
Read current COBOTTA override.
+
Read current COBOTTA speed.
 +
 
 +
'''Returns:''' <br>
 +
''speed:'' (int) current COBOTTA speed value [%]
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Override/
+
     http://127.0.0.1:8280/cobotta/Speed/
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "override" : 50 }
+
     "speed" : 50 }
 
</pre>
 
</pre>
  
 
===/cobotta/Status/===
 
===/cobotta/Status/===
Read status variables from COBOTTA.  
+
Read status variables from COBOTTA.
 +
 
 +
'''Returns:''' <br>
 +
COBOTTA staus variables.  <br>
 +
''connectedStatus:'' (bool as int 0/1) Connection between Robotino and COBOTTA is established<br>
 +
''busyStatus:'' (bool as int 0/1) COBOTTA is executing a program<br>
 +
''emergencyStop:'' (bool as int 0/1) COBOTTA emergency stop is pressed<br>
 +
''errorStatus:'' (bool as int 0/1) COBOTTA in error state<br>
  
 
'''Example'''
 
'''Example'''
Line 241: Line 245:
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "emergencyStop" : status[0],
+
     "connectedStatus" : value,
     "busyStatus" : status[1],
+
     "busyStatus" : value,
     "normalStatus" : status[2],
+
     "emergencyStop" : value,
     "servoStatus" : status[3] }
+
     "errorStatus" : value }
   
 
    status will be True or False
 
 
</pre>
 
</pre>
  
===/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.
+
===/cobotta/Status/Referenced===
 +
Checks if the COBOTTA has already performed reference motion (CALSET). <br>
 +
Reference motion has to be done once after startup/connecting to COBOTTA.
 +
 
 +
'''Returns:''' <br>
 +
''referencedStatus:'' (bool as int 0/1) COBOTTA referenced staus.
  
 
'''Example'''
 
'''Example'''
 
<pre>
 
<pre>
     http://127.0.0.1:8280/cobotta/Status/Busy
+
     http://127.0.0.1:8280/cobotta/Status/Referenced
 
</pre>
 
</pre>
 
'''Return'''
 
'''Return'''
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "busy" : status}
+
     "referencedStatus" : value}
   
 
    status will be True or False
 
 
</pre>
 
</pre>
  
===/cobotta/Io/<num>===
+
 
Read IO variable from COBOTTA.  
+
===/cobotta/Io/<number>===
Some IO signals are predefined. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App.
+
Read IO variable from COBOTTA. <br>
 +
Some IO signals are predefined. Please refer to COBOTTA manual ID : 7261 or check the signal's comments in Remote TP App. <br>
 +
Default user IOs start at IO 128
  
 
'''Parameter:''' <br>
 
'''Parameter:''' <br>
''num:'' (int) number of IO <br>
+
''number:'' (int) number of IO <br>
Returns: <br>
+
'''Returns:''' <br>
(bool) IO variable value  
+
''value:'' (bool as int 0/1) IO variable value.
  
 
'''Example'''
 
'''Example'''
Line 280: Line 287:
 
<pre>
 
<pre>
 
     {"result" : "OK",
 
     {"result" : "OK",
     "val" : value}
+
     "value" : value}
 
 
    value will be True or False
 
 
</pre>
 
</pre>
  

Revision as of 14:59, 4 May 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 speed
  • Get a list of robot programs

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

PUT

/cobotta/Reference/

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.

Parameter:
execute: (bool as int 0/1) execute the operation

Example

    http://127.0.0.1:8280/cobotta/Reference/
    Parameter:
        {"execute" : 1}

Return

    {"result" : "OK"}

/cobotta/Program/Start

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

Parameter:
execute: (bool as int 0/1) execute the operation
progname: (str) name of CobottaWorld robot program
mode: (optional)(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:
        {"execute" : 1,
         "progname" : "HOME"} 

Return

    {"result" : "OK"}

/cobotta/Program/Stop/

Stops all running robot programs.
Programs will be stopped immediately and connot be continued.

Parameter:
execute: (bool as int 0/1) execute the operation

Example

    http://127.0.0.1:8280/cobotta/Program/Stop/
    Parameter:
        {"execute" : 1}    

Return

    {"result" : "OK"}

/cobotta/Program/Hold/

End all running robot programs.
Program will be stopped. The program can be continued by issuing Resume command.

Parameter:
execute: (bool as int 0/1) execute the operation

Example

    http://127.0.0.1:8280/cobotta/Program/Hold/
    Parameter:
        {"execute" : 1} 

Return

    {"result" : "OK"}

/cobotta/Program/Resume/

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

Parameter:
execute: (bool as int 0/1) execute the operation

Example

    http://127.0.0.1:8280/cobotta/Program/Resume/
    Parameter:
        {"execute" : 1}

Return

    {"result" : "OK"}

/cobotta/Speed/

Set COBOTTA speed to specified value.

Parameter:
value: (int) Speed set value [%]

Example

    http://127.0.0.1:8280/cobotta/Speed/
    Parameter:
        {"speed" : 50} 

Return

    {"result" : "OK"}

/cobotta/Io/<number>/

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:
number: (int) number of IO
value: (bool as int 0/1) value of IO variable

Example

    http://127.0.0.1:8280/cobotta/Io/128
    Parameter:
        {"value" : 1}

Return

    {"result" : "OK"}


GET

/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/Error/Reset

Resets all errors of COBOTTA.

Parameter:
execute: (bool as int 0/1) execute the operation

Example

    http://127.0.0.1:8280/cobotta/Error/Reset/
    Parameter:
        {"execute" : 1}     

Return

    {"result" : "OK"}

/cobotta/Error/

Returns the number of currently issued errors.
If it returns an error count of 0 then there is no error.
Also returns an array of error deails. Containing an error code and a description text.

Returns:
errorCount: (int) number of currently issued errors
details: (obj[]) array of error details containing errorCode and errorMessage
errorCode: (int) COBOTTA error number
errorMessage: (str) error description text.


Example

    http://127.0.0.1:8280/cobotta/Error/

Return

    {"result" : "OK",
     "errorCount" : count,
     "details" : [{ "errorCode": code,
                    "errorMessage": description
                  }] }

/cobotta/Speed/

Read current COBOTTA speed.

Returns:
speed: (int) current COBOTTA speed value [%]

Example

    http://127.0.0.1:8280/cobotta/Speed/

Return

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

/cobotta/Status/

Read status variables from COBOTTA.

Returns:
COBOTTA staus variables.
connectedStatus: (bool as int 0/1) Connection between Robotino and COBOTTA is established
busyStatus: (bool as int 0/1) COBOTTA is executing a program
emergencyStop: (bool as int 0/1) COBOTTA emergency stop is pressed
errorStatus: (bool as int 0/1) COBOTTA in error state

Example

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

Return

    {"result" : "OK",
     "connectedStatus" : value,
     "busyStatus" : value,
     "emergencyStop" : value,
     "errorStatus" : value }


/cobotta/Status/Referenced

Checks if the COBOTTA has already performed reference motion (CALSET).
Reference motion has to be done once after startup/connecting to COBOTTA.

Returns:
referencedStatus: (bool as int 0/1) COBOTTA referenced staus.

Example

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

Return

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


/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.
Default user IOs start at IO 128

Parameter:
number: (int) number of IO
Returns:
value: (bool as int 0/1) IO variable value.

Example

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

Return

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

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.