Skip to content
Snippets Groups Projects

Feature/object memory connected to robot state memory

7 files
+ 57
20
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -21,7 +21,9 @@
*/
#include "ObjectMemory.h"
#include <VirtualRobot/VirtualRobot.h>
#include "ArmarXCore/core/time/Clock.h"
#include <ArmarXCore/core/ice_conversions/ice_conversions_templates.h>
#include <ArmarXCore/core/time/ice_conversions.h>
@@ -65,6 +67,8 @@ namespace armarx::armem::server::obj
"Duration of time window into the past to use for predictions"
" when requested via the PredictingMemoryInterface (in seconds).");
defs->optional(robotName, "robotName", "");
return defs;
}
@@ -74,6 +78,7 @@ namespace armarx::armem::server::obj
classSegment(iceAdapter()),
attachmentSegment(iceAdapter())
{
addPlugin(virtualRobotReaderPlugin);
}
@@ -130,20 +135,26 @@ namespace armarx::armem::server::obj
{
// onConnect can be called multiple times, but addRobot will fail if called more than once with the same ID
// So we need to always make sure to guard a call to addRobot
const std::string robotKey = "robot";
VirtualRobot::RobotPtr robot = RobotState::hasRobot(robotKey)
? RobotState::getRobot(robotKey)
: RobotState::addRobot(robotKey, VirtualRobot::RobotIO::RobotDescription::eStructure);
// const std::string robotKey = "robot";
// VirtualRobot::RobotPtr robot = RobotState::hasRobot(robotKey)
// ? RobotState::getRobot(robotKey)
// : RobotState::addRobot(robotKey, VirtualRobot::RobotIO::RobotDescription::eStructure);
robotStateComponent = RobotState::getRobotStateComponent();
// TODO: the instance segment should check the provided object poses and instantiate the needed robots by itself.
ARMARX_CHECK_NOT_NULL(virtualRobotReaderPlugin);
VirtualRobot::RobotPtr robot = virtualRobotReaderPlugin->get().getSynchronizedRobot(robotName, armarx::Clock::Now(), VirtualRobot::RobotIO::RobotDescription::eStructure, true);
ARMARX_CHECK_NOT_NULL(robot);
getProxyFromProperty(kinematicUnitObserver, "cmp.KinematicUnitObserverName", false, "", false);
// Create first to use the original values.
createRemoteGuiTab();
// ARMARX_CHECK(virtualRobotReaderPlugin->isAvailable());
instance::SegmentAdapter::connect(
robotStateComponent,
&virtualRobotReaderPlugin->get(),
robot,
kinematicUnitObserver,
ArVizComponentPluginUser::getArvizClient(),
Loading