31 initialize( *INI_FILE );
36 options.loadFromConfigFile(INI_FILE, getConfigFileSectionName());
40 options.saveToConfigFile(
c, getConfigFileSectionName());
48 const auto ptg = getAssociatedPTG();
49 const double ptg_ref_dist = ptg ? ptg->getRefDistance() : 1.0;
52 no.
logRecord = CLogFileRecord_VFF::Create();
60 const double inc_ang = 2*
M_PI/
n;
61 double ang = -
M_PI + 0.5*inc_ang;
62 for (
size_t i=0;i<
n;i++, ang+=inc_ang )
69 instantaneousForce.
x = -cos(ang) * mod;
70 instantaneousForce.
y = -sin(ang) * mod;
71 resultantForce += instantaneousForce;
75 const double obstcl_weight = 20.0/ ni.
obstacles.size();
76 resultantForce *= obstcl_weight;
78 const double obstacleNearnessFactor =
std::min( 1.0, 6.0/resultantForce.norm());
82 const auto trg = *ni.
targets.rbegin();
84 const double ang = atan2(trg.y, trg.x );
85 const double mod = options.TARGET_ATTRACTIVE_FORCE;
90 0 : atan2( resultantForce.y, resultantForce.x );
94 if (m_enableApproachTargetSlowDown)
96 const double targetNearnessFactor =
std::min(1.0, trg.norm() / (options.TARGET_SLOW_APPROACHING_DISTANCE/ ptg_ref_dist));
107 out << options.TARGET_ATTRACTIVE_FORCE << options.TARGET_SLOW_APPROACHING_DISTANCE;
116 in >> options.TARGET_ATTRACTIVE_FORCE >> options.TARGET_SLOW_APPROACHING_DISTANCE;
158 CHolonomicVFF::TOptions::TOptions() :
159 TARGET_SLOW_APPROACHING_DISTANCE ( 0.10 ),
160 TARGET_ATTRACTIVE_FORCE ( 20.0 )
180 MRPT_SAVE_CONFIG_VAR_COMMENT(TARGET_ATTRACTIVE_FORCE,
"Dimension-less (may have to be tuned depending on the density of obstacle sampling)");
A holonomic reactive navigation method, based on Virtual Force Fields (VFF).
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
A class for storing extra information about the execution of CHolonomicVFF navigation.
A base class for holonomic reactive navigation methods.
void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string §ion) const MRPT_OVERRIDE
This method saves the options to a ".ini"-like file or memory-stored string list. ...
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
This class allows loading and storing values and vectors of different types from a configuration text...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
A base class for log records for different holonomic navigation methods.
double desiredDirection
The desired motion direction, in the range [-PI, PI].
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
GLsizei const GLchar ** string
double desiredSpeed
The desired motion speed in that direction, from 0 up to NavInput::maxRobotSpeed. ...
#define MRPT_LOAD_CONFIG_VAR(variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLsizei GLsizei GLchar * source
Output for CAbstractHolonomicReactiveMethod::navigate()
CHolonomicLogFileRecordPtr logRecord
The navigation method will create a log record and store it here via a smart pointer.