Go to the documentation of this file.
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);
97 const auto aronDto = tryCast<arondto::OccupancyGrid>(*entityInstance);
98 ARMARX_CHECK(aronDto) <<
"Failed casting to OccupancyGrid";
104 const auto ndArrayNavigator =
109 aron::data::converter::AronEigenConverter::ConvertToArray<float>(*ndArrayNavigator);
111 return occupancyGrid;
123 ARMARX_DEBUG <<
"[MappingDataReader] result: " << qResult;
125 if (not qResult.success)
127 ARMARX_WARNING <<
"Failed to query data from memory: " << qResult.errorMessage;
128 return {.occupancyGrid = std::nullopt,
129 .status = Result::Status::Error,
130 .errorMessage = qResult.errorMessage};
133 const auto coreSegment = qResult.memory.getCoreSegment(
properties().coreSegmentName);
135 if (not coreSegment.hasProviderSegment(
query.providerName))
138 <<
"` does not exist (yet).";
139 return {.
occupancyGrid = std::nullopt, .status = Result::Status::NoData};
143 coreSegment.getProviderSegment(
query.providerName);
145 if (providerSegment.
empty())
148 return {.occupancyGrid = std::nullopt,
149 .status = Result::Status::NoData,
150 .errorMessage =
"No entities"};
EntitySelector & all() override
Properties defaultProperties() const override
const Properties & properties() const
EntitySelector & entities()
Start specifying entities.
std::optional< OccupancyGrid > occupancyGrid
Client-side working entity instance.
auto & getLatestSnapshot(int snapshotIndex=0)
Retrieve the latest entity snapshot.
SnapshotSelector & snapshots()
Start specifying entity snapshots.
#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...
std::string propertyPrefix() const override
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
static PointerType DynamicCast(const VariantPtr &n)
std::string GetHandledExceptionString()
CoreSegmentSelector & coreSegments()
Start specifying core segments.
CoreSegmentSelector & withName(const std::string &name) override
::armarx::armem::client::query::Builder buildQuery(const Query &query) const
const armem::client::Reader & memoryReader() const
ProviderSegmentSelector & withName(const std::string &name) override
bool forEachEntity(EntityFunctionT &&func)
SnapshotSelector & beforeOrAtTime(Time timestamp)
enum armarx::armem::vision::occupancy_grid::client::Reader::Result::Status status
Result query(const Query &query) const
OccupancyGrid asOccupancyGrid(const wm::ProviderSegment &providerSegment)
The query::Builder class provides a fluent-style specification of hierarchical queries.
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
const DataT & data() const
QueryResult query(const QueryInput &input) const
Perform a query.
void fromAron(const arondto::OccupancyGrid &dto, OccupancyGrid &bo)