14#include <IceUtil/Handle.h>
15#include <IceUtil/Time.h>
18#include <SimoxUtility/algorithm/get_map_keys_values.h>
27#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
28#include <RobotAPI/interface/armem/server/ReadingMemoryInterface.h>
29#include <RobotAPI/interface/units/LaserScannerUnit.h>
33#include <RobotAPI/libraries/armem_vision/aron/OccupancyGrid.aron.generated.h>
70 return "mem.vision.occupancy_grid.";
76 return {.memoryName =
"Vision", .coreSegmentName =
"OccupancyGrid"};
83 ARMARX_CHECK(providerSegment.
size() == 1) <<
"There should be only one entity!";
90 ARMARX_CHECK(not entitySnapshot.empty()) <<
"No entity snapshot instances";
92 entityInstance = &entitySnapshot.getInstance(0);
98 ARMARX_CHECK(aronDto) <<
"Failed casting to OccupancyGrid";
104 const auto ndArrayNavigator =
111 return occupancyGrid;
123 ARMARX_DEBUG <<
"[MappingDataReader] result: " << qResult;
128 return {.occupancyGrid = std::nullopt,
135 if (not coreSegment.hasProviderSegment(
query.providerName))
138 <<
"` does not exist (yet).";
143 coreSegment.getProviderSegment(
query.providerName);
145 if (providerSegment.
empty())
148 return {.occupancyGrid = std::nullopt,
150 .errorMessage =
"No entities"};
const DataT & data() const
CoreSegmentT & getCoreSegment(const std::string &name)
bool forEachEntity(EntityFunctionT &&func)
QueryResult query(const QueryInput &input) const
Perform a query on the WM.
The query::Builder class provides a fluent-style specification of hierarchical queries.
CoreSegmentSelector & coreSegments()
Start specifying core segments.
CoreSegmentSelector & withName(const std::string &name) override
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
EntitySelector & all() override
SnapshotSelector & snapshots()
Start specifying entity snapshots.
ProviderSegmentSelector & withName(const std::string &name) override
EntitySelector & entities()
Start specifying entities.
SnapshotSelector & beforeOrAtTime(Time timestamp)
const armem::client::Reader & memoryReader() const
const Properties & properties() const
Properties defaultProperties() const override
std::string propertyPrefix() const override
::armarx::armem::client::query::Builder buildQuery(const Query &query) const
Result query(const Query &query) const
static Eigen::Array< T, Rows, Cols > ConvertToArray(const data::NDArray &nav)
static PointerType DynamicCast(const VariantPtr &n)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
armem::wm::EntityInstance EntityInstance
OccupancyGrid asOccupancyGrid(const wm::ProviderSegment &providerSegment)
void fromAron(const arondto::OccupancyGrid &dto, OccupancyGrid &bo)
std::optional< AronClass > tryCast(const wm::EntityInstance &item)
Tries to cast a armem::EntityInstance to AronClass.
std::string GetHandledExceptionString()
auto & getLatestSnapshot(int snapshotIndex=0)
Retrieve the latest entity snapshot.
wm::Memory memory
The slice of the memory that matched the query.