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
using SensorSetDataType = std::vector<Sensor *>Non-owning view of the sensors, returned by getSensors().
SensorStorageType
using SensorStorageType = std::vector<std::unique_ptr<Sensor>>Owning storage of the sensors.
Constructors & destructor
SensorSet
SensorSet(std::string nameI, std::string modelI, std::string serialNumberI)Parameters
| Parameter | Description |
|---|---|
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. |
SensorSet(const SensorSet &) = deleteSensorSet(SensorSet &&other) noexcept = defaultMove constructor. Sensor pointers stay valid because the sensors are heap-allocated.
Parameters
| Parameter | Description |
|---|---|
other (in, out) | Set to move from. |
~SensorSet
~SensorSet() = defaultPublic member functions
operator=
SensorSet &operator=(const SensorSet &) = deleteSensorSet &operator=(SensorSet &&other) noexcept = defaultMove assignment.
Parameters
| Parameter | Description |
|---|---|
other (in, out) | Set to move from. |
Returns *this
getSensors
const SensorSetDataType &getSensors() constReturns Read-only non-owning view of the sensors in this set.
addSensor
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
| Parameter | Description |
|---|---|
sensor (in) | Sensor to own. Null sensors and duplicate names are rejected with a fatal error. |
getSensor
template <class T>
T *getSensor(const std::string &nameIn)Find a sensor by name and return it as its concrete type.
Template parameters
| Parameter | Description |
|---|---|
T | Concrete sensor class (e.g. DepthCamera, InertialMeasurementUnit). |
Parameters
| Parameter | Description |
|---|---|
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
Sensor *getSensorRawPtr(const std::string &nameIn)This function returns the sensor as its parent class pointer.
Parameters
| Parameter | Description |
|---|---|
nameIn (in) | the name of the sensor |
Returns the sensor as a base class (Sensor*) pointer, or nullptr if not found
getModel
const std::string &getModel() constReturns Sensor model identifier from the sensor set configuration.
getSerialNumber
const std::string &getSerialNumber() constReturns Sensor serial number from the sensor set configuration.
getName
const std::string &getName() constReturns Sensor set name.