18 std::ifstream file(fullFilePath);
21 throw std::runtime_error(
"Could not open config file: " + fullFilePath.string());
25 while (std::getline(file, line))
27 std::istringstream iss(line);
29 if (std::getline(iss, key,
'='))
32 if (std::getline(iss, value))
36 if (key ==
"weightBoundary")
40 else if (key ==
"weightPoseSmooth")
44 else if (key ==
"weightPoseSmoothOrientation")
48 else if (key ==
"weightVelocitySmooth")
52 else if (key ==
"weightPoseJerk")
56 else if (key ==
"weightRobotSmooth")
60 else if (key ==
"weightObstacle")
62 params.
w_obs = std::stof(value);
64 else if (key ==
"weightTracking")
66 params.
w_track = std::stof(value);
68 else if (key ==
"weightVelocityLimit")
72 else if (key ==
"weightSpacing")
76 else if (key ==
"clearance")
80 else if (key ==
"obsCollisionResidual")
84 else if (key ==
"obsMaxDistance")
88 else if (key ==
"vmax")
90 params.
vmax = std::stof(value);
92 else if (key ==
"useTracking")
96 else if (key ==
"useRobotSmooth")
100 else if (key ==
"useJerk")
102 params.
use_jerk = (value ==
"true");
104 else if (key ==
"useObstacle")
106 params.
use_obs = (value ==
"true");
108 else if (key ==
"maxIterations")
112 else if (key ==
"numThreads")
117 catch (
const std::invalid_argument&)
119 throw std::runtime_error(
"Invalid value for key " + key +
": " + value);