Go to the documentation of this file.
17 #include <armarx/navigation/core/aron/Events.aron.generated.h>
27 callerId(callerId), memoryNameSystem(mns), lastMemoryEventReceived(
armem::
Time::Now())
34 ARMARX_INFO <<
"MemoryPolling: will handle all events newer than "
35 << lastMemoryEventReceived <<
".";
52 ARMARX_INFO <<
"Received " << snapshotIDs.size() <<
" events from memory";
65 template <
typename AronEventT,
typename EventT>
76 const auto dto = AronEventT::FromAron(dataDict);
88 std::lock_guard g{eventHandlingMtx};
99 fromAron<core::arondto::GlobalPlanningFailedEvent>(memoryEntity, evt);
106 fromAron<core::arondto::MovementStartedEvent>(memoryEntity, evt);
113 fromAron<core::arondto::GoalReachedEvent>(memoryEntity, evt);
120 fromAron<core::arondto::WaypointReachedEvent>(memoryEntity, evt);
127 fromAron<core::arondto::SafetyThrottlingTriggeredEvent>(memoryEntity, evt);
134 fromAron<core::arondto::SafetyStopTriggeredEvent>(memoryEntity, evt);
141 fromAron<core::arondto::UserAbortTriggeredEvent>(memoryEntity, evt);
148 fromAron<core::arondto::InternalErrorEvent>(memoryEntity, evt);
205 .getCoreSegment(
"Events");
208 std::vector<armem::wm::EntityInstance> events;
211 { events.push_back(instance); });
219 return a.id().timestamp < b.id().timestamp;
222 std::sort(events.begin(), events.end(), sortByTimestampAsc);
224 if (not events.empty())
226 ARMARX_INFO <<
"Updating memory timestamp to " << events.back().id().timestamp;
231 std::for_each(events.begin(), events.end(), [&](
const auto& event) { handleEvent(event); });
EntitySelector & all() override
void handleEvent(const armem::wm::EntityInstance &memoryEntity)
EntitySelector & entities()
Start specifying entities.
wm::Memory memory
The slice of the memory that matched the query.
void safetyStopTriggered(const core::SafetyStopTriggeredEvent &event) override
Will be called whenever a safety stop is triggered.
SnapshotSelector & timeRange(Time min, Time max)
const std::string MovementStarted
std::string providerSegmentName
void movementStarted(const core::MovementStartedEvent &event) override
Client-side working entity instance.
QueryInput buildQueryInput() const
void safetyThrottlingTriggered(const core::SafetyThrottlingTriggeredEvent &event) override
Will be called whenever safety throttling is triggered to a certain degree (configurable).
void fromAron(const arondto::GlobalTrajectoryPoint &dto, GlobalTrajectoryPoint &bo)
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...
Event describing the occurance of an internal unhandled error.
MemoryPolling(const std::string &callerId, armem::client::MemoryNameSystem &mns)
Event desciribing that a significant safety throttling factor was reached.
const std::string UserAbortTriggered
void globalPlanningFailed(const core::GlobalPlanningFailedEvent &event) override
void internalError(const core::InternalErrorEvent &event) override
Will be called whenever an internal error occurs.
void handleEvents(const armem::wm::Memory &memory)
const std::string WaypointReached
This file is part of ArmarX.
static PointerType DynamicCastAndCheck(const VariantPtr &n)
Brief description of class memory.
std::string coreSegmentName
auto fromAron(const armem::wm::EntityInstance &entity, EventT &bo)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
const std::string SafetyStopTriggered
QueryResult queryMemoryIDs(const std::vector< MemoryID > &ids, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Query a specific set of memory IDs.
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
const std::string SafetyThrottlingTriggered
double a(double t, double a0, double j)
std::shared_ptr< Value > value()
const std::string GlobalPlanningFailed
void userAbortTriggered(const core::UserAbortTriggeredEvent &event) override
Will be called whenever the user aborts the current navigation.
~MemoryPolling() override
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Event describing that for security reasons, the robot was stopped completely.
Client-side working memory core segment.
CoreSegmentSelector & withName(const std::string &name) override
Client-side working memory.
Event describing that the user aborted the current execution.
void runPollMemoryEvents()
void onEntityUpdate(const std::vector< armem::MemoryID > &snapshotIDs)
armarx::core::time::DateTime Time
Event describing that the targeted goal was successfully reached.
const std::string GoalReached
const std::string InternalError
bool hasEntityName() const
Represents a point in time.
ProviderSegmentSelector & withName(const std::string &name) override
void goalReached(const core::GoalReachedEvent &event) override
Will be called whenever the navigator reached the goal.
const std::string memoryName
bool forEachInstance(InstanceFunctionT &&func)
void waypointReached(const core::WaypointReachedEvent &event) override
Will be called whenever the navigator reached a user-defined waypoint.
The memory name system (MNS) client.
The query::Builder class provides a fluent-style specification of hierarchical queries.
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
Event describing that a user-defined waypoint was successfully reached.
Reader getReader(const MemoryID &memoryID)
Get a reader to the given memory name.
const DataT & data() const
static Duration MicroSeconds(std::int64_t microSeconds)
Constructs a duration in microseconds.
const std::optional< BoT > & bo
QueryResult query(const QueryInput &input) const
Perform a query.