Skip to content

Commit faae757

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3ea4df3 commit faae757

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

src/parsers/mjcf/mjcf-graph.cpp

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ namespace pinocchio
5959
else
6060
{
6161
if (filePath.extension().empty())
62-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Cannot find extension for one of the mesh/texture");
62+
PINOCCHIO_THROW_PRETTY(
63+
std::invalid_argument, "Cannot find extension for one of the mesh/texture");
6364

6465
auto st = filePath.stem();
6566
if (!st.empty())
6667
return st.string();
6768
else
68-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Cannot find a name for one of the mesh.texture");
69+
PINOCCHIO_THROW_PRETTY(
70+
std::invalid_argument, "Cannot find a name for one of the mesh.texture");
6971
}
7072
}
7173

@@ -172,7 +174,8 @@ namespace pinocchio
172174
{
173175

174176
if (!use_limits && el.get_optional<std::string>("<xmlattr>.range"))
175-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Range limit is specified but it was not specify to use it.");
177+
PINOCCHIO_THROW_PRETTY(
178+
std::invalid_argument, "Range limit is specified but it was not specify to use it.");
176179

177180
// Type
178181
auto type_s = el.get_optional<std::string>("<xmlattr>.type");
@@ -227,7 +230,8 @@ namespace pinocchio
227230
else if (jointType == "hinge")
228231
posRef = currentCompiler.convertAngle(*value);
229232
else
230-
PINOCCHIO_THROW_PRETTY(std::invalid_argument,
233+
PINOCCHIO_THROW_PRETTY(
234+
std::invalid_argument,
231235
"Reference position can only be used with hinge or slide joints.");
232236
}
233237
}
@@ -358,7 +362,8 @@ namespace pinocchio
358362
double mass = std::max(el.get<double>("<xmlattr>.mass"), compilerInfo.boundMass);
359363
;
360364
if (mass < 0)
361-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Mass of body is not supposed to be negative");
365+
PINOCCHIO_THROW_PRETTY(
366+
std::invalid_argument, "Mass of body is not supposed to be negative");
362367

363368
Inertia::Vector3 com;
364369
auto com_s = el.get_optional<std::string>("<xmlattr>.pos");
@@ -410,7 +415,8 @@ namespace pinocchio
410415
auto chcl_s = childClass;
411416
// if inertiafromgeom is false and inertia does not exist - throw
412417
if (!compilerInfo.inertiafromgeom && !el.get_child_optional("inertial"))
413-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Cannot get inertia from geom and no inertia was found");
418+
PINOCCHIO_THROW_PRETTY(
419+
std::invalid_argument, "Cannot get inertia from geom and no inertia was found");
414420

415421
bool usegeominertia = false;
416422
if (compilerInfo.inertiafromgeom)
@@ -666,7 +672,8 @@ namespace pinocchio
666672
mapOfClasses.insert(std::make_pair(*nameClass, classDefault));
667673
}
668674
else
669-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Class does not have a name. Cannot parse model.");
675+
PINOCCHIO_THROW_PRETTY(
676+
std::invalid_argument, "Class does not have a name. Cannot parse model.");
670677
}
671678
else if (v.first == "default")
672679
parseDefault(v.second, el, v.first);
@@ -736,8 +743,8 @@ namespace pinocchio
736743
std::string eulerseq = *eulerS;
737744
if (eulerseq.find_first_not_of("xyzXYZ") != std::string::npos || eulerseq.size() != 3)
738745
{
739-
PINOCCHIO_THROW_PRETTY(std::invalid_argument,
740-
"Model tried to use euler angles but euler sequence is wrong");
746+
PINOCCHIO_THROW_PRETTY(
747+
std::invalid_argument, "Model tried to use euler angles but euler sequence is wrong");
741748
}
742749
else
743750
{
@@ -848,7 +855,8 @@ namespace pinocchio
848855
if (pt.get_child_optional("mujoco"))
849856
el = pt.get_child("mujoco");
850857
else
851-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "This is not a standard mujoco model. Cannot parse it.");
858+
PINOCCHIO_THROW_PRETTY(
859+
std::invalid_argument, "This is not a standard mujoco model. Cannot parse it.");
852860

853861
for (const ptree::value_type & v : el)
854862
{
@@ -859,7 +867,8 @@ namespace pinocchio
859867
if (n_s)
860868
modelName = *n_s;
861869
else
862-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Model is missing a name. Cannot parse it");
870+
PINOCCHIO_THROW_PRETTY(
871+
std::invalid_argument, "Model is missing a name. Cannot parse it");
863872
}
864873

865874
if (v.first == "compiler")
@@ -1019,7 +1028,8 @@ namespace pinocchio
10191028
for (const auto & joint : currentBody.jointChildren)
10201029
{
10211030
if (joint.jointType == "free")
1022-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Joint Composite trying to be created with a freeFlyer");
1031+
PINOCCHIO_THROW_PRETTY(
1032+
std::invalid_argument, "Joint Composite trying to be created with a freeFlyer");
10231033

10241034
SE3 jointInParent = bodyPose * joint.jointPlacement;
10251035
bodyInJoint = joint.jointPlacement.inverse();
@@ -1054,7 +1064,8 @@ namespace pinocchio
10541064
rangeCompo = rangeCompo.concatenate<1, 1>(joint.range);
10551065
}
10561066
else
1057-
PINOCCHIO_THROW_PRETTY(std::invalid_argument, "Unknown joint type trying to be parsed.");
1067+
PINOCCHIO_THROW_PRETTY(
1068+
std::invalid_argument, "Unknown joint type trying to be parsed.");
10581069

10591070
prevJointPlacement = jointInParent;
10601071
}

unittest/mjcf.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,9 @@ BOOST_AUTO_TEST_CASE(adding_site)
11201120
pinocchio::SE3 real_placement(rotation_matrix, Vector3(0.03, 0, -0.05));
11211121

11221122
BOOST_CHECK(model_m.frames[model_m.getFrameId("testSite")].placement.isApprox(real_placement));
1123-
BOOST_CHECK(model_m.frames[model_m.getFrameId("testSite")].parentJoint == model_m.frames[model_m.getFrameId("body3")].parentJoint);
1123+
BOOST_CHECK(
1124+
model_m.frames[model_m.getFrameId("testSite")].parentJoint
1125+
== model_m.frames[model_m.getFrameId("body3")].parentJoint);
11241126
}
11251127

11261128
/// @brief test that a fixed model is well parsed

0 commit comments

Comments
 (0)