Remote API

The remote API is one of several ways an application can connect with CoppeliaSim. It allows communication between CoppeliaSim and an external application (i.e. an application running in a different process, or on a different machine), is cross-platform, and supports the exact same API function calls as from within a CoppeliaSim script. It comes in two distinct versions/frameworks:

  • The ZeroMQ remote API: with support of Python, C++, Matlab, Octave, Java, Lua and Rust clients.
  • The WebSocket remote API: with support of JavaScript clients.
  • As an example, a Python ZeroMQ remote API client receiving and applying back a vision sensor image could look like:

    from time import sleep from coppeliasim_zmqremoteapi_client import RemoteAPIClient client = RemoteAPIClient() sim = client.getobject('sim') sensor1Handle = sim.getObject('/VisionSensor') sensor2Handle = sim.getObject('/PassiveVisionSensor') sim.startSimulation() while sim.getSimulationTime() < 10: image, resolution = sim.getVisionSensorImg(sensor1Handle) sim.setVisionSensorImg(sensor2Handle, image) sleep(0.01) sim.stopSimulation()

    (for backward compatibility, see here for the deprecated legacy remote API)