Skip to content

Commit d59a58e

Browse files
[format] Apply clang
1 parent 471c933 commit d59a58e

File tree

6 files changed

+115
-144
lines changed

6 files changed

+115
-144
lines changed

include/sot/core/feature-pose.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ Vector6d convertVelocity(const MatrixHomogeneous &M,
168168
const MatrixHomogeneous &Mdes,
169169
const Vector &faNufafbDes);
170170

171-
template<> const std::string FeaturePose<SE3Representation>::CLASS_NAME;
172-
template<> const std::string FeaturePose<R3xSO3Representation>::CLASS_NAME;
171+
template <> const std::string FeaturePose<SE3Representation>::CLASS_NAME;
172+
template <> const std::string FeaturePose<R3xSO3Representation>::CLASS_NAME;
173173

174174
#if __cplusplus >= 201103L
175175
extern template class SOT_CORE_DLLAPI FeaturePose<SE3Representation>;

include/sot/core/parameter-server.hh

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,27 @@ public:
101101
/// @{
102102
template <typename Type>
103103
void setParameter(const std::string &ParameterName,
104-
const Type &ParameterValue)
105-
{
104+
const Type &ParameterValue) {
106105
if (!m_initSucceeded) {
107-
DYNAMIC_GRAPH_ENTITY_WARNING(*this) << "Cannot set parameter " <<
108-
ParameterName << " to " << ParameterValue
109-
<< " before initialization!\n";
106+
DYNAMIC_GRAPH_ENTITY_WARNING(*this)
107+
<< "Cannot set parameter " << ParameterName << " to "
108+
<< ParameterValue << " before initialization!\n";
110109
return;
111110
}
112111

113112
m_robot_util->set_parameter<Type>(ParameterName, ParameterValue);
114113
}
115114

116-
template <typename Type>
117-
Type getParameter(const std::string &ParameterName)
118-
{
115+
template <typename Type> Type getParameter(const std::string &ParameterName) {
119116

120117
if (!m_initSucceeded) {
121-
DYNAMIC_GRAPH_ENTITY_WARNING(*this) << "Cannot get parameter " <<
122-
ParameterName << " before initialization!\n";
118+
DYNAMIC_GRAPH_ENTITY_WARNING(*this)
119+
<< "Cannot get parameter " << ParameterName
120+
<< " before initialization!\n";
123121
Type ParameterValue;
124122
return ParameterValue;
125123
}
126124
return m_robot_util->get_parameter<Type>(ParameterName);
127-
128125
}
129126

130127
/// @}

include/sot/core/robot-utils.hh

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
/* --------------------------------------------------------------------- */
1414

1515
/** pinocchio is forcing the BOOST_MPL_LIMIT_VECTOR_SIZE to a specific value.
16-
This happen to be not working when including the boost property_tree library.
17-
For this reason if defined, the current value of BOOST_MPL_LIMIT_VECTOR_SIZE
18-
is saved in the preprocessor stack and unset.
16+
This happen to be not working when including the boost property_tree
17+
library. For this reason if defined, the current value of
18+
BOOST_MPL_LIMIT_VECTOR_SIZE is saved in the preprocessor stack and unset.
1919
Once the property_tree included the pinocchio value of this variable is
2020
restored.
2121
*/
@@ -54,20 +54,19 @@ class SOT_CORE_EXPORT ExtractJointMimics {
5454

5555
public:
5656
/// Constructor
57-
ExtractJointMimics(std::string & robot_model);
57+
ExtractJointMimics(std::string &robot_model);
5858

5959
/// Get mimic joints.
60-
const std::vector<std::string> &get_mimic_joints();
60+
const std::vector<std::string> &get_mimic_joints();
6161

6262
private:
63-
void go_through(boost::property_tree::ptree &pt,int level, int stage);
63+
void go_through(boost::property_tree::ptree &pt, int level, int stage);
6464

6565
// Create empty property tree object
6666
boost::property_tree::ptree tree_;
6767
std::vector<std::string> mimic_joints_;
6868
std::string current_joint_name_;
6969
void go_through_full();
70-
7170
};
7271

7372
struct SOT_CORE_EXPORT ForceLimits {
@@ -255,29 +254,21 @@ public:
255254
If parameter_name already exists the value is overwritten.
256255
If not it is inserted.
257256
*/
258-
template < typename Type>
257+
template <typename Type>
259258
void set_parameter(const std::string &parameter_name,
260-
const Type &parameter_value)
261-
{
262-
try
263-
{
259+
const Type &parameter_value) {
260+
try {
264261
typedef boost::property_tree::ptree::path_type path;
265-
path apath(parameter_name,'/');
266-
property_tree_.put<Type>(apath,parameter_value);
267-
}
268-
catch(const boost::property_tree::ptree_error &e)
269-
{
262+
path apath(parameter_name, '/');
263+
property_tree_.put<Type>(apath, parameter_value);
264+
} catch (const boost::property_tree::ptree_error &e) {
270265
std::ostringstream oss;
271266
oss << "Robot utils: parameter path is invalid " << '\n'
272-
<< " for set_parameter("
273-
<< parameter_name << ")\n"
267+
<< " for set_parameter(" << parameter_name << ")\n"
274268
<< e.what() << std::endl;
275-
sendMsg(oss.str(),
276-
MSG_TYPE_ERROR);
269+
sendMsg(oss.str(), MSG_TYPE_ERROR);
277270
return;
278-
279271
}
280-
281272
}
282273

283274
/** \brief Get a parameter of type string.
@@ -287,29 +278,24 @@ public:
287278
Return false if the parameter is not found.
288279
*/
289280
template <typename Type>
290-
Type get_parameter(const std::string &parameter_name)
291-
{
281+
Type get_parameter(const std::string &parameter_name) {
292282
try {
293-
boost::property_tree::ptree::path_type apath(parameter_name,'/');
294-
const Type & res= property_tree_.get<Type>(apath);
283+
boost::property_tree::ptree::path_type apath(parameter_name, '/');
284+
const Type &res = property_tree_.get<Type>(apath);
295285

296286
return res;
297-
}
298-
catch(const boost::property_tree::ptree_error &e)
299-
{
287+
} catch (const boost::property_tree::ptree_error &e) {
300288
std::ostringstream oss;
301289
oss << "Robot utils: parameter path is invalid " << '\n'
302-
<< " for get_parameter("
303-
<< parameter_name << ")\n"
290+
<< " for get_parameter(" << parameter_name << ")\n"
304291
<< e.what() << std::endl;
305-
sendMsg(oss.str(),
306-
MSG_TYPE_ERROR);
292+
sendMsg(oss.str(), MSG_TYPE_ERROR);
307293
}
308294
}
309295
/** @} */
310296

311297
/** Access to property tree directly */
312-
boost::property_tree::ptree & get_property_tree();
298+
boost::property_tree::ptree &get_property_tree();
313299

314300
protected:
315301
Logger logger_;

src/matrix/operator.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ struct HomogeneousMatrixToSE3Vector
326326
void operator()(const MatrixHomogeneous &M, dg::Vector &res) {
327327
res.resize(12);
328328
res.head<3>() = M.translation();
329-
res.segment(3, 3) = M.linear().row(0);
330-
res.segment(6, 3) = M.linear().row(1);
331-
res.segment(9, 3) = M.linear().row(2); }
329+
res.segment(3, 3) = M.linear().row(0);
330+
res.segment(6, 3) = M.linear().row(1);
331+
res.segment(9, 3) = M.linear().row(2);
332+
}
332333
};
333334
REGISTER_UNARY_OP(HomogeneousMatrixToSE3Vector, MatrixHomoToSE3Vector);
334335

@@ -617,9 +618,9 @@ operator()(const dynamicgraph::sot::MatrixHomogeneous &f,
617618
}
618619

619620
template <>
620-
void Multiplier_FxE__E<double, dynamicgraph::Vector>::
621-
operator()(const double &x, const dynamicgraph::Vector &v,
622-
dynamicgraph::Vector &res) const {
621+
void Multiplier_FxE__E<double, dynamicgraph::Vector>::operator()(
622+
const double &x, const dynamicgraph::Vector &v,
623+
dynamicgraph::Vector &res) const {
623624
res = v;
624625
res *= x;
625626
}
@@ -1099,9 +1100,9 @@ template <typename T> struct Multiplier : public VariadicOpHeader<T, T> {
10991100
};
11001101
template <> void Multiplier<double>::setIdentity(double &res) const { res = 1; }
11011102
template <>
1102-
void Multiplier<MatrixHomogeneous>::
1103-
operator()(const std::vector<const MatrixHomogeneous *> &vs,
1104-
MatrixHomogeneous &res) const {
1103+
void Multiplier<MatrixHomogeneous>::operator()(
1104+
const std::vector<const MatrixHomogeneous *> &vs,
1105+
MatrixHomogeneous &res) const {
11051106
if (vs.size() == 0)
11061107
setIdentity(res);
11071108
else {

src/tools/parameter-server.cpp

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616

1717
/** pinocchio is forcing the BOOST_MPL_LIMIT_VECTOR_SIZE to a specific value.
18-
This happen to be not working when including the boost property_tree library.
19-
For this reason if defined, the current value of BOOST_MPL_LIMIT_VECTOR_SIZE
20-
is saved in the preprocessor stack and unset.
18+
This happen to be not working when including the boost property_tree
19+
library. For this reason if defined, the current value of
20+
BOOST_MPL_LIMIT_VECTOR_SIZE is saved in the preprocessor stack and unset.
2121
Once the property_tree included the pinocchio value of this variable is
2222
restored.
2323
*/
@@ -145,20 +145,20 @@ ParameterServer::ParameterServer(const std::string &name)
145145
*this, &ParameterServer::displayRobotUtil,
146146
docCommandVoid0("Display the current robot util data set.")));
147147

148-
addCommand("setParameterBool",
149-
makeCommandVoid2(
150-
*this, &ParameterServer::setParameter<bool>,
151-
docCommandVoid2("Set a parameter named ParameterName to value "
152-
"ParameterValue (string format).",
153-
"(string) ParameterName",
154-
"(bool) ParameterValue")));
155-
addCommand("setParameterInt",
156-
makeCommandVoid2(
157-
*this, &ParameterServer::setParameter<int>,
158-
docCommandVoid2("Set a parameter named ParameterName to value "
159-
"ParameterValue (string format).",
160-
"(string) ParameterName",
161-
"(int) ParameterValue")));
148+
addCommand(
149+
"setParameterBool",
150+
makeCommandVoid2(
151+
*this, &ParameterServer::setParameter<bool>,
152+
docCommandVoid2("Set a parameter named ParameterName to value "
153+
"ParameterValue (string format).",
154+
"(string) ParameterName", "(bool) ParameterValue")));
155+
addCommand(
156+
"setParameterInt",
157+
makeCommandVoid2(
158+
*this, &ParameterServer::setParameter<int>,
159+
docCommandVoid2("Set a parameter named ParameterName to value "
160+
"ParameterValue (string format).",
161+
"(string) ParameterName", "(int) ParameterValue")));
162162
addCommand("setParameterDbl",
163163
makeCommandVoid2(
164164
*this, &ParameterServer::setParameter<double>,
@@ -175,39 +175,37 @@ ParameterServer::ParameterServer(const std::string &name)
175175
"(string) ParameterName",
176176
"(string) ParameterValue")));
177177

178-
addCommand("getParameter",
179-
makeCommandReturnType1(
180-
*this, &ParameterServer::getParameter<std::string>,
181-
docCommandReturnType1<std::string>(
182-
"Return the parameter value for parameter"
183-
" named ParameterName.",
184-
"(string) ParameterName")));
185-
186-
addCommand("getParameterInt",
187-
makeCommandReturnType1(
188-
*this, &ParameterServer::getParameter<int>,
189-
docCommandReturnType1<int>(
190-
"Return the parameter value for parameter"
191-
" named ParameterName.",
192-
"(int) ParameterName")));
193-
194-
addCommand("getParameterDbl",
195-
makeCommandReturnType1(
196-
*this, &ParameterServer::getParameter<double>,
197-
docCommandReturnType1<double>(
198-
"Return the parameter value for parameter"
199-
" named ParameterName.",
200-
"(double) ParameterName")));
201-
202-
addCommand("getParameterBool",
203-
makeCommandReturnType1(
204-
*this, &ParameterServer::getParameter<bool>,
205-
docCommandReturnType1<bool>(
206-
"Return the parameter value for parameter"
207-
" named ParameterName.",
208-
"(string) ParameterName")));
178+
addCommand(
179+
"getParameter",
180+
makeCommandReturnType1(*this, &ParameterServer::getParameter<std::string>,
181+
docCommandReturnType1<std::string>(
182+
"Return the parameter value for parameter"
183+
" named ParameterName.",
184+
"(string) ParameterName")));
209185

186+
addCommand(
187+
"getParameterInt",
188+
makeCommandReturnType1(
189+
*this, &ParameterServer::getParameter<int>,
190+
docCommandReturnType1<int>("Return the parameter value for parameter"
191+
" named ParameterName.",
192+
"(int) ParameterName")));
210193

194+
addCommand(
195+
"getParameterDbl",
196+
makeCommandReturnType1(*this, &ParameterServer::getParameter<double>,
197+
docCommandReturnType1<double>(
198+
"Return the parameter value for parameter"
199+
" named ParameterName.",
200+
"(double) ParameterName")));
201+
202+
addCommand(
203+
"getParameterBool",
204+
makeCommandReturnType1(
205+
*this, &ParameterServer::getParameter<bool>,
206+
docCommandReturnType1<bool>("Return the parameter value for parameter"
207+
" named ParameterName.",
208+
"(string) ParameterName")));
211209
}
212210

213211
void ParameterServer::init_simple(const double &dt) {
@@ -406,8 +404,6 @@ bool ParameterServer::isJointInRange(unsigned int id, double q) {
406404
return true;
407405
}
408406

409-
410-
411407
/* ------------------------------------------------------------------- */
412408
/* --- ENTITY -------------------------------------------------------- */
413409
/* ------------------------------------------------------------------- */

0 commit comments

Comments
 (0)