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

fix: removing package_name from relative path to create PackagePath

parent 9b5fa128
No related branches found
No related tags found
1 merge request!313Issues with PackagePath and robot visualization
#include "Segment.h"
#include <SimoxUtility/algorithm/string/string_tools.h>
#include <ArmarXCore/core/application/properties/PluginAll.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
......@@ -83,14 +84,26 @@ namespace armarx::armem::server::robot_state::description
const std::vector<std::string> packages = armarx::CMakePackageFinder::FindAllArmarXSourcePackages();
const std::string package = armarx::ArmarXDataPath::getProject(packages, robotFilename);
const std::string fixedRobotFilename = robotFilename.substr(package.size() + 1, -1);
ARMARX_INFO << "Robot description '" << VAROUT(fixedRobotFilename) << "' found in package " << package;
// make sure that the relative path is without the 'package/' prefix
const std::string robotFileRelPath = [&robotFilename, &package]()-> std::string {
if(simox::alg::starts_with(robotFilename, package))
{
// remove "package" + "/"
const std::string fixedRobotFilename = robotFilename.substr(package.size() + 1, -1);
return fixedRobotFilename;
}
return robotFilename;
}();
ARMARX_INFO << "Robot description '" << VAROUT(robotFileRelPath) << "' found in package " << package;
const robot::RobotDescription robotDescription
{
.name = kinematicUnit->getRobotName(),
.xml = {package, fixedRobotFilename}
}; // FIXME
.xml = {package, robotFileRelPath}
};
commitRobotDescription(robotDescription);
}
......
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