CoppeliaRobotics / wsRemoteApi

Other
0 stars 1 forks source link

WebSocket Remote API for CoppeliaSim

The WebSocket Remote API requires the WS plugin.

Table of contents

Compiling

  1. Install required packages for simStubsGen: see simStubsGen's README
  2. Checkout, compile and install into CoppeliaSim:
    $ git clone https://github.com/CoppeliaRobotics/wsRemoteApi
    $ cd wsRemoteApi
    $ git checkout coppeliasim-v4.5.0-rev0
    $ mkdir -p build && cd build
    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    $ cmake --build .
    $ cmake --install .

NOTE: replace coppeliasim-v4.5.0-rev0 with the actual CoppeliaSim version you have.

Protocol

Connect WebSocket to the endpoint (by default on port 23050), send a message (see request below), and read the response (see response below). The request and response can be serialized to JSON or CBOR. The response will be serialized using the same serialization format used in the request.

See also the example client example.html.

Request

A request is an object with fields:

Example:

{
    "func": "sim.getObject",
    "args": ["/Floor"]
}

Response

A response is an object with fields:

Example:

{
    "success": true,
    "ret": [37]
}

In case of error, the exception message will be present:

{
    "success": false,
    "error": "Object does not exist. (in function 'sim.getObject')"
}