Commit b12a1324 authored by Steve Tonneau's avatar Steve Tonneau
Browse files

corba interface for running analysises

parent 33a52da1
......@@ -226,6 +226,17 @@ module hpp
/// \return whether the configuration is quasi-statically balanced
short isConfigBalanced(in floatSeq config, in Names_t contacts, in double robustnessTreshold) raises (Error);
/// run and store an analysis on all limb databases
/// \param analysis name of the analysis existing
/// \param isstatic 1 is becomes new static value of database, 0 otherwise
void runSampleAnalysis(in string analysis, in double isstatic) raises (Error);
/// run and store an analysis on a limb database
/// \param limbname name of the limb to perform the analysis to
/// \param analysis name of the analysis existing
/// \param isstatic 1 is becomes new static value of database, 0 otherwise
void runLimbSampleAnalysis(in string limbname, in string analysis, in double isstatic) raises (Error);
}; // interface Robot
}; // module rbprm
}; // module corbaserver
......
......@@ -213,6 +213,27 @@ class FullBody (object):
else:
return False
## Updates limb databases with a user chosen computation
#
# \param analysis name of computation
# \param isstatic whether the computation should be used to sort samples by default
def runSampleAnalysis(self, analysis, isstatic):
isStatic = 0.
if(isstatic):
isStatic = 1.
self.client.rbprm.rbprm.runSampleAnalysis(analysis,isStatic)
## Updates a limb database with a user chosen computation
#
# \param limbname name of the limb chosen for computation
# \param analysis name of computation
# \param isstatic whether the computation should be used to sort samples by default
def runLimbSampleAnalysis(self, limbname, analysis, isstatic):
isStatic = 0.
if(isstatic):
isStatic = 1.
self.client.rbprm.rbprm.runLimbSampleAnalysis(limbname, analysis,isStatic)
## Create octree nodes representation for a given limb
#
# \param gui gepetoo viewer instance discretization step
......
......@@ -695,6 +695,56 @@ namespace hpp {
}
}
void RbprmBuilder::runSampleAnalysis(const char* analysis, double isstatic) throw (hpp::Error)
{
try
{
std::string eval(analysis);
sampling::T_evaluate::const_iterator analysisit = analysisFactory_.evaluate_.find(std::string(eval));
if(analysisit == analysisFactory_.evaluate_.end())
{
std::string err("No analysis named " + eval + "was defined for analyzing database sample");
throw Error (err.c_str());
}
for(T_Limb::const_iterator cit = fullBody_->GetLimbs().begin(); cit !=fullBody_->GetLimbs().end();++cit)
{
sampling::SampleDB & sampleDB =const_cast<sampling::SampleDB &> (cit->second->sampleContainer_);
sampling::addValue(sampleDB, analysisit->first, analysisit->second, isstatic > 0.5, isstatic > 0.5);
}
}
catch(std::runtime_error& e)
{
throw Error(e.what());
}
}
void RbprmBuilder::runLimbSampleAnalysis(const char* limbname, const char* analysis, double isstatic) throw (hpp::Error)
{
try
{
std::string eval(analysis);
sampling::T_evaluate::const_iterator analysisit = analysisFactory_.evaluate_.find(std::string(eval));
if(analysisit == analysisFactory_.evaluate_.end())
{
std::string err("No analysis named " + eval + "was defined for analyzing database sample");
throw Error (err.c_str());
}
T_Limb::const_iterator lit = fullBody_->GetLimbs().find(std::string(limbname));
if(lit == fullBody_->GetLimbs().end())
{
std::string err("No limb " + std::string(limbname) + "was defined for robot" + fullBody_->device_->name());
throw Error (err.c_str());
}
sampling::SampleDB & sampleDB =const_cast<sampling::SampleDB &> (lit->second->sampleContainer_);
sampling::addValue(sampleDB, analysisit->first, analysisit->second, isstatic > 0.5, isstatic > 0.5);
}
catch(std::runtime_error& e)
{
throw Error(e.what());
}
}
void RbprmBuilder::SetProblemSolver (hpp::core::ProblemSolverPtr_t problemSolver)
{
problemSolver_ = problemSolver;
......
......@@ -24,6 +24,7 @@
# include <hpp/rbprm/rbprm-fullbody.hh>
# include <hpp/rbprm/rbprm-shooter.hh>
# include <hpp/rbprm/rbprm-validation.hh>
# include <hpp/rbprm/sampling/analysis.hh>
# include <hpp/core/collision-path-validation-report.hh>
# include <hpp/core/problem-solver.hh>
# include <hpp/core/discretized-collision-checking.hh>
......@@ -123,6 +124,9 @@ namespace hpp {
virtual hpp::floatSeqSeq* GetOctreeBoxes(const char* limbName, const hpp::floatSeq& configuration) throw (hpp::Error);
virtual hpp::floatSeq* getOctreeTransform(const char* limbName, const hpp::floatSeq& configuration) throw (hpp::Error);
virtual CORBA::Short isConfigBalanced(const hpp::floatSeq& config, const hpp::Names_t& contactLimbs, double robustnessTreshold) throw (hpp::Error);
virtual void runSampleAnalysis(const char* analysis, double isstatic) throw (hpp::Error);
virtual void runLimbSampleAnalysis(const char* limbname, const char* analysis, double isstatic) throw (hpp::Error);
public:
void SetProblemSolver (hpp::core::ProblemSolverPtr_t problemSolver);
......@@ -139,6 +143,7 @@ namespace hpp {
rbprm::State startState_;
rbprm::State endState_;
std::vector<rbprm::State> lastStatesComputed_;
sampling::AnalysisFactory analysisFactory_;
}; // class RobotBuilder
} // namespace impl
} // namespace manipulation
......
Supports Markdown
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