Skip to content

raisim::SensorSet ​

class · #include <raisim/sensors/SensorSet.hpp>

A named group of sensors that belongs to one body of an ArticulatedSystem (e.g., all sensors of one physical device). The set owns its sensors; sensors added to it inherit the set's model and serial number.

Public types ​

SensorSetDataType ​

cpp
using SensorSetDataType = std::vector<Sensor *>

Non-owning view of the sensors, returned by getSensors().

SensorStorageType ​

cpp
using SensorStorageType = std::vector<std::unique_ptr<Sensor>>

Owning storage of the sensors.

Constructors & destructor ​

SensorSet ​

cpp
SensorSet(std::string nameI, std::string modelI, std::string serialNumberI)

Parameters

ParameterDescription
nameI (in)Sensor set name.
modelI (in)Sensor model identifier, copied to every sensor added later.
serialNumberI (in)Serial number, copied to every sensor added later.
cpp
SensorSet(const SensorSet &) = delete
cpp
SensorSet(SensorSet &&other) noexcept = default

Move constructor. Sensor pointers stay valid because the sensors are heap-allocated.

Parameters

ParameterDescription
other (in, out)Set to move from.

~SensorSet ​

cpp
~SensorSet() = default

Public member functions ​

operator= ​

cpp
SensorSet &operator=(const SensorSet &) = delete
cpp
SensorSet &operator=(SensorSet &&other) noexcept = default

Move assignment.

Parameters

ParameterDescription
other (in, out)Set to move from.

Returns *this

getSensors ​

cpp
const SensorSetDataType &getSensors() const

Returns Read-only non-owning view of the sensors in this set.

addSensor ​

cpp
void addSensor(std::unique_ptr<Sensor> sensor)

Transfer ownership of a sensor to this set and copy the set's model and serial number into it.

Parameters

ParameterDescription
sensor (in)Sensor to own. Null sensors and duplicate names are rejected with a fatal error.

getSensor ​

cpp
template <class T>
T *getSensor(const std::string &nameIn)

Find a sensor by name and return it as its concrete type.

Template parameters

ParameterDescription
TConcrete sensor class (e.g. DepthCamera, InertialMeasurementUnit).

Parameters

ParameterDescription
nameIn (in)The sensor name (getName(), without the set prefix).

Returns The sensor, or nullptr if no sensor has this name or its type is not T::getType().

getSensorRawPtr ​

cpp
Sensor *getSensorRawPtr(const std::string &nameIn)

This function returns the sensor as its parent class pointer.

Parameters

ParameterDescription
nameIn (in)the name of the sensor

Returns the sensor as a base class (Sensor*) pointer, or nullptr if not found

getModel ​

cpp
const std::string &getModel() const

Returns Sensor model identifier from the sensor set configuration.

getSerialNumber ​

cpp
const std::string &getSerialNumber() const

Returns Sensor serial number from the sensor set configuration.

getName ​

cpp
const std::string &getName() const

Returns Sensor set name.

RaiSim — physics for robotics and AI.