<commit_before>#include "iCubProprioception/SuperimposerHandler.h"
#include "iCubProprioception/common.h"

#include <exception>
#include <list>

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <yarp/os/LogStream.h>
#include <yarp/os/ConstString.h>
#include <yarp/os/Property.h>
#include <yarp/os/Time.h>
#include <yarp/sig/Vector.h>
#include <yarp/math/Math.h>

using namespace yarp::dev;
using namespace yarp::os;
using namespace yarp::sig;
using namespace yarp::math;


SuperimposerHandler::SuperimposerHandler(const yarp::os::ConstString& project_name) :
    ID_(project_name), log_ID_("[" + project_name + "]") { }


SuperimposerHandler::SuperimposerHandler() :
    SuperimposerHandler("SuperimposerModule") { }


bool SuperimposerHandler::configure(ResourceFinder &rf)
{
    this->setName(ID_.c_str());

    /* Setting default parameters. */
    ConstString context = rf.getContext();


    /* Parsing parameters from CLI. */
    /* Robot name */
    robot_    = rf.check("robot", Value("icubSim")).asString();
    skeleton_ = ((rf.findGroup("skel").size()   == 1 ? true : (rf.findGroup("skel").size()  == 2 ? rf.find("skel").asBool()  : false)));
    ikin_     = ((rf.findGroup("ikin").size()   == 1 ? true : (rf.findGroup("ikin").size()  == 2 ? rf.find("ikin").asBool()  : false)));
    ext_      = ((rf.findGroup("ext").size()    == 1 ? true : (rf.findGroup("ext").size()   == 2 ? rf.find("ext").asBool()   : false)));
    batch_    = ((rf.findGroup("batch").size()  == 1 ? true : (rf.findGroup("batch").size() == 2 ? rf.find("batch").asBool() : false)));

    draw_thumb_   = rf.findGroup("SICAD").check("draw_thumb",   Value(false)).asBlob();
    draw_forearm_ = rf.findGroup("SICAD").check("draw_forearm", Value(false)).asBlob();

    yInfo() << log_ID_ << "Running with:";
    yInfo() << log_ID_ << " - robot name:"              << robot_;
    yInfo() << log_ID_ << " - draw skeleton:"           << (skeleton_ ? "true" : "false");
    yInfo() << log_ID_ << " - render using ikin:"       << (ikin_     ? "true" : "false");
    yInfo() << log_ID_ << " - render using ext source:" << (ext_      ? "true" : "false");
    yInfo() << log_ID_ << " - render batch data:"       << (batch_    ? "true" : "false");


    /* Search mesh files in /mesh context folder */
    rf.setDefaultContext(context + "/mesh");

    cad_hand_["palm"] = rf.findFileByName("r_palm.obj");
    if (!fileFound(cad_hand_["palm"])) return false;
    cad_hand_["thumb1"] = rf.findFileByName("r_tl0.obj");
    if (!fileFound(cad_hand_["thumb1"])) return false;
    cad_hand_["thumb2"] = rf.findFileByName("r_tl1.obj");
    if (!fileFound(cad_hand_["thumb2"])) return false;
    cad_hand_["thumb3"] = rf.findFileByName("r_tl2.obj");
    if (!fileFound(cad_hand_["thumb3"])) return false;
    cad_hand_["thumb4"] = rf.findFileByName("r_tl3.obj");
    if (!fileFound(cad_hand_["thumb4"])) return false;
    cad_hand_["thumb5"] = rf.findFileByName("r_tl4.obj");
    if (!fileFound(cad_hand_["thumb5"])) return false;
    cad_hand_["index0"] = rf.findFileByName("r_indexbase.obj");
    if (!fileFound(cad_hand_["index0"])) return false;<commit_msg>Fix reading parametes with resourcefinder<commit_after>#include "iCubProprioception/SuperimposerHandler.h"
#include "iCubProprioception/common.h"

#include <exception>
#include <list>

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <yarp/os/LogStream.h>
#include <yarp/os/ConstString.h>
#include <yarp/os/Property.h>
#include <yarp/os/Time.h>
#include <yarp/sig/Vector.h>
#include <yarp/math/Math.h>

using namespace yarp::dev;
using namespace yarp::os;
using namespace yarp::sig;
using namespace yarp::math;


SuperimposerHandler::SuperimposerHandler(const yarp::os::ConstString& project_name) :
    ID_(project_name), log_ID_("[" + project_name + "]") { }


SuperimposerHandler::SuperimposerHandler() :
    SuperimposerHandler("SuperimposerModule") { }


bool SuperimposerHandler::configure(ResourceFinder &rf)
{
    this->setName(ID_.c_str());

    /* Setting default parameters. */
    ConstString context = rf.getContext();


    /* Parsing parameters from CLI. */
    /* Robot name */
    robot_    = rf.check("robot", Value("icubSim")).asString();
    skeleton_ = ((rf.findGroup("skel").size()   == 1 ? true : (rf.findGroup("skel").size()  == 2 ? rf.find("skel").asBool()  : false)));
    ikin_     = ((rf.findGroup("ikin").size()   == 1 ? true : (rf.findGroup("ikin").size()  == 2 ? rf.find("ikin").asBool()  : false)));
    ext_      = ((rf.findGroup("ext").size()    == 1 ? true : (rf.findGroup("ext").size()   == 2 ? rf.find("ext").asBool()   : false)));
    batch_    = ((rf.findGroup("batch").size()  == 1 ? true : (rf.findGroup("batch").size() == 2 ? rf.find("batch").asBool() : false)));

    draw_thumb_   = rf.findGroup("SICAD").check("draw_thumb",   Value(false)).asBool();
    draw_forearm_ = rf.findGroup("SICAD").check("draw_forearm", Value(false)).asBool();

    yInfo() << log_ID_ << "Running with:";
    yInfo() << log_ID_ << " - robot name:"              << robot_;
    yInfo() << log_ID_ << " - draw skeleton:"           << (skeleton_ ? "true" : "false");
    yInfo() << log_ID_ << " - render using ikin:"       << (ikin_     ? "true" : "false");
    yInfo() << log_ID_ << " - render using ext source:" << (ext_      ? "true" : "false");
    yInfo() << log_ID_ << " - render batch data:"       << (batch_    ? "true" : "false");


    /* Search mesh files in /mesh context folder */
    rf.setDefaultContext(context + "/mesh");

    cad_hand_["palm"] = rf.findFileByName("r_palm.obj");
    if (!fileFound(cad_hand_["palm"])) return false;
    cad_hand_["thumb1"] = rf.findFileByName("r_tl0.obj");
    if (!fileFound(cad_hand_["thumb1"])) return false;
    cad_hand_["thumb2"] = rf.findFileByName("r_tl1.obj");
    if (!fileFound(cad_hand_["thumb2"])) return false;
    cad_hand_["thumb3"] = rf.findFileByName("r_tl2.obj");
    if (!fileFound(cad_hand_["thumb3"])) return false;
    cad_hand_["thumb4"] = rf.findFileByName("r_tl3.obj");
    if (!fileFound(cad_hand_["thumb4"])) return false;
    cad_hand_["thumb5"] = rf.findFileByName("r_tl4.obj");
    if (!fileFound(cad_hand_["thumb5"])) return false;
    cad_hand_["index0"] = rf.findFileByName("r_indexbase.obj");
    if (!fileFound(cad_hand_["index0"])) return false;
{'fraction_non_alphanumeric': 0.2008914358484559, 'fraction_numerical': 0.008277618592804839, 'mean_word_length': 4.038492381716119, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1556794', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2271, 'n_words': 389}