COBOTTA Rest API

From RobotinoWiki
Revision as of 13:50, 7 April 2021 by LDWR (talk | contribs)

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 return values will be json object style.

PUT

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

/cobotta/Connect/<host>/<port>/<timeout>

A connection to the COBOTTA is established.

Arguments:
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/172.21.0.30/

Return

    {"result" : "OK"}

/cobotta/StartProgram/<progname>/, defaults={'mode': 1}

/cobotta/StartProgram/<progname>/<mode>

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

Arguments:
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/StartProgram/HOME/

Return

    {"result" : "OK"}

/cobotta/Override/<ovrd>

Set COBOTTA override to specified value.

Example

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

Return

    {"result" : "OK"}

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

Example

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

Return

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

/cobotta/Io/<number>/<value>

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.

Arguments:
number: (int) number of IO
value: (bool) value of IO variable

Example

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

Return

    {"result" : "OK"}

/cobotta/Errors/<errorIndex>

Read a more detailed error inforamtion from robot error list.

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

Example

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

Return

    {"errorCode"     : info[0],          #(VT_I4)
     "errorMessage"  :  info[1],         #(VT_BSTR)
     "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)}

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/GetProgramList/

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/GetProgramList/

Return

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

/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

    {"result" : "OK"}

/cobotta/ResumeProgram/

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/ResumeProgram/

Return

    {"result" : "OK"}

/cobotta/StopPrograms/

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

Example

   http://127.0.0.1:8280/cobotta/StopPrograms/

Return

    {"result" : "OK"}

/cobotta/CycleEnd/

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

Example

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

Return

    {"result" : "OK"}

/cobotta/ResetError/

Resets all errors of COBOTTA.

Example

   http://127.0.0.1:8280/cobotta/ResetError/

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] }

/cobotta/BusyStatus/

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/BusyStatus/

Return

    {"result" : "OK",
     "busy" : True}

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.