Skip to content

samuel-cavalcanti/rust_zmqRemoteApi

Repository files navigation

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 created 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.6.0"}

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