Sensors

Definition of all of the sensor information

Classes:

AcousticBeaconSensor(client, agent_name, ...)

Acoustic Beacon Sensor.

DVLSensor(client, agent_name, agent_type[, ...])

Doppler Velocity Log Sensor.

DepthSensor(client[, agent_name, ...])

Pressure/Depth Sensor.

GPSSensor(client[, agent_name, agent_type, ...])

Gets the location of the agent in the world if the agent is close enough to the surface.

HoloOceanSensor(client[, agent_name, ...])

Base class for a sensor

IMUSensor(client, agent_name, agent_type[, ...])

Inertial Measurement Unit sensor.

LocationSensor(client[, agent_name, ...])

Gets the location of the agent in the world.

OpticalModemSensor(client, agent_name, ...)

Handles communication between agents using an optical modem.

OrientationSensor(client[, agent_name, ...])

Gets the forward, right, and up vector for the agent.

PoseSensor(client[, agent_name, agent_type, ...])

Gets the forward, right, and up vector for the agent.

RGBCamera(client, agent_name, agent_type[, ...])

Captures agent's view.

RangeFinderSensor(client, agent_name, agent_type)

Returns distances to nearest collisions in the directions specified by the parameters.

RotationSensor(client[, agent_name, ...])

Gets the rotation of the agent in the world.

SensorDefinition(agent_name, agent_type, ...)

A class for new sensors and their parameters, to be used for adding new sensors.

SensorFactory()

Given a sensor definition, constructs the appropriate HoloOceanSensor object.

SonarSensor(client, agent_name, agent_type)

Simulates an imaging sonar.

VelocitySensor(client[, agent_name, ...])

Returns the x, y, and z velocity of the agent.

ViewportCapture(client, agent_name, agent_type)

Captures what the viewport is seeing.

WorldNumSensor(client[, agent_name, ...])

Returns any numeric value from the world corresponding to a given key.

class holoocean.sensors.AcousticBeaconSensor(client, agent_name, agent_type, name='AcousticBeaconSensor', config=None)

Acoustic Beacon Sensor. Can send message to other beacon from the send_acoustic_message() command.

Returning array depends on sent message type. Note received message will be delayed due to time of acoustic wave traveling. Possibly message types are, with ϕ representing the azimuth, ϴ elevation, r range, and d depth in water,

  • OWAY: One way message that sends ["OWAY", from_sensor, payload]

  • OWAYU: One way message that sends ["OWAYU", from_sensor, payload, ϕ, ϴ]

  • MSG_REQ: Requests a return message of MSG_RESP and sends ["MSG_REQ", from_sensor, payload]

  • MSG_RESP: Return message that sends ["MSG_RESP", from_sensor, payload]

  • MSG_REQU: Requests a return message of MSG_RESPU and sends ["MSG_REQU", from_sensor, payload, ϕ, ϴ]

  • MSG_RESPU: Return message that sends ["MSG_RESPU", from_sensor, payload, ϕ, ϴ, r]

  • MSG_REQX: Requests a return message of MSG_RESPX and sends ["MSG_REQX", from_sensor, payload, ϕ, ϴ, d]

  • MSG_RESPX: Return message that sends ["MSG_RESPX", from_sensor, payload, ϕ, ϴ, r, d]

These messages types are based on the Blueprint Subsea SeaTrac X150

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • id: Id of this sensor. If not given, they are numbered sequentially.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

sensor_data

Get the sensor data buffer

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

property sensor_data

Get the sensor data buffer

Returns

Current sensor data

Return type

np.ndarray of size self.data_shape

class holoocean.sensors.DVLSensor(client, agent_name, agent_type, name='DVLSensor', config=None)

Doppler Velocity Log Sensor.

Returns a 1D numpy array of:

[velocity_x, velocity_y, velocity_z, range_x_forw, range_y_forw, range_x_back, range_y_back]

With the range potentially not returning if ReturnRange is set to false.

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • Elevation: Angle of each acoustic beam off z-axis pointing down. Only used for noise/visualization. Defaults to 90 => horizontal.

  • DebugLines: Whether to show lines of each beam. Defaults to false.

  • VelSigma/VelCov: Covariance/Std to be applied to each beam velocity. Can be scalar, 4-vector or 4x4-matrix. Defaults to 0 => no noise.

  • ReturnRange: Boolean of whether range of beams should also be returned. Defaults to true.

  • MaxRange: Maximum range that can be returned by the beams.

  • RangeSigma/RangeCov: Covariance/Std to be applied to each beam range. Can be scalar, 4-vector or 4x4-matrix. Defaults to 0 => no noise.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.DepthSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Pressure/Depth Sensor.

Returns a 1D numpy array of:

[position_z]

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • Sigma/Cov: Covariance/Std to be applied, a scalar. Defaults to 0 => no noise.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.GPSSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Gets the location of the agent in the world if the agent is close enough to the surface.

Returns coordinates in [x, y, z] format (see Coordinate System)

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • Sigma/Cov: Covariance/Std of measurement. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

  • Depth: How deep in the water we can still receive GPS messages in meters. Defaults to 2m.

  • DepthSigma/DepthCov: Covariance/Std of depth. Must be a scalar. Defaults to 0 => no noise.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

sensor_data

Get the sensor data buffer

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

property sensor_data

Get the sensor data buffer

Returns

Current sensor data

Return type

np.ndarray of size self.data_shape

class holoocean.sensors.HoloOceanSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Base class for a sensor

Parameters
  • client (HoloOceanClient) – Client attached to a sensor

  • agent_name (str) – Name of the parent agent

  • agent_type (str) – Type of the parent agent

  • name (str) – Name of the sensor

  • config (dict) – Configuration dictionary to pass to the engine

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

sensor_data

Get the sensor data buffer

Methods:

rotate(rotation)

Rotate the sensor.

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

rotate(rotation)

Rotate the sensor. It will be applied in approximately three ticks. step() or tick().)

This will not persist after a call to reset(). If you want a persistent rotation for a sensor, specify it in your scenario configuration.

Parameters

rotation (list of float) – rotation for sensor (see Rotations).

property sensor_data

Get the sensor data buffer

Returns

Current sensor data

Return type

np.ndarray of size self.data_shape

class holoocean.sensors.IMUSensor(client, agent_name, agent_type, name='IMUSensor', config=None)

Inertial Measurement Unit sensor.

Returns a 2D numpy array of:

[ [accel_x, accel_y, accel_z],
  [ang_vel_roll,  ang_vel_pitch, ang_vel_yaw],
  [accel_bias_x, accel_bias_y, accel_bias_z],
  [ang_vel_bias_roll,  ang_vel_bias_pitch, ang_vel_bias_yaw]    ]

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • AccelSigma/AccelCov: Covariance/Std for acceleration component. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

  • AngVelSigma/AngVelCov: Covariance/Std for angular velocity component. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

  • AccelBiasSigma/AccelCBiasov: Covariance/Std for acceleration bias component. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

  • AngVelSigma/AngVelCov: Covariance/Std for acceleration bias component. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

  • ReturnBias: Whether the sensor should return the bias along with accel/ang. vel. Defaults to false.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.LocationSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Gets the location of the agent in the world.

Returns coordinates in [x, y, z] format (see Coordinate System)

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • Sigma/Cov: Covariance/Std. Can be scalar, 3-vector or 3x3-matrix. Defaults to 0 => no noise.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.OpticalModemSensor(client, agent_name, agent_type, name='OpticalModemSensor', config=None)

Handles communication between agents using an optical modem. Can send message to other modem from the send_optical_message() command.

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • MaxDistance: Max Distance in meters of OpticalModem. (default 50)

  • id: Id of this sensor. If not given, they are numbered sequentially.

  • DistanceSigma/DistanceCov: Determines the standard deviation/covariance of the noise on MaxDistance. Must be scalar value. (default 0 => no noise)

  • AngleSigma/AngleCov: Determines the standard deviation of the noise on LaserAngle. Must be scalar value. (default 0 => no noise)

  • LaserDebug: Show debug traces. (default false)

  • DebugNumSides: Number of sides on the debug cone. (default 72)

  • LaserAngle: Angle of lasers from origin. Measured in degrees. (default 60)

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

sensor_data

Get the sensor data buffer

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

property sensor_data

Get the sensor data buffer

Returns

Current sensor data

Return type

np.ndarray of size self.data_shape

class holoocean.sensors.OrientationSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Gets the forward, right, and up vector for the agent. Returns a 2D numpy array of

[ [forward_x, right_x, up_x],
  [forward_y, right_y, up_y],
  [forward_z, right_z, up_z] ]

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.PoseSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Gets the forward, right, and up vector for the agent. Returns a 2D numpy array of

[ [R, p],
  [0, 1] ]

where R is the rotation matrix (See OrientationSensor) and p is the robot world location (see LocationSensor)

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.RGBCamera(client, agent_name, agent_type, name='RGBCamera', config=None)

Captures agent’s view.

The default capture resolution is 256x256x256x4, corresponding to the RGBA channels. The resolution can be increased, but will significantly impact performance.

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • CaptureWidth: Width of captured image

  • CaptureHeight: Height of captured image

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

Methods:

set_ticks_per_capture(ticks_per_capture)

Sets this RGBCamera to capture a new frame every ticks_per_capture.

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

set_ticks_per_capture(ticks_per_capture)

Sets this RGBCamera to capture a new frame every ticks_per_capture.

The sensor’s image will remain unchanged between captures.

This method must be called after every call to env.reset.

Parameters

ticks_per_capture (int) – The amount of ticks to wait between camera captures.

class holoocean.sensors.RangeFinderSensor(client, agent_name, agent_type, name='RangeFinderSensor', config=None)

Returns distances to nearest collisions in the directions specified by the parameters. For example, if an agent had two range sensors at different angles with 24 lasers each, the LaserDebug traces would look something like this:

../_images/UAVRangeFinder.PNG

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • LaserMaxDistance: Max Distance in meters of RangeFinder. (default 10)

  • LaserCount: Number of lasers in sensor. (default 1)

  • LaserAngle: Angle of lasers from origin. Measured in degrees. Positive angles point up. (default 0)

  • LaserDebug: Show debug traces. (default false)

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.RotationSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Gets the rotation of the agent in the world.

Returns [roll, pitch, yaw] (see Rotations)

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.SensorDefinition(agent_name, agent_type, sensor_name, sensor_type, socket='', location=(0, 0, 0), rotation=(0, 0, 0), config=None, existing=False, lcm_channel=None, tick_every=None)

A class for new sensors and their parameters, to be used for adding new sensors.

Parameters
  • agent_name (str) – The name of the parent agent.

  • agent_type (str) – The type of the parent agent

  • sensor_name (str) – The name of the sensor.

  • sensor_type (str or HoloOceanSensor) – The type of the sensor.

  • socket (str, optional) – The name of the socket to attach sensor to.

  • location (Tuple of float, optional) – [x, y, z] coordinates to place sensor relative to agent (or socket) (see Coordinate System).

  • rotation (Tuple of float, optional) – [roll, pitch, yaw] to rotate sensor relative to agent (see Rotations)

  • config (dict) – Configuration dictionary for the sensor, to pass to engine

Methods:

get_config_json_string()

Gets the configuration dictionary as a string ready for transport

get_config_json_string()

Gets the configuration dictionary as a string ready for transport

Returns

The configuration as an escaped json string

Return type

(str)

class holoocean.sensors.SensorFactory

Given a sensor definition, constructs the appropriate HoloOceanSensor object.

Methods:

build_sensor(client, sensor_def)

Constructs a given sensor associated with client

static build_sensor(client, sensor_def)

Constructs a given sensor associated with client

Parameters
  • client (str) – Name of the agent this sensor is attached to

  • sensor_def (SensorDefinition) – Sensor definition to construct

Returns:

class holoocean.sensors.SonarSensor(client, agent_name, agent_type, name='SonarSensor', config=None)

Simulates an imaging sonar. See Configuring Octree for more on how to configure the octree that is used.

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • BinsRange: Number of range bins of resulting image, defaults to 300.

  • BinsAzimuth: Number of azimuth bins of resulting image, defaults to 128.

  • BinsElevation: Number of elevation bins to use during shadowing, defaults to 10*Elevation (0.1 degree per bin).

  • Azimuth: Azimuth (side to side) angle visible in degrees, defaults to 130.

  • Elevation: Elevation angle (up and down) visible in degrees, defaults to 20.

  • MinRange: Minimum range visible in meters, defaults to 3.

  • MaxRange: Maximum range visible in meters, defaults to 30.

  • InitOctreeRange: Upon startup, all mid-level octrees within this distance will be created.

  • AddSigma/AddCov: Additive noise covariance/std from a Rayleigh distribution. Needs to be a float. Defaults to 0/off.

  • MultSigma/MultCov: Multiplication noise covariance/std from a normal distribution. Needs to be a float. Defaults to 0/off.

  • ViewRegion: Turns on green lines to see visible region. Defaults to false.

  • ViewOctree: Highlights all voxels in range. Defaults to false.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.VelocitySensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Returns the x, y, and z velocity of the agent.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.ViewportCapture(client, agent_name, agent_type, name='ViewportCapture', config=None)

Captures what the viewport is seeing.

The ViewportCapture is faster than the RGB camera, but there can only be one camera and it must capture what the viewport is capturing. If performance is critical, consider this camera instead of the RGBCamera.

It may be useful to position the camera with teleport_camera().

Configuration

The configuration block (see Configuration Block) accepts the following options:

  • CaptureWidth: Width of captured image

  • CaptureHeight: Height of captured image

THESE DIMENSIONS MUST MATCH THE VIEWPORT DIMENSTIONS

If you have configured the size of the viewport (window_height/width), you must make sure that CaptureWidth/Height of this configuration block is set to the same dimensions.

The default resolution is 1280x720, matching the default Viewport resolution.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype

class holoocean.sensors.WorldNumSensor(client, agent_name=None, agent_type=None, name='DefaultSensor', config=None)

Returns any numeric value from the world corresponding to a given key. This is world specific.

Attributes:

data_shape

The shape of the sensor data

dtype

The type of data in the sensor

property data_shape

The shape of the sensor data

Returns

Sensor data shape

Return type

tuple

property dtype

The type of data in the sensor

Returns

Type of sensor data

Return type

numpy dtype