Skip to content

Commit ef3294f

Browse files
committed
Revert "Format max_velocity and max_acceleration for YAML output as float"
This reverts commit c86e3b2.
1 parent 0120591 commit ef3294f

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -300,21 +300,7 @@ bool SRDFConfig::GeneratedJointLimits::writeYaml(YAML::Emitter& emitter)
300300

301301
// Output property
302302
emitter << YAML::Key << "max_velocity";
303-
304-
// To Solve Putting integer Values like 100 as 100.0 in YAML
305-
double val = std::min(fabs(b.max_velocity_), fabs(b.min_velocity_));
306-
307-
// Check if val is a full integer (within floating-point tolerance)
308-
bool is_integer = std::fabs(val - std::round(val)) < 1e-9;
309-
310-
// Format value as string
311-
std::ostringstream oss;
312-
if (is_integer)
313-
oss << std::fixed << std::setprecision(1) << val; // e.g. 100.0
314-
else
315-
oss << val; // e.g. 99.75
316-
317-
emitter << YAML::Value << oss.str();
303+
emitter << YAML::Value << static_cast<double>(std::min(fabs(b.max_velocity_), fabs(b.min_velocity_)));
318304

319305
// Output property
320306
emitter << YAML::Key << "has_acceleration_limits";
@@ -329,21 +315,7 @@ bool SRDFConfig::GeneratedJointLimits::writeYaml(YAML::Emitter& emitter)
329315

330316
// Output property
331317
emitter << YAML::Key << "max_acceleration";
332-
333-
// To Solve Putting integer Values like 100 as 100.0 in YAML
334-
val = std::min(fabs(b.max_acceleration_), fabs(b.min_acceleration_));
335-
336-
// Check if val is a full integer (within floating-point tolerance)
337-
is_integer = std::fabs(val - std::round(val)) < 1e-9;
338-
339-
// Format value as string
340-
oss.str(""); // Clear the stringstream
341-
if (is_integer)
342-
oss << std::fixed << std::setprecision(1) << val; // e.g. 100.0
343-
else
344-
oss << val; // e.g. 99.75
345-
346-
emitter << YAML::Value << oss.str();
318+
emitter << YAML::Value << static_cast<double>(std::min(fabs(b.max_acceleration_), fabs(b.min_acceleration_)));
347319

348320
emitter << YAML::EndMap;
349321
}

0 commit comments

Comments
 (0)