Skip to content

Commit 176a75d

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

File tree

11 files changed

+120
-153
lines changed

11 files changed

+120
-153
lines changed

include/sot/core/abstract-sot-external-interface.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SOT_CORE_EXPORT AbstractSotExternalInterface {
6161
virtual void setSecondOrderIntegration(void) = 0;
6262
virtual void setNoIntegration(void) = 0;
6363
// Set the number of joints that are controlled
64-
virtual void setControlSize(const int&) = 0;
64+
virtual void setControlSize(const int &) = 0;
6565
};
6666
} // namespace sot
6767
} // namespace dynamicgraph

include/sot/core/device.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class SOT_CORE_EXPORT Device : public Entity {
9292
virtual void setNoIntegration();
9393
virtual void setControlInputType(const std::string &cit);
9494
void getControl(std::map<std::string, ControlValues> &anglesOut,
95-
const double& period);
95+
const double &period);
9696

9797
/// \name Sanity check parameterization
9898
/// \{

include/sot/core/integrator.hh

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#include "sot/core/periodic-call.hh"
4040

4141
namespace dynamicgraph {
42-
namespace sot{
43-
namespace internal{
42+
namespace sot {
43+
namespace internal {
4444
class Signal : public ::dynamicgraph::Signal<Vector, int> {
4545
protected:
4646
enum SignalType { CONSTANT, REFERENCE, REFERENCE_NON_CONST, FUNCTION };
@@ -100,50 +100,48 @@ class Signal : public ::dynamicgraph::Signal<Vector, int> {
100100
virtual void getClassName(std::string &aClassName) const {
101101
aClassName = typeid(this).name();
102102
}
103-
104103
};
105104

106-
} // namespace internal
105+
} // namespace internal
107106
// Integrates a constant velocity for a given timestep
108107
//
109108
// Initial and final configurations as well as velocity follow pinocchio
110109
// standard
111110
// The timestep is the time elapsed since last computation of the output in
112111
// microseconds.
113-
class SOT_CORE_DLLEXPORT Integrator : public Entity
114-
{
115-
public:
112+
class SOT_CORE_DLLEXPORT Integrator : public Entity {
113+
public:
116114
// Time corresponding to incrementing signal velocity by 1
117115
static const double dt;
118116
static const std::string CLASS_NAME;
119117
virtual const std::string &getClassName(void) const { return CLASS_NAME; }
120-
Integrator(const std::string& name);
118+
Integrator(const std::string &name);
121119

122120
// Get pointer to the model
123-
::pinocchio::Model* getModel();
121+
::pinocchio::Model *getModel();
124122
// Set pointer to the model
125-
void setModel(::pinocchio::Model* model);
123+
void setModel(::pinocchio::Model *model);
126124
// Set Initial configuration
127-
void setInitialConfig(const Vector& initConfig);
125+
void setInitialConfig(const Vector &initConfig);
128126

129127
PeriodicCall &periodicCallBefore() { return periodicCallBefore_; }
130128
PeriodicCall &periodicCallAfter() { return periodicCallAfter_; }
131129

132-
private:
130+
private:
133131
PeriodicCall periodicCallBefore_;
134132
PeriodicCall periodicCallAfter_;
135133

136-
Vector& integrate(Vector& configuration, int time);
134+
Vector &integrate(Vector &configuration, int time);
137135
// Signals
138136
SignalPtr<Vector, int> velocitySIN_;
139137
internal::Signal configurationSOUT_;
140138
// Pointer to pinocchio model
141-
::pinocchio::Model* model_;
139+
::pinocchio::Model *model_;
142140
Vector configuration_;
143141
int lastComputationTime_;
144142
int recursivityLevel_;
145-
}; // class Integrator
143+
}; // class Integrator
146144

147-
} // namespace sot
148-
} // namespace dynamicgraph
149-
#endif //SOT_DYNAMIC_PINOCCHIO_INTEGRATOR_HH
145+
} // namespace sot
146+
} // namespace dynamicgraph
147+
#endif // SOT_DYNAMIC_PINOCCHIO_INTEGRATOR_HH

include/sot/core/segment.hh

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,24 @@
3838

3939
namespace dynamicgraph {
4040
namespace sot {
41-
class SOT_CORE_DLLAPI Segment : public Entity
42-
{
43-
public:
44-
static const std::string CLASS_NAME;
45-
virtual const std::string& getClassName() const { return CLASS_NAME; }
46-
// Set the range of input vector that is provided as output.
47-
void setRange(const int& i0, const int& length)
48-
{
49-
range_ = std::make_pair(i0, length);
50-
}
51-
52-
Segment(const std::string& name);
53-
private:
54-
Vector& compute(Vector& output, int time);
55-
SignalPtr<Vector, int> inputSIN_;
56-
SignalTimeDependent<Vector, int> outputSOUT_;
57-
// Range of the input vector that is provided as output
58-
std::pair<int,int> range_;
59-
}; // class Segment
60-
} // namespace sot
61-
} // namespace dynamicgraph
62-
#endif //SOT_CORE_SEGMENT_HH
41+
class SOT_CORE_DLLAPI Segment : public Entity {
42+
public:
43+
static const std::string CLASS_NAME;
44+
virtual const std::string& getClassName() const { return CLASS_NAME; }
45+
// Set the range of input vector that is provided as output.
46+
void setRange(const int& i0, const int& length) {
47+
range_ = std::make_pair(i0, length);
48+
}
49+
50+
Segment(const std::string& name);
51+
52+
private:
53+
Vector& compute(Vector& output, int time);
54+
SignalPtr<Vector, int> inputSIN_;
55+
SignalTimeDependent<Vector, int> outputSOUT_;
56+
// Range of the input vector that is provided as output
57+
std::pair<int, int> range_;
58+
}; // class Segment
59+
} // namespace sot
60+
} // namespace dynamicgraph
61+
#endif // SOT_CORE_SEGMENT_HH

src/control/admittance-control-op-point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void AdmittanceControlOpPoint::display(std::ostream &os) const {
200200
os << "AdmittanceControlOpPoint " << getName();
201201
try {
202202
getProfiler().report_all(3, os);
203-
} catch (const ExceptionSignal& e) {
203+
} catch (const ExceptionSignal &e) {
204204
}
205205
}
206206
} // namespace core

src/dynamic_graph/sot/core/meta_tasks_kine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from dynamic_graph.sot.core.meta_tasks import MetaTaskCom
22
from dynamic_graph.sot.core.task import Task
33

4+
45
class MetaTaskKineCom(MetaTaskCom):
56
def __init__(self, dyn, name="com"):
67
MetaTaskCom.__init__(self, dyn, name)

src/math/segment.cpp

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,28 @@
3636
namespace dynamicgraph {
3737
namespace sot {
3838

39-
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Segment, "Segment");
40-
41-
Segment::Segment(const std::string& name) :
42-
Entity(name),
43-
inputSIN_(0x0, "Segment(" + name + ")::input(vector)::in"),
44-
outputSOUT_(boost::bind(&Segment::compute, this, _1, _2), inputSIN_,
45-
"Segment(" + name + ")::out"),
46-
range_(std::make_pair(0, 0))
47-
{
48-
using dynamicgraph::command::makeCommandVoid2;
49-
signalRegistration(inputSIN_);
50-
signalRegistration(outputSOUT_);
51-
std::string docstring(
52-
"Set range of input vector to be provided as output\n"
53-
" - input: first index, length\n");
54-
addCommand("setRange", makeCommandVoid2(*this, &Segment::setRange,
55-
docstring));
56-
}
57-
58-
Vector& Segment::compute(Vector& output, int time)
59-
{
60-
const Vector& input(inputSIN_(time));
61-
output = input.segment(std::get<0>(range_), std::get<1>(range_));
62-
return output;
63-
}
64-
} // namespace sot
65-
} // namespace dynamicgraph
39+
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Segment, "Segment");
40+
41+
Segment::Segment(const std::string& name)
42+
: Entity(name),
43+
inputSIN_(0x0, "Segment(" + name + ")::input(vector)::in"),
44+
outputSOUT_(boost::bind(&Segment::compute, this, _1, _2), inputSIN_,
45+
"Segment(" + name + ")::out"),
46+
range_(std::make_pair(0, 0)) {
47+
using dynamicgraph::command::makeCommandVoid2;
48+
signalRegistration(inputSIN_);
49+
signalRegistration(outputSOUT_);
50+
std::string docstring(
51+
"Set range of input vector to be provided as output\n"
52+
" - input: first index, length\n");
53+
addCommand("setRange",
54+
makeCommandVoid2(*this, &Segment::setRange, docstring));
55+
}
56+
57+
Vector& Segment::compute(Vector& output, int time) {
58+
const Vector& input(inputSIN_(time));
59+
output = input.segment(std::get<0>(range_), std::get<1>(range_));
60+
return output;
61+
}
62+
} // namespace sot
63+
} // namespace dynamicgraph

src/python-module.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ BOOST_PYTHON_MODULE(wrap) {
5454
return os.str();
5555
});
5656

57-
dynamicgraph::python::exposeEntity<dgs::Device>()
58-
.def("getControlSize", &dgs::Device::getControlSize,
59-
"Get number of joints controlled by the device.");
57+
dynamicgraph::python::exposeEntity<dgs::Device>().def(
58+
"getControlSize", &dgs::Device::getControlSize,
59+
"Get number of joints controlled by the device.");
6060

6161
using dgs::Flags;
6262
bp::class_<Flags>("Flags", bp::init<>())
@@ -102,10 +102,12 @@ BOOST_PYTHON_MODULE(wrap) {
102102
dg::python::exposeSignalsOfType<Flags, int>("Flags");
103103
dg::python::exposeEntity<dgs::Integrator, bp::bases<dg::Entity>,
104104
dg::python::AddCommands>()
105-
.add_property("after", bp::make_function(
106-
&dgs::Integrator::periodicCallAfter, reference_existing_object()))
107-
.add_property("before", bp::make_function(
108-
&dgs::Integrator::periodicCallBefore, reference_existing_object()))
105+
.add_property("after",
106+
bp::make_function(&dgs::Integrator::periodicCallAfter,
107+
reference_existing_object()))
108+
.add_property("before",
109+
bp::make_function(&dgs::Integrator::periodicCallBefore,
110+
reference_existing_object()))
109111
.add_property("model",
110112
bp::make_function(&dgs::Integrator::getModel,
111113
reference_existing_object()),
@@ -114,8 +116,8 @@ BOOST_PYTHON_MODULE(wrap) {
114116
.def("setInitialConfig", &dgs::Integrator::setInitialConfig);
115117

116118
typedef dgs::internal::Signal S_t;
117-
bp::class_<S_t, bp::bases<dg::Signal<dg::Vector, int> >, boost::noncopyable> obj(
118-
"SignalIntegratorVector", bp::init<std::string>());
119+
bp::class_<S_t, bp::bases<dg::Signal<dg::Vector, int> >, boost::noncopyable>
120+
obj("SignalIntegratorVector", bp::init<std::string>());
119121
obj.add_property(
120122
"value",
121123
bp::make_function(&S_t::accessCopy,

src/tools/device.cpp

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ Device::Device(const std::string &n)
9797
pseudoTorqueSOUT("Device(" + n + ")::output(vector)::ptorque")
9898

9999
,
100-
lastTimeControlWasRead_(0), controlSize_(0),
100+
lastTimeControlWasRead_(0),
101+
controlSize_(0),
101102
forceZero6(6) {
102103
forceZero6.fill(0);
103104
/* --- SIGNALS --- */
@@ -222,24 +223,22 @@ Device::Device(const std::string &n)
222223
}
223224
}
224225

225-
void Device::getControl(map<string,ControlValues> &controlOut,
226-
const double& period)
227-
{
228-
sotDEBUGIN(25) ;
226+
void Device::getControl(map<string, ControlValues> &controlOut,
227+
const double &period) {
228+
sotDEBUGIN(25);
229229
std::vector<double> control;
230-
lastTimeControlWasRead_ += (int)floor(period/Integrator::dt);
230+
lastTimeControlWasRead_ += (int)floor(period / Integrator::dt);
231231

232232
Vector dgControl(controlSIN(lastTimeControlWasRead_));
233233
// Specify the joint values for the controller.
234234
control.resize(dgControl.size());
235235

236-
if (controlInputType_ == POSITION_CONTROL){
236+
if (controlInputType_ == POSITION_CONTROL) {
237237
CHECK_BOUNDS(dgControl, lowerPosition_, upperPosition_, "position", 1e-6);
238238
}
239-
for(unsigned int i=0; i < dgControl.size();++i)
240-
control[i] = dgControl[i];
239+
for (unsigned int i = 0; i < dgControl.size(); ++i) control[i] = dgControl[i];
241240
controlOut["control"].setValues(control);
242-
sotDEBUGOUT(25) ;
241+
sotDEBUGOUT(25);
243242
}
244243

245244
void Device::setStateSize(const unsigned int &size) {
@@ -257,23 +256,17 @@ void Device::setStateSize(const unsigned int &size) {
257256
ZMPPreviousControllerSOUT.setConstant(zmp);
258257
}
259258

260-
void Device::setControlSize(const int &size) {
261-
controlSize_ = size;
262-
}
259+
void Device::setControlSize(const int &size) { controlSize_ = size; }
263260

264-
int Device::getControlSize() const
265-
{
266-
return controlSize_;
267-
}
261+
int Device::getControlSize() const { return controlSize_; }
268262

269263
void Device::setVelocitySize(const unsigned int &size) {
270264
velocity_.resize(size);
271265
velocity_.fill(.0);
272266
velocitySOUT.setConstant(velocity_);
273267
}
274268

275-
void Device::setState(const Vector &st) {
276-
}
269+
void Device::setState(const Vector &st) {}
277270

278271
void Device::setVelocity(const Vector &vel) {
279272
velocity_ = vel;
@@ -293,17 +286,13 @@ void Device::setRoot(const MatrixHomogeneous &worldMwaist) {
293286
for (unsigned int i = 0; i < 3; ++i) q(i + 3) = r(i);
294287
}
295288

296-
void Device::setSecondOrderIntegration() {
297-
}
289+
void Device::setSecondOrderIntegration() {}
298290

299-
void Device::setNoIntegration() {
300-
}
291+
void Device::setNoIntegration() {}
301292

302-
void Device::setControlInputType(const std::string &cit) {
303-
}
293+
void Device::setControlInputType(const std::string &cit) {}
304294

305-
void Device::setSanityCheck(const bool &enableCheck) {
306-
}
295+
void Device::setSanityCheck(const bool &enableCheck) {}
307296

308297
void Device::setPositionBounds(const Vector &lower, const Vector &upper) {
309298
std::ostringstream oss;
@@ -354,7 +343,6 @@ void Device::setTorqueBounds(const Vector &lower, const Vector &upper) {
354343
upperTorque_ = upper;
355344
}
356345

357-
358346
/* --- DISPLAY ------------------------------------------------------------ */
359347

360348
void Device::display(std::ostream &os) const {

0 commit comments

Comments
 (0)