3#include <VirtualRobot/RuntimeEnvironment.h>
25 const PriorKnowledgeInterfacePrx& priorKnowledge,
26 const WorkingMemoryInterfacePrx& workingMemory,
28 const std::vector<std::string>& datasets)
35 objectClassSegment.initFromProxy(priorKnowledge, datasets);
36 attachments.initFromProxies(workingMemory, robotStateComponent);
38 this->robotStateComponent = robotStateComponent;
40 robotStateComponent,
"", {}, VirtualRobot::RobotIO::RobotDescription::eStructure);
41 this->objectInstanceSegment = workingMemory->getObjectInstancesSegment();
66 std::vector<ObjectInstancePtr> objectInstances = attachments.queryObjects();
76 for (
const auto&
object : objectInstances)
80 layer.
add(*vizObject);
83 arviz.commit({layer});
91 .
plane(Eigen::Vector3f(0, 0, height), Eigen::Quaternionf::Identity(), extents)
92 .
color(simox::Color::gray(200));
107 VirtualRobot::RuntimeEnvironment::getDataFileAbsolute(filename);
111 std::optional<armarx::viz::Object>
115 std::string objectName =
object->getName();
116 const std::string className =
object->getMostProbableClass();
117 const std::string vizName = objectName +
"_" +
object->getId();
119 if (objectClassBlackWhitelist.isExcluded(className))
125 std::string filename = getClassFilename(className);
126 if (filename.empty())
130 <<
"Skipping object '" <<
object->getName() <<
"'.";
135 Eigen::Matrix4f globalPose = attachments.getObjectPoseInFrame(
object,
armarx::GlobalFrame);
141 ObjectInstancesToArViz::getClassFilename(
const std::string& className)
144 if (
auto it = classFilenameCache.find(className); it != classFilenameCache.end())
152 std::optional<ObjectClassWrapper> objectClass = objectClassSegment.
getClass(className);
158 objectClass->classInMemory->getWrapper<EntityWrappers::SimoxObjectWrapper>();
160 std::string filename = wrapper->getManipulationObjectFileName();
163 classFilenameCache[className] = filename;
171 const armarx::BlackWhitelistUpdate& update)
175 ARMARX_VERBOSE <<
"Updated object class black-whitelist: \n" << objectClassBlackWhitelist;
182 attachments.attachObjectToRobotNode(attachment);
187 const DetachObjectFromRobotNodeInput& detachment)
190 attachments.detachObjectFromRobotNode(detachment);
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
DerivedT & pose(Eigen::Matrix4f const &pose)
DerivedT & color(Color color)
std::optional< ObjectClassWrapper > getClass(std::string const &className) const
std::optional< armarx::viz::Object > makeObject(const ObjectInstancePtr &object)
Make a armarx::viz::Object from a memoryx::ObjectInstance.
void initFromProxies(const PriorKnowledgeInterfacePrx &priorKnowledge, const WorkingMemoryInterfacePrx &workingMemory, const armarx::RobotStateComponentInterfacePrx &robotStateComponent, const std::vector< std::string > &datasets)
Set the proxies.
void updateObjectClassBlackWhitelist(const armarx::BlackWhitelistUpdate &update)
std::string floorObjectFilename
void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput &attachment)
void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput &detachment)
std::string getFloorObjectFile()
armarx::viz::Polygon makeFloorPolygon(const Eigen::Vector2f &extents={10000, 10000}, float height=0)
Make a polygon representing the floor.
void setArViz(armarx::viz::Client arviz)
Set the ArViz client.
armarx::viz::Object makeFloorObject(const std::string &name="Floor")
void updateFloorObject(float height=0)
Draw a the floor as a simox object.
void updateFloorPolygon(const Eigen::Vector2f &extents={10000, 10000}, float height=0)
Draw a the floor as a polygon.
void updateObjects()
Query object instances and update their visualization.
std::string layerNameObjects
std::string layerNameFloor
#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_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
std::string const GlobalFrame
Variable of the global coordinate system.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
void updateBlackWhitelist(StringBlackWhitelist &bw, const armarx::BlackWhitelistUpdate &update)
IceInternal::Handle< SimoxObjectWrapper > SimoxObjectWrapperPtr
IceInternal::Handle< ObjectInstance > ObjectInstancePtr
void add(ElementT const &element)
Object & file(std::string const &project, std::string const &filename)
Polygon & plane(Eigen::Hyperplane3f plane, Eigen::Vector3f at, Eigen::Vector2f size)
Add points representing a plane as rectangle.