#zmq #api-bindings #coppelia-sim

coppeliasim_zmq_remote_api

A ZMQ Client for CoppeliaSim

2 stable releases

4.6.1 Oct 20, 2023

#66 in Robotics

42 downloads per month

Custom license

495KB
6.5K SLoC

Rust 4K SLoC // 0.0% comments Python 2.5K SLoC // 0.0% comments

example workflow

Rust zmqRemoteApi

A Rust ZeroMQ remote API for coppeliasim

to run tests

cargo test

to run an example: make sure to open the correct coppeliasim scene and run the cargo command:

cargo run --example=simple_test

Perhaps you want to see the zmq communication logs. There are two logs levels:

  • level 1: debug, debug level you will see the request in json format
  • level 2: trace, trace level you will see the request in json and bytes format
export RUST_LOG="trace"; cargo run --example=simple_test

Porting C++ client to Rust client

The RemoteAPIObjects.h has 3750 lines of code, so to port all the functions, I create a kind of c_transpiler.

diferences between C++ client and Rust client

At moment the only difference encountered is in

std::vector<uint8_t> getStringSignal(std::string signalName);

in rust the function returns a std::String. I haven't observed any examples where the function returns a block of bytes.

// Rust function assing 
get_string_signal(signal_name:String)->String

Get started

create a new rust project:

cargo new new_project

you can add this crate at your cargo.toml using git:

# the branch is the coppelia version
zmq_remote_api = { git = "https://github.com/samuel-cavalcanti/rust_zmqRemoteApi", branch = "CoppeliaSim_4.5.1"}

See a simple example to understand how to use this crate.

Dependencies

~4.5–7.5MB
~139K SLoC