- Author
- Rosen Diankov
Usage:
ikloader [robot filename] [iktype]
Example:
ikfastloader robots/barrettwam.robot.xml Transform6D
Show how to load an ikfast solver from C++ by specifying the robot and iktype.
Full Example Code:
#include <vector>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/format.hpp>
using namespace OpenRAVE;
using namespace std;
int main(
int argc,
char ** argv)
{
if( argc < 3 ) {
return 1;
}
string robotname = argv[1];
string iktype = argv[2];
{
EnvironmentMutex::scoped_lock lock(penv->GetMutex());
if( !probot ) {
penv->Destroy();
return 2;
}
penv->Add(probot);
penv->Add(pikfast,true,"");
stringstream ssin,ssout;
ssin << "LoadIKFastSolver " << probot->GetName() << " " << iktype;
if( !pikfast->SendCommand(ssout,ssin) ) {
penv->Destroy();
return 1;
}
while(1) {
vector<dReal> vsolution;
stringstream ss; ss << "solution is: ";
for(size_t i = 0; i < vsolution.size(); ++i) {
ss << vsolution[i] << " ";
}
ss << endl;
}
else {
}
}
}
return 0;
}