Skip to content

raisim::server ​

namespace

Namespaces ​

Classes ​

  • class BoundedWriter — Internal: write position in a bounded buffer.
  • class DeserializationError — A malformed bounded wire payload.
  • class ReadCursor — Internal: bounds-checked reader over an incoming wire payload.
  • class SceneFileServer — Internal: serves the files of a RaiSim Engine scene to a viewer.
  • class SerializationError — Internal: thrown when a server frame would overflow its BoundedWriter.
  • struct TendonVisualInstance — Renderer-independent transform of one tendon segment, expressed for a radius-one, length-one cylinder along Z.

Type aliases ​

WriteOutput ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename Out>
using WriteOutput = std::enable_if_t<std::is_same_v<Out, char *>||std::is_same_v<Out, BoundedWriter>, Out>

Internal: the output types the writers accept, an unchecked char* or a BoundedWriter.

Functions ​

colorText ​

#include <raisim/RaisimServer.hpp>

cpp
std::string colorText(const Vec<4> &color)

Returns a color as the viewer reads it: "%f, %f, %f, %f" with a '.' decimal point, whatever locale the application set (the viewer reads it in the classic locale)

appendBytes ​

#include <raisim/server/SerializationHelper.hpp>

cpp
static char *appendBytes(char *data, const void *source, size_t bytes)

Internal: copy bytes to data (unchecked) and return the position after them.

cpp
static BoundedWriter appendBytes(
    BoundedWriter data,
    const void *source,
    size_t bytes)

Internal: copy bytes to the writer. Throws SerializationError if they do not fit.

set ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename Out, typename T>
static WriteOutput<Out> set(Out data, T val)
cpp
template <typename Out, int N>
static WriteOutput<Out> set(Out data, const Vec<N> &vec)
cpp
template <typename Out, int N>
static WriteOutput<Out> set(Out data, const Vec<N> &&vec)
cpp
template <typename Out>
static WriteOutput<Out> set(Out data, const std::string &val)
cpp
template <typename Out, typename T>
static WriteOutput<Out> set(Out data, const std::vector<T> &str)
cpp
template <typename Out>
static WriteOutput<Out> set(Out data, const std::vector<std::string> &str)
cpp
template <typename Out>
static WriteOutput<Out> set(Out data, const VecDyn &vec)
cpp
template <typename Out>
static WriteOutput<Out> set(Out data, const std::vector<VecDyn> &vecs)
cpp
template <typename Out, typename T, typename... Types>
static WriteOutput<Out> set(Out data, const T &arg, Types... args)

setN ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename Out, typename T>
static WriteOutput<Out> setN(Out data, const T *val, int64_t N)

appendInFloat ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename Out, typename Values>
static WriteOutput<Out> appendInFloat(Out data, const Values &values)

setInFloat ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename Out, size_t N>
static WriteOutput<Out> setInFloat(Out data, const Vec<N> &vec)
cpp
template <typename Out, size_t N, size_t M>
static WriteOutput<Out> setInFloat(
    Out data,
    const Vec<N> &first,
    const Vec<M> &second)
cpp
template <typename Out>
static WriteOutput<Out> setInFloat(Out data, double val)
cpp
template <typename Out>
static WriteOutput<Out> setInFloat(Out data, const std::vector<double> &val)
cpp
template <typename Out, typename T>
static WriteOutput<Out> setInFloat(Out data, const T &val)
cpp
template <typename Out, typename T, typename... Types>
static WriteOutput<Out> setInFloat(Out data, const T &arg, Types... args)

get ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename T>
static char *get(char *data, T *val)
cpp
static char *get(char *data, std::string *str)
cpp
template <typename T>
static char *get(char *data, std::vector<T> *vec)
cpp
template <typename T, typename... Types>
static char *get(char *data, T *arg, Types... args)
cpp
template <typename T>
static void get(ReadCursor &reader, T *val)
cpp
static void get(ReadCursor &reader, std::string *str)
cpp
template <typename T>
static void get(ReadCursor &reader, std::vector<T> *vec)
cpp
template <typename T, typename... Types>
static void get(ReadCursor &reader, T *arg, Types *... args)

getInFloat ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename T>
static char *getInFloat(char *data, T *val)
cpp
static char *getInFloat(char *data, double *val)
cpp
template <typename T, typename... Types>
static char *getInFloat(char *data, T *arg, Types... args)
cpp
template <typename T>
static void getInFloat(ReadCursor &reader, T *val)
cpp
static void getInFloat(ReadCursor &reader, double *val)
cpp
template <typename T, typename... Types>
static void getInFloat(ReadCursor &reader, T *arg, Types *... args)

getN ​

#include <raisim/server/SerializationHelper.hpp>

cpp
template <typename T>
static char *getN(char *data, T *val, int32_t N)
cpp
template <typename T>
static void getN(ReadCursor &reader, T *val, int32_t count)

buildTendonVisualInstances ​

#include <raisim/server/TendonVisuals.hpp>

cpp
void buildTendonVisualInstances(
    const Tendon &tendon,
    std::vector<TendonVisualInstance> &instances,
    std::vector<Tendon::VisualSegment> &segments)

Build the renderer-independent transforms for a radius-one, length-one Z cylinder. Each segment is independent: pulley branches must never be joined by a line. Only visualization consumers call this; it adds no simulation-step work and never writes to the tendon, so a renderer cannot perturb the length, velocity or gradients the physics thread reads. Callers still hold the world lock, as for every other object read in the server update. Produces nothing for non-spatial or disabled tendons, a non-positive width or a transparent color; degenerate or non-finite segments are skipped.

Parameters

ParameterDescription
tendon (in)the tendon to visualize
instances (out)one transform per drawable segment (cleared first)
segments (out)scratch storage for the tendon's visual segments (cleared first)

RaiSim — physics for robotics and AI.