Skip to content
Snippets Groups Projects
Commit d482b53d authored by Fabian Reister's avatar Fabian Reister
Browse files

ArticulatedObjectWriter: fixing data path

parent 7e335efe
No related branches found
No related tags found
1 merge request!317Feature/open fridge
...@@ -3,44 +3,53 @@ ...@@ -3,44 +3,53 @@
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Geometry> #include <Eigen/Geometry>
#include <VirtualRobot/Robot.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/logging/Logging.h> #include <ArmarXCore/core/logging/Logging.h>
#include <ArmarXCore/core/system/ArmarXDataPath.h> #include <ArmarXCore/core/system/ArmarXDataPath.h>
#include <ArmarXCore/core/system/cmake/CMakePackageFinder.h>
#include <VirtualRobot/Robot.h>
namespace armarx::armem::articulated_object namespace armarx::armem::articulated_object
{ {
armem::articulated_object::ArticulatedObject convert( armem::articulated_object::ArticulatedObject
const VirtualRobot::Robot& obj, convert(const VirtualRobot::Robot& obj, const armem::Time& timestamp)
const armem::Time& timestamp)
{ {
ARMARX_DEBUG << "Filename is " << obj.getFilename(); ARMARX_DEBUG << "Filename is " << obj.getFilename();
// TODO(fabian.reister): remove "PriorKnowledgeData" below const std::vector<std::string> packages =
armarx::CMakePackageFinder::FindAllArmarXSourcePackages();
const std::string package = armarx::ArmarXDataPath::getProject(packages, obj.getFilename());
return armem::articulated_object::ArticulatedObject // make sure that the relative path is without the 'package/' prefix
const std::string fileRelPath = [&obj, &package]() -> std::string
{ {
.description = { if (simox::alg::starts_with(obj.getFilename(), package))
.name = obj.getType(), {
.xml = PackagePath(armarx::ArmarXDataPath::getProject( // remove "package" + "/"
{"PriorKnowledgeData"}, obj.getFilename()), const std::string fixedFilename = obj.getFilename().substr(package.size() + 1, -1);
obj.getFilename()) return fixedFilename;
}, }
.instance = obj.getName(),
.config = { return obj.getFilename();
.timestamp = timestamp, }();
.globalPose = Eigen::Affine3f(obj.getRootNode()->getGlobalPose()),
.jointMap = obj.getJointValues() return armem::articulated_object::ArticulatedObject{
}, .description = {.name = obj.getType(),
.timestamp = timestamp}; .xml = PackagePath(armarx::ArmarXDataPath::getProject(
{package}, fileRelPath),
obj.getFilename())},
.instance = obj.getName(),
.config = {.timestamp = timestamp,
.globalPose = Eigen::Affine3f(obj.getRootNode()->getGlobalPose()),
.jointMap = obj.getJointValues()},
.timestamp = timestamp};
} }
bool bool
ArticulatedObjectWriter::storeArticulatedObject( ArticulatedObjectWriter::storeArticulatedObject(const VirtualRobot::RobotPtr& articulatedObject,
const VirtualRobot::RobotPtr& articulatedObject, const armem::Time& timestamp)
const armem::Time& timestamp)
{ {
ARMARX_CHECK_NOT_NULL(articulatedObject); ARMARX_CHECK_NOT_NULL(articulatedObject);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment