Skip to content
Snippets Groups Projects
Commit bf4e00b0 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

extended create local clone functions

parent ea041c5b
No related branches found
No related tags found
No related merge requests found
...@@ -327,12 +327,12 @@ namespace armarx ...@@ -327,12 +327,12 @@ namespace armarx
return robo; return robo;
} }
VirtualRobot::RobotPtr RemoteRobot::createLocalClone(RobotStateComponentInterfacePrx robotStatePrx, const string& filename, const Ice::StringSeq packages) VirtualRobot::RobotPtr RemoteRobot::createLocalClone(RobotStateComponentInterfacePrx robotStatePrx, const string& filename, const Ice::StringSeq packages, VirtualRobot::RobotIO::RobotDescription loadMode)
{ {
return createLocalClone(robotStatePrx->getSynchronizedRobot(), filename, robotStatePrx->getScaling(), packages); return createLocalClone(robotStatePrx->getSynchronizedRobot(), filename, robotStatePrx->getScaling(), packages, loadMode);
} }
RobotPtr RemoteRobot::createLocalClone(SharedRobotInterfacePrx sharedRobotPrx, std::string filename, float scaling, const Ice::StringSeq packages) RobotPtr RemoteRobot::createLocalClone(SharedRobotInterfacePrx sharedRobotPrx, std::string filename, float scaling, const Ice::StringSeq packages, VirtualRobot::RobotIO::RobotDescription loadMode)
{ {
RobotPtr result; RobotPtr result;
...@@ -386,7 +386,7 @@ namespace armarx ...@@ -386,7 +386,7 @@ namespace armarx
ARMARX_ERROR_S << "Could find robot file " << filename; ARMARX_ERROR_S << "Could find robot file " << filename;
return result; return result;
} }
result = RobotIO::loadRobot(filename); result = RobotIO::loadRobot(filename, loadMode);
if (!result) if (!result)
{ {
...@@ -405,6 +405,13 @@ namespace armarx ...@@ -405,6 +405,13 @@ namespace armarx
return result; return result;
} }
RobotPtr RemoteRobot::createLocalCloneFromFile(RobotStateComponentInterfacePrx robotStatePrx, RobotIO::RobotDescription loadMode)
{
return createLocalClone(robotStatePrx, robotStatePrx->getRobotFilename(), robotStatePrx->getArmarXPackages(), loadMode);
}
bool RemoteRobot::synchronizeLocalClone(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStatePrx) bool RemoteRobot::synchronizeLocalClone(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStatePrx)
{ {
return synchronizeLocalClone(robot, robotStatePrx->getSynchronizedRobot()); return synchronizeLocalClone(robot, robotStatePrx->getSynchronizedRobot());
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <VirtualRobot/VirtualRobot.h> #include <VirtualRobot/VirtualRobot.h>
#include <VirtualRobot/Robot.h> #include <VirtualRobot/Robot.h>
#include <VirtualRobot/XML/RobotIO.h>
#include <VirtualRobot/RobotNodeSet.h> #include <VirtualRobot/RobotNodeSet.h>
#include <VirtualRobot/Nodes/RobotNode.h> #include <VirtualRobot/Nodes/RobotNode.h>
#include <VirtualRobot/Nodes/RobotNodeRevolute.h> #include <VirtualRobot/Nodes/RobotNodeRevolute.h>
...@@ -184,10 +185,22 @@ namespace armarx ...@@ -184,10 +185,22 @@ namespace armarx
In order to get a fully featured robot model you can pass a filename to VirtualRobot::Robot, In order to get a fully featured robot model you can pass a filename to VirtualRobot::Robot,
but then you need to make sure that the loaded model is identical to the model of the remote robot (otherwise errors will occur). but then you need to make sure that the loaded model is identical to the model of the remote robot (otherwise errors will occur).
In the packages parameter you can pass in ArmarX packages, in which the robot file model might be in. In the packages parameter you can pass in ArmarX packages, in which the robot file model might be in.
The loadMode specifies in which mode the model should be loaded. Refer to simox for more information (only matters if filename was passed in).
@see createLocalCloneFromFile(), synchronizeLocalClone()
*/ */
static VirtualRobot::RobotPtr createLocalClone(RobotStateComponentInterfacePrx robotStatePrx, const std::string& filename = std::string(), const Ice::StringSeq packages = Ice::StringSeq()); static VirtualRobot::RobotPtr createLocalClone(RobotStateComponentInterfacePrx robotStatePrx, const std::string& filename = std::string(), const Ice::StringSeq packages = Ice::StringSeq(), VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eFull);
static VirtualRobot::RobotPtr createLocalClone(SharedRobotInterfacePrx sharedRobotPrx, std::string filename = std::string(), float scaling = 1.0f, const Ice::StringSeq packages = Ice::StringSeq(), VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eFull);
/**
* @brief This is a convenience function for createLocalClone, which automatically get the filename from the RobotStateComponent, loads robot from the file and syncs it once.
* @param robotStatePrx proxy to the RobotStateComponent
* @param loadMode he loadMode specifies in which mode the model should be loaded. Refer to simox for more information.
* @return new robot clone
* @see createLocalClone(), synchronizeLocalClone()
*/
static VirtualRobot::RobotPtr createLocalCloneFromFile(RobotStateComponentInterfacePrx robotStatePrx, VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eFull);
static VirtualRobot::RobotPtr createLocalClone(SharedRobotInterfacePrx sharedRobotPrx, std::string filename = std::string(), float scaling = 1.0f, const Ice::StringSeq packages = Ice::StringSeq());
/*! /*!
Use this method to synchronize (i.e. copy the joint values) from the remote robot to the local clone. Use this method to synchronize (i.e. copy the joint values) from the remote robot to the local clone.
......
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