Sensing#
#include "navground/core/buffer.h"
The shape of a multi-dimensional buffer.
The type of the data stored in a multi-dimensional buffer.
The data container for multi-dimensional buffer
Describes a typed, bounded, multi-dimensional buffer.
Mimics Gymnasium Box spaces (https://gymnasium.farama.org/api/spaces/).
Public Functions
Constructs a new instance.
- Parameters:
shape – [in] The shape
type – [in] The type
low – [in] The low
high – [in] The high
categorical – [in] The categorical
Gets the strides.
- Returns:
The strides.
Public Members
The shape of the buffer
A code that identify the type of data.
The lower limits
The upper limits
Whether the [integer] data is categorical or not.
Public Static Functions
Constructs a new instance for a given type.
- Parameters:
shape – [in] The shape
low – [in] The low
high – [in] The high
categorical – [in] The categorical
- Template Parameters:
T – The type of the data
- Returns:
The buffer description.
A typed, bounded, multi-dimensional array, similar to
numpy
arrays.Public Functions
Constructs a new instance with data set to a uniform value.
- Parameters:
desc – [in] The description
value – [in] The value to assign to all of the buffer.
Constructs a new instance, with data set to zero.
- Parameters:
desc – [in] The description
Constructs a new instance with data.
- Parameters:
desc – [in] The description
value – [in] The data
Constructs an unbounded, flat buffer of data.
- Parameters:
value – [in] The data
Returns the buffer size.
- Returns:
The number of elements in the buffer
Return the buffer type.
- Returns:
The code of type of data stored in the buffer
Gets the data stored in the buffer.
- Template Parameters:
T – The desired type
- Returns:
The data or an null pointer if the type is different.
Gets the data stored in the buffer.
- Template Parameters:
T – The desired type
- Returns:
The data pointer or null if the type is different.
Gets the data container.
- Returns:
The data container.
Determines if the data has a given type.
- Template Parameters:
T – The type
- Returns:
True if the data has the given type, False otherwise.
Sets the data in the buffer.
If force is set, it will set the data and possibly change type and shape of the buffer when no compatible. If force is not set, it won’t change the data when the shape has a different size or the type is different.
- Parameters:
value – [in] The new data
force – [in] Whenever shape and type should be changed to match the new data.
- Returns:
Whether the data was set or not.
Gets the pointer to the data.
- Returns:
A pointer to the first element of the buffer.
Sets data from a pointer.
If force is set, it will set the data and possibly change type and shape of the buffer when no compatible. If force is not set, it won’t change the data when the shape has a different size or the type is different.
- Parameters:
ptr – A pointer to the first element of the new data
shape – [in] The new shape
_type – [in] The new type
force – [in] Whenever shape and type should be changed to match the new data.
- Returns:
Whether the data was set or not.
Gets the description.
- Returns:
The description.
Sets the description.
If force is set, it will set the description and possibly reset the buffer if the type or size have changed. If force is not set, it won’t allow changing shape to a different size or type to a different type.
- Parameters:
value – [in] The value
force – [in] Whenever data may be reset.
- Returns:
Whether the description was set or not.
Gets the lower bound.
- Returns:
The lower bound.
Gets the upper bound.
- Returns:
The upper bound.
Gets whether buffer is categorical.
- Returns:
Whether categorical or not.
Gets the shape.
- Returns:
The shape.
Sets the lower bound.
- Parameters:
value – [in] The value
Sets the upper bound.
- Parameters:
value – [in] The value
Sets whether the buffer is categorical.
- Parameters:
value – [in] The value
Sets the shape.
If force is set, it will set the shape and possibly reset the buffer if the size has changed. If force is not set, it won’t allow changing shape to a different size.
- Parameters:
value – [in] The value
force – [in] Whenever data may be reset.
- Returns:
Whether the shape was set or not.
Sets the type.
If force is set, it will set the shape and possibly reset the buffer if the type has changed. If force is not set, it won’t allow changing type.
- Parameters:
force – [in] Whenever data may be reset.
- Template Parameters:
T – The desired type
- Returns:
Whether the shape was set or not.
Sets the type.
If force is set, it will set the shape and possibly reset the buffer if the type has changed. If force is not set, it won’t allow changing type.
- Parameters:
force – [in] Whenever data may be reset.
value – [in] The desired type code.
- Returns:
Whether the shape was set or not.
#include "navground/core/states/sensing.h"
Generic state to hold data from sensors in keyed buffers.
Public Functions
Construct an instance
Gets the buffers.
- Returns:
The buffers.
Initializes a buffer with a description and a uniform value.
- Parameters:
key – [in] The key
desc – [in] The description of the buffer
value – [in] The value to assign to the buffer
- Returns:
The buffer if successfully initialized else a null pointer
Initializes a buffer with description, with data set to zero.
- Parameters:
key – [in] The key
desc – [in] The description of the buffer
- Returns:
The buffer if successfully initialized else a null pointer
Initializes a flat buffer with data.
- Parameters:
key – [in] The key
value – [in] The data
- Returns:
The buffer if successfully initialized else a null pointer
Assign a buffer to a key.
- Parameters:
key – [in] The key
value – [in] The value
Gets the buffer assigned to a key.
- Parameters:
key – [in] The key
- Returns:
The buffer.