Skip to content

Commit cbf7693

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

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

src/obstacle.impl.cc

+30-22
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
#include <coal/BVH/BVH_model.h>
3737
#include <coal/mesh_loader/loader.h>
38-
#include <coal/shape/geometric_shapes.h>
3938
#include <coal/octree.h>
39+
#include <coal/shape/geometric_shapes.h>
4040

4141
#include <hpp/corbaserver/server-plugin.hh>
4242
#include <hpp/pinocchio/collision-object.hh>
@@ -88,26 +88,28 @@ void Obstacle::loadPointCloudFromFilename(const char* objectName,
8888
try {
8989
core::ProblemSolverPtr_t ps = problemSolver();
9090
pinocchio::GeomModelPtr_t gm = ps->obstacleGeomModel();
91-
91+
9292
if (gm->existGeometryName(objectName)) {
9393
// check that the existing geometry is of type coal::OcTree
9494
::pinocchio::GeomIndex id = gm->getGeometryId(objectName);
9595
coal::shared_ptr<coal::OcTree> octree =
96-
coal::dynamic_pointer_cast<coal::OcTree>
97-
(gm->geometryObjects[id].geometry);
96+
coal::dynamic_pointer_cast<coal::OcTree>(
97+
gm->geometryObjects[id].geometry);
9898
if (!octree) {
99-
HPP_THROW(Error, "Obstacle " << objectName << " exists but is not of the correct type.");
99+
HPP_THROW(Error, "Obstacle "
100+
<< objectName
101+
<< " exists but is not of the correct type.");
100102
}
101-
std::shared_ptr<octomap::OcTree> tree = std::const_pointer_cast<octomap::OcTree>(octree->getTree());
103+
std::shared_ptr<octomap::OcTree> tree =
104+
std::const_pointer_cast<octomap::OcTree>(octree->getTree());
102105
// Update octree
103106
tree->clear();
104107
tree->readBinary(filename);
105108
octree->computeLocalAABB();
106109
} else {
107110
std::shared_ptr<octomap::OcTree> octree(new octomap::OcTree(filename));
108-
coal::CollisionObject colobj (
109-
coal::CollisionGeometryPtr_t(new coal::OcTree(octree))
110-
);
111+
coal::CollisionObject colobj(
112+
coal::CollisionGeometryPtr_t(new coal::OcTree(octree)));
111113
ps->addObstacle(objectName, colobj, true, true);
112114
}
113115

@@ -117,7 +119,7 @@ void Obstacle::loadPointCloudFromFilename(const char* objectName,
117119
}
118120

119121
void Obstacle::loadPointCloudFromPoints(const char* objectName,
120-
const CORBA::Double resolution,
122+
const CORBA::Double resolution,
121123
const floatSeqSeq& points) {
122124
auto N = points.length();
123125
if (N > 0 && points[0].length() != 3) {
@@ -126,32 +128,38 @@ void Obstacle::loadPointCloudFromPoints(const char* objectName,
126128
try {
127129
core::ProblemSolverPtr_t ps = problemSolver();
128130
pinocchio::GeomModelPtr_t gm = ps->obstacleGeomModel();
129-
131+
130132
coal::shared_ptr<coal::OcTree> octree;
131133
std::shared_ptr<octomap::OcTree> tree;
132134
if (gm->existGeometryName(objectName)) {
133135
// check that the existing geometry is of type coal::OcTree
134136
::pinocchio::GeomIndex id = gm->getGeometryId(objectName);
135-
octree = coal::dynamic_pointer_cast<coal::OcTree> (gm->geometryObjects[id].geometry);
137+
octree = coal::dynamic_pointer_cast<coal::OcTree>(
138+
gm->geometryObjects[id].geometry);
136139
if (!octree) {
137-
HPP_THROW(Error, "Obstacle " << objectName << " exists but is not of the correct type.");
140+
HPP_THROW(Error, "Obstacle "
141+
<< objectName
142+
<< " exists but is not of the correct type.");
138143
}
139144
tree = std::const_pointer_cast<octomap::OcTree>(octree->getTree());
140145
if (tree->getResolution() != resolution) {
141-
HPP_THROW(Error, "A point cloud with name " << objectName <<
142-
" exists with resolution " << tree->getResolution() <<
143-
", which is different from the asked resolution (" << resolution
144-
<< ").\nYou can either remove the obstacle or stick the existing "
145-
"resolution."
146-
);
146+
HPP_THROW(Error,
147+
"A point cloud with name "
148+
<< objectName << " exists with resolution "
149+
<< tree->getResolution()
150+
<< ", which is different from the asked resolution ("
151+
<< resolution
152+
<< ").\nYou can either remove the obstacle or stick the "
153+
"existing "
154+
"resolution.");
147155
}
148156
tree->clear();
149157
} else {
150158
tree = std::make_shared<octomap::OcTree>(resolution);
151159
octree = std::make_shared<coal::OcTree>(tree);
152-
coal::CollisionObject colobj (
153-
octree,
154-
false // Dont compute the local AABB as the octree is not ready yet.
160+
coal::CollisionObject colobj(
161+
octree,
162+
false // Dont compute the local AABB as the octree is not ready yet.
155163
);
156164
ps->addObstacle(objectName, colobj, true, true);
157165
}

0 commit comments

Comments
 (0)