24#include <VirtualRobot/ManipulationObject.h>
25#include <VirtualRobot/XML/ObjectIO.h>
29#include <ArmarXCore/interface/core/PackagePath.h>
40 const armarx::data::PackagePath& pp = objectSource.
path.
serialize();
41 std::filesystem::path relPath(pp.path);
42 ARMARX_CHECK(!relPath.empty()) <<
"Relative path to object should not be empty";
43 if (!relPath.empty() && relPath.begin()->string() == pp.package)
45 relPath = relPath.lexically_relative(*relPath.begin());
49 localCopy_ = VirtualRobot::ObjectIO::loadManipulationObject(newPackagePath.
toSystemPath());
50 localCopy_->setName(instanceName);
56 PosePtr pose(
new Pose(localCopy_->getGlobalPose()));
57 simulator->addObjectFromFile(
64 const PoseBasePtr& poseBase = simulator->getObjectPose(
getInstanceName());
65 Pose p(poseBase->position, poseBase->orientation);
66 localCopy_->setGlobalPose(p.
toEigen());
72 PosePtr pose(
new Pose(localCopy_->getGlobalPose()));
78 const VirtualRobot::SceneObjectSetPtr& objectSet)
80 return col->checkCollision(localCopy_->getCollisionModel(), objectSet);
86 return std::make_unique<Pose>(localCopy_->getGlobalPose());
92 localCopy_->setGlobalPose(pose->toEigen());
data::PackagePath serialize() const
static std::filesystem::path toSystemPath(const data::PackagePath &pp)
virtual Eigen::Matrix4f toEigen() const
SimulatedObjectAsObject(const std::string &instanceName, const ObjectSource &source)
std::unique_ptr< Pose > getLocalPose() override
void updatePoseFromSimulator(armarx::SimulatorInterfacePrx &simulator) override
void addToSimulator(armarx::SimulatorInterfacePrx &simulator) override
bool checkCollision(const VirtualRobot::CollisionCheckerPtr &col, const VirtualRobot::SceneObjectSetPtr &objectSet) override
void setLocalPose(const armarx::PosePtr &pose) override
void updatePoseToSimulator(armarx::SimulatorInterfacePrx &simulator) override
const std::string & getInstanceName()
const ObjectSource & getObjectSource()
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
IceInternal::Handle< Pose > PosePtr