Commit 57c425af authored by florent's avatar florent
Browse files

ChppPlanner::parseFile detects hpp::core::io::HumanoidRobot

	* src/hppPlanner.cpp: transform hpp::core::io::HumanoidRobot
	  into ChppHumanoidRobot,
	* src/humanoid-robot.cc: initialize ChppHumanoidRobot.
parent b91612c6
......@@ -23,6 +23,7 @@
#include "hppCore/hppProblem.h"
#include "humanoid-robot.hh"
#include "hppModel/hppBody.h"
#include <hppModel/hppHumanoidRobot.h>
#include "KineoUtility/kitNotificator.h"
#include "KineoWorks2/kwsDirectPath.h"
......@@ -773,6 +774,17 @@ ktStatus ChppPlanner::parseFile(const std::string& inFileName)
modelTree->deviceNode()->childComponent(i));
if(deviceComponent) {
// If device is of type io::hpp::core::HumanoidRobot, transform it
// into a ChppHumanoidRobot
hpp::core::io::HumanoidRobotShPtr humanoidRobot =
KIT_DYNAMIC_PTR_CAST(hpp::core::io::HumanoidRobot, deviceComponent);
if (humanoidRobot) {
// Set config to 0
CkwsConfig config(deviceComponent);
deviceComponent->setCurrentConfig(config);
deviceComponent = humanoidRobot->createHppHumanoidRobot();
if (!deviceComponent) return KD_ERROR;
}
addHppProblem(deviceComponent, HPPPLANNER_DEFAULT_PENETRATION);
devicesIndex.insert
(std::pair<CkppDeviceComponentShPtr,unsigned int>(deviceComponent,
......
......@@ -29,6 +29,7 @@ ChppHumanoidRobotShPtr HumanoidRobot::createHppHumanoidRobot() const
try {
ChppJoint* rootJoint = buildKinematicChain(robot, rootJointComponent());
robot->setRootJoint(rootJoint);
robot->initialize();
}
catch (const std::exception& exc) {
std::cerr <<
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment