Skip to content

Commit ca4145d

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

File tree

3 files changed

+65
-26
lines changed

3 files changed

+65
-26
lines changed

src/pyhpp/core/problem.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@
3131
#include "pyhpp/core/problem.hh"
3232

3333
#include <boost/python.hpp>
34+
#include <hpp/core/collision-validation.hh>
3435
#include <hpp/core/config-validations.hh>
3536
#include <hpp/core/configuration-shooter.hh>
3637
#include <hpp/core/distance.hh>
38+
#include <hpp/core/joint-bound-validation.hh>
3739
#include <hpp/core/path-projector.hh>
3840
#include <hpp/core/path-validation.hh>
3941
#include <hpp/core/problem-target.hh>
4042
#include <hpp/core/problem.hh>
41-
#include <hpp/core/collision-validation.hh>
42-
#include <hpp/core/joint-bound-validation.hh>
43-
4443
#include <hpp/core/steering-method.hh>
4544
#include <pyhpp/core/steering-method.hh>
4645
namespace pyhpp {
@@ -67,7 +66,6 @@ void Problem::setParameterInt(const std::string& name, size_type value) {
6766
obj->setParameter(name, param);
6867
}
6968

70-
7169
void Problem::addConfigValidation(const std::string& type) {
7270
hpp::core::ConfigValidationPtr_t validation;
7371
if (type == "CollisionValidation")
@@ -77,9 +75,7 @@ void Problem::addConfigValidation(const std::string& type) {
7775
obj->addConfigValidation(validation);
7876
}
7977

80-
void Problem::clearConfigValidations() {
81-
obj->clearConfigValidations();
82-
}
78+
void Problem::clearConfigValidations() { obj->clearConfigValidations(); }
8379

8480
const Parameter& Problem::getParameter(const std::string& name) const {
8581
return obj->getParameter(name);
@@ -142,9 +138,7 @@ void Problem::addGoalConfig(ConfigurationIn_t config) {
142138
obj->addGoalConfig(config);
143139
}
144140

145-
void Problem::resetGoalConfigs() {
146-
obj->resetGoalConfigs();
147-
}
141+
void Problem::resetGoalConfigs() { obj->resetGoalConfigs(); }
148142

149143
typedef PyWSteeringMethodPtr_t (Problem::*GetSteeringMethod)() const;
150144
typedef void (Problem::*SetSteeringMethod)(const PyWSteeringMethodPtr_t&);

src/pyhpp/pinocchio/device.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include <hpp/pinocchio/device-data.hh>
3434
#include <hpp/pinocchio/device.hh>
3535
#include <hpp/pinocchio/frame.hh>
36-
#include <hpp/pinocchio/joint.hh>
3736
#include <hpp/pinocchio/gripper.hh>
37+
#include <hpp/pinocchio/joint.hh>
3838
#include <hpp/pinocchio/liegroup-space.hh>
3939
#include <pinocchio/multibody/data.hpp>
4040
#include <pinocchio/multibody/geometry.hpp>
@@ -95,7 +95,7 @@ typedef hpp::pinocchio::Frame Frame;
9595
typedef hpp::pinocchio::JointPtr_t JointPtr_t;
9696

9797
static void setJointBounds(Device& device, const char* jointName,
98-
boost::python::list py_jointBounds) {
98+
boost::python::list py_jointBounds) {
9999
Frame frame = device.getFrameByName(jointName);
100100
JointPtr_t joint = frame.joint();
101101
auto jointBounds = extract_vector<value_type>(py_jointBounds);
@@ -178,7 +178,6 @@ void exposeDevice() {
178178
&Device::computeFramesForwardKinematics)
179179
.def("updateGeometryPlacements", &Device::updateGeometryPlacements)
180180
.def("setJointBounds", &setJointBounds);
181-
182181
}
183182
} // namespace pinocchio
184183
} // namespace pyhpp

tests/benchmarks/ur3-spheres-spf.py

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
from argparse import ArgumentParser
1212

1313
from pyhpp.manipulation.constraint_graph_factory import ConstraintGraphFactory
14-
from pyhpp.manipulation import Device, Graph, Problem, createProgressiveProjector, urdf, StatesPathFinder
14+
from pyhpp.manipulation import (
15+
Device,
16+
Graph,
17+
Problem,
18+
createProgressiveProjector,
19+
urdf,
20+
StatesPathFinder,
21+
)
1522
from pyhpp.core import createDichotomy, Straight
1623

1724
from pyhpp.constraints import (
@@ -24,7 +31,7 @@
2431
from pinocchio import SE3, Quaternion
2532

2633
parser = ArgumentParser()
27-
parser.add_argument('-N', default=20, type=int)
34+
parser.add_argument("-N", default=20, type=int)
2835
args = parser.parse_args()
2936

3037
# Robot and environment file paths
@@ -50,8 +57,13 @@
5057

5158
# Load ground
5259
urdf.loadModel(
53-
robot, 0, "ground", "anchor", ground_urdf, ground_srdf,
54-
SE3(rotation=np.identity(3), translation=np.array([0, 0, 0]))
60+
robot,
61+
0,
62+
"ground",
63+
"anchor",
64+
ground_urdf,
65+
ground_srdf,
66+
SE3(rotation=np.identity(3), translation=np.array([0, 0, 0])),
5567
)
5668

5769
# Load spheres to be manipulated
@@ -111,7 +123,7 @@
111123
o = objects[i]
112124
h = robot.handles()[o + "/handle"]
113125
h.mask = [True, True, True, False, True, True]
114-
126+
115127
# placement constraint
116128
placementName = "place_sphere{0}".format(i)
117129
Id = SE3.Identity()
@@ -135,7 +147,7 @@
135147
implicit_mask = [True, True, True]
136148
implicitPlacementConstraint = Implicit.create(pc, cts, implicit_mask)
137149
constraints[placementName] = implicitPlacementConstraint
138-
150+
139151
# placement complement constraint
140152
pc = Transformation.create(
141153
placementName + "/complement",
@@ -200,14 +212,48 @@
200212
constraints[preplacementName] = implicitPrePlacementConstraint
201213

202214
q_init = [
203-
pi / 6, -pi / 2, pi / 2, 0, 0, 0,
204-
0.2, 0, 0.02, 0, 0, 0, 1,
205-
0.3, 0, 0.02, 0, 0, 0, 1,
215+
pi / 6,
216+
-pi / 2,
217+
pi / 2,
218+
0,
219+
0,
220+
0,
221+
0.2,
222+
0,
223+
0.02,
224+
0,
225+
0,
226+
0,
227+
1,
228+
0.3,
229+
0,
230+
0.02,
231+
0,
232+
0,
233+
0,
234+
1,
206235
]
207236
q_goal = [
208-
pi / 6, -pi / 2, pi / 2, 0, 0, 0,
209-
0.3, 0, 0.02, 0, 0, 0, 1,
210-
0.2, 0, 0.02, 0, 0, 0, 1,
237+
pi / 6,
238+
-pi / 2,
239+
pi / 2,
240+
0,
241+
0,
242+
0,
243+
0.3,
244+
0,
245+
0.02,
246+
0,
247+
0,
248+
0,
249+
1,
250+
0.2,
251+
0,
252+
0.02,
253+
0,
254+
0,
255+
0,
256+
1,
211257
]
212258

213259
factory = ConstraintGraphFactory(cg, constraints)
@@ -285,4 +331,4 @@
285331
print(f"Success rate: {success / args.N * 100}%")
286332
if success > 0:
287333
print(f"Average time per success: {totalTime.total_seconds() / success}")
288-
print(f"Average number nodes per success: {totalNumberNodes / success}")
334+
print(f"Average number nodes per success: {totalNumberNodes / success}")

0 commit comments

Comments
 (0)