Go to the documentation of this file.
3 #include <SimoxUtility/algorithm/string/string_tools.h>
21 #include <RobotAPI/libraries/armem_robot/aron/Robot.aron.generated.h>
24 #include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
41 robotUnit = robotUnitPrx;
44 updateRobotDescription();
63 arondto::RobotDescription dto;
76 void Segment::updateRobotDescription()
79 KinematicUnitInterfacePrx kinematicUnit = robotUnit->getKinematicUnit();
82 const std::string robotName = kinematicUnit->getRobotName();
83 const std::string robotFilename = kinematicUnit->getRobotFilename();
86 const std::string
package = armarx::ArmarXDataPath::getProject(packages, robotFilename);
89 const std::string robotFileRelPath = [&robotFilename, &package]()-> std::string {
94 const std::string fixedRobotFilename = robotFilename.substr(package.size() + 1, -1);
95 return fixedRobotFilename;
101 ARMARX_INFO <<
"Robot description '" <<
VAROUT(robotFileRelPath) <<
"' found in package " << package;
103 const robot::RobotDescription robotDescription
105 .
name = kinematicUnit->getRobotName(),
106 .xml = {package, robotFileRelPath}
112 commitRobotDescription(robotDescription);
116 ARMARX_WARNING <<
"Robot unit '" << robotUnit->ice_getIdentity().name <<
"' does not have a kinematic unit."
117 <<
"\n Cannot commit robot description.";
125 return doLocked([
this, ×tamp]()
146 robotDescriptions.emplace(description->name, *description);
150 ARMARX_WARNING <<
"Could not convert entity instance to 'RobotDescription'";
155 return robotDescriptions;
std::string providerSegmentName
A bundle of updates to be sent to the memory.
Client-side working entity instance.
Helps connecting a Memory server to the Ice interface.
bool hasProviderSegment(const std::string &name) const
auto & getLatestSnapshot(int snapshotIndex=0)
Retrieve the latest entity snapshot.
static std::vector< std::string > FindAllArmarXSourcePackages()
#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...
void onConnect(const RobotUnitInterfacePrx &robotUnitPrx)
bool starts_with(const std::string &haystack, const std::string &needle)
bool forEachEntity(FunctionT &&func)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
std::vector< EntityUpdate > updates
The entity updates.
server::wm::CoreSegment * segmentPtr
MemoryID withProviderSegmentName(const std::string &name) const
static std::filesystem::path toSystemPath(const data::PackagePath &pp)
virtual ~Segment() override
auto doLocked(FunctionT &&function) const
An update of an entity for a specific point in time.
RobotDescriptionMap getRobotDescriptions(const armem::Time ×tamp) const
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
std::unordered_map< std::string, robot::RobotDescription > RobotDescriptionMap
Represents a point in time.
std::optional< RobotDescription > convertRobotDescription(const armem::wm::EntityInstance &instance)
MemoryID withEntityName(const std::string &name) const
MemoryToIceAdapter & iceMemory
Segment(server::MemoryToIceAdapter &iceMemory)
RobotDescriptionMap getRobotDescriptionsLocking(const armem::Time ×tamp) const
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
const MemoryID descriptionSegmentID
ProviderSegment & addProviderSegment(const std::string &name, Args... args)
void toAron(arondto::Robot &dto, const Robot &bo)
data::CommitResult commitLocking(const data::Commit &commitIce, Time timeArrived)
const armem::MemoryID MemoryID