20#include <armarx/navigation/core/aron/Events.aron.generated.h>
29 callerId(callerId), memoryNameSystem(mns), lastMemoryPoll(
armem::Time::Now())
31 const std::string memoryName =
"Navigation";
34 memoryReader = memoryNameSystem.getReader(
armem::MemoryID().withMemoryName(memoryName));
36 ARMARX_INFO <<
"MemorySubscriber: will handle all events for caller id " <<
QUOTED(callerId)
37 <<
" newer than " << lastMemoryPoll <<
".";
53 ARMARX_VERBOSE <<
"Received " << snapshotIDs.size() <<
" events from memory";
66 template <
typename AronEventT,
typename EventT>
77 const auto dto = AronEventT::FromAron(dataDict);
89 std::lock_guard g{eventHandlingMtx};
189 .getCoreSegment(
"Events");
192 std::vector<armem::wm::EntityInstance> events;
195 { events.push_back(instance); });
203 return a.id().timestamp < b.id().timestamp;
206 std::sort(events.begin(), events.end(), sortByTimestampAsc);
208 std::for_each(events.begin(), events.end(), [&](
const auto& event) { handleEvent(event); });
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
std::string coreSegmentName
bool hasEntityName() const
std::string providerSegmentName
const DataT & data() const
The memory name system (MNS) client.
Client-side working memory core segment.
Client-side working entity instance.
Client-side working memory.
static PointerType DynamicCastAndCheck(const VariantPtr &n)
void handleEvents(const armem::wm::Memory &memory)
void handleEvent(const armem::wm::EntityInstance &memoryEntity)
MemorySubscriber(const std::string &callerId, armem::client::MemoryNameSystem &mns)
~MemorySubscriber() override
void onEntityUpdate(const std::vector< armem::MemoryID > &snapshotIDs)
void globalTrajectoryUpdated(const core::GlobalTrajectoryUpdatedEvent &event) override
void safetyThrottlingTriggered(const core::SafetyThrottlingTriggeredEvent &event) override
Will be called whenever safety throttling is triggered to a certain degree (configurable).
void movementStarted(const core::MovementStartedEvent &event) override
void localTrajectoryUpdated(const core::LocalTrajectoryUpdatedEvent &event) override
void safetyStopTriggered(const core::SafetyStopTriggeredEvent &event) override
Will be called whenever a safety stop is triggered.
void localPlanningFailed(const core::LocalPlanningFailedEvent &event) override
void waypointReached(const core::WaypointReachedEvent &event) override
Will be called whenever the navigator reached a user-defined waypoint.
void globalPlanningFailed(const core::GlobalPlanningFailedEvent &event) override
void userAbortTriggered(const core::UserAbortTriggeredEvent &event) override
Will be called whenever the user aborts the current navigation.
void internalError(const core::InternalErrorEvent &event) override
Will be called whenever an internal error occurs.
void goalReached(const core::GoalReachedEvent &event) override
Will be called whenever the navigator reached the goal.
#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_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
aron::cpp::AronGeneratedClass AronGeneratedClass
This file is part of ArmarX.
auto fromAron(const armem::wm::EntityInstance &entity, EventT &bo)
const std::string SafetyStopTriggered
const std::string GoalReached
const std::string SafetyThrottlingTriggered
const std::string UserAbortTriggered
const std::string LocalTrajectoryUpdated
const std::string MovementStarted
const std::string WaypointReached
const std::string GlobalTrajectoryUpdated
const std::string GlobalPlanningFailed
const std::string InternalError
const std::string LocalPlanningFailed
void fromAron(const arondto::GlobalTrajectoryPoint &dto, GlobalTrajectoryPoint &bo)
bool forEachInstance(InstanceFunctionT &&func)
wm::Memory memory
The slice of the memory that matched the query.
Event describing that the global trajectory was updated.
Event describing that the targeted goal was successfully reached.
Event describing the occurance of an internal unhandled error.
Event describing that the local trajectory was updated.
Event describing that for security reasons, the robot was stopped completely.
Event desciribing that a significant safety throttling factor was reached.
Event describing that the user aborted the current execution.
Event describing that a user-defined waypoint was successfully reached.