Skip to content

Commit 08dffc3

Browse files
committed
Update clang-format style; add reformat bash script
1 parent 732854d commit 08dffc3

File tree

24 files changed

+193
-171
lines changed

24 files changed

+193
-171
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ AllowShortBlocksOnASingleLine: true
3636
BreakBeforeBraces: Allman
3737
#BreakBeforeTernaryOperators: true
3838
#BreakConstructorInitializersBeforeComma: false
39-
ColumnLimit: 80
39+
ColumnLimit: 100
4040
#CommentPragmas: ''
4141
#ConstructorInitializerAllOnOneLineOrOnePerLine: true
4242
#ConstructorInitializerIndentWidth: 4

mola_imu_preintegration/tests/test-imu-rotation-integrator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ static void test_rotation_integration()
5555
// gtPose).norm(),1e-6);
5656

5757
// Initial state:
58-
auto lambdaAssertInitialState = [&ri]() {
58+
auto lambdaAssertInitialState = [&ri]()
59+
{
5960
const auto& s = ri.current_integration_state();
6061
ASSERT_LT_(
6162
(s.deltaRij_ - mrpt::math::CMatrixDouble33::Identity()).norm(),

mola_input_euroc_dataset/src/EurocDataset.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,17 @@ void EurocDataset::spinOnce()
290290

291291
std::visit(
292292
overloaded{
293-
[&](std::monostate&) {
294-
THROW_EXCEPTION("Un-initialized entry!");
295-
},
296-
[&](SensorCamera& cam) {
293+
[&](std::monostate&)
294+
{ THROW_EXCEPTION("Un-initialized entry!"); },
295+
[&](SensorCamera& cam)
296+
{
297297
build_dataset_entry_obs(cam);
298298
cam.obs->timestamp = obs_tim;
299299
this->sendObservationsToFrontEnds(cam.obs);
300300
cam.obs.reset(); // free mem
301301
},
302-
[&](SensorIMU& imu) {
302+
[&](SensorIMU& imu)
303+
{
303304
build_dataset_entry_obs(imu);
304305
imu.obs->timestamp = obs_tim;
305306
this->sendObservationsToFrontEnds(imu.obs);
@@ -330,9 +331,8 @@ void EurocDataset::spinOnce()
330331
//
331332
std::visit(
332333
overloaded{
333-
[&](std::monostate&) {
334-
THROW_EXCEPTION("Un-initialized entry!");
335-
},
334+
[&](std::monostate&)
335+
{ THROW_EXCEPTION("Un-initialized entry!"); },
336336
[&](SensorCamera& cam) { build_dataset_entry_obs(cam); },
337337
[&](SensorIMU& imu) { build_dataset_entry_obs(imu); }},
338338
peeker->second);

mola_input_mulran_dataset/src/MulranDataset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void MulranDataset::load_lidar(timestep_t step) const
468468
// Pose:
469469
obs->sensorPose = ousterPoseOnVehicle_;
470470
obs->timestamp = mrpt::Clock::fromDouble(
471-
LidarFileNameToTimestamp(lstPointCloudFiles_[step]));
471+
LidarFileNameToTimestamp(lstPointCloudFiles_[step]));
472472

473473
#if 0 // Export clouds to txt for debugging externally (e.g. python, matlab)
474474
pts->saveXYZIRT_to_text_file(

mola_input_paris_luco_dataset/src/ParisLucoDataset.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ void ParisLucoDataset::load_lidar(timestep_t step) const
274274
const float earliestTime = *std::min_element(Ts->cbegin(), Ts->cend());
275275
const float shiftTime = -earliestTime - 0.5 * lidarPeriod_;
276276

277-
std::transform(Ts->cbegin(), Ts->cend(), Ts->begin(), [=](double t) {
278-
return t + shiftTime;
279-
});
277+
std::transform(
278+
Ts->cbegin(), Ts->cend(), Ts->begin(),
279+
[=](double t) { return t + shiftTime; });
280280

281281
// Fix missing RING_ID: ParisLuco does not have a RING_ID field,
282282
// but we can generate it from the timestamps + pitch angle:

mola_input_rawlog/src/RawlogDataset.cpp

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,23 @@ void RawlogDataset::doReadAheadFromFile()
202202
std::dynamic_pointer_cast<mrpt::obs::CSensoryFrame>(
203203
obj);
204204
sf)
205-
{
206-
for (const auto& o : *sf)
207-
read_ahead_.emplace(o->getTimeStamp(), o);
208-
}
209-
else if (auto acts = std::dynamic_pointer_cast<
210-
mrpt::obs::CActionCollection>(obj);
211-
acts)
212-
{
213-
// odometry actions: ignore
214-
}
215-
else
216-
THROW_EXCEPTION_FMT(
217-
"Rawlog file can contain classes: "
218-
"CObservation|CSensoryFrame|CActionCollection, but class "
219-
"'%s' found.",
220-
obj->GetRuntimeClass()->className);
205+
{
206+
for (const auto& o : *sf)
207+
read_ahead_.emplace(o->getTimeStamp(), o);
208+
}
209+
else if (auto acts = std::dynamic_pointer_cast<
210+
mrpt::obs::CActionCollection>(obj);
211+
acts)
212+
{
213+
// odometry actions: ignore
214+
}
215+
else
216+
THROW_EXCEPTION_FMT(
217+
"Rawlog file can contain classes: "
218+
"CObservation|CSensoryFrame|CActionCollection, but "
219+
"class "
220+
"'%s' found.",
221+
obj->GetRuntimeClass()->className);
221222
}
222223
catch (const mrpt::serialization::CExceptionEOF&)
223224
{
@@ -247,22 +248,22 @@ void RawlogDataset::doReadAheadFromEntireRawlog()
247248
if (auto sf =
248249
std::dynamic_pointer_cast<mrpt::obs::CSensoryFrame>(obj);
249250
sf)
250-
{
251-
for (const auto& o : *sf) read_ahead_.emplace(o->getTimeStamp(), o);
252-
}
253-
else if (auto acts =
254-
std::dynamic_pointer_cast<mrpt::obs::CActionCollection>(
255-
obj);
256-
acts)
257-
{
258-
// odometry actions: ignore
259-
}
260-
else
261-
THROW_EXCEPTION_FMT(
262-
"Rawlog file can contain classes: "
263-
"CObservation|CSensoryFrame|CActionCollection, but class "
264-
"'%s' found.",
265-
obj->GetRuntimeClass()->className);
251+
{
252+
for (const auto& o : *sf)
253+
read_ahead_.emplace(o->getTimeStamp(), o);
254+
}
255+
else if (auto acts = std::dynamic_pointer_cast<
256+
mrpt::obs::CActionCollection>(obj);
257+
acts)
258+
{
259+
// odometry actions: ignore
260+
}
261+
else
262+
THROW_EXCEPTION_FMT(
263+
"Rawlog file can contain classes: "
264+
"CObservation|CSensoryFrame|CActionCollection, but class "
265+
"'%s' found.",
266+
obj->GetRuntimeClass()->className);
266267
}
267268
}
268269

@@ -331,17 +332,18 @@ mrpt::obs::CSensoryFrame::Ptr RawlogDataset::datasetGetObservations(
331332
else //
332333
if (auto sf = std::dynamic_pointer_cast<mrpt::obs::CSensoryFrame>(obj);
333334
sf)
334-
{
335-
sfRet = sf;
335+
{
336+
sfRet = sf;
336337

337-
for (auto& o : *sf) unload_queue_.emplace(o->getTimeStamp(), o);
338-
}
339-
else if (auto acts =
340-
std::dynamic_pointer_cast<mrpt::obs::CActionCollection>(obj);
341-
acts)
342-
{
343-
// odometry actions: ignore
344-
}
338+
for (auto& o : *sf) unload_queue_.emplace(o->getTimeStamp(), o);
339+
}
340+
else if (auto acts =
341+
std::dynamic_pointer_cast<mrpt::obs::CActionCollection>(
342+
obj);
343+
acts)
344+
{
345+
// odometry actions: ignore
346+
}
345347

346348
return sfRet;
347349
}

mola_kernel/src/Entity.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ EntityBase& mola::entity_get_base(Entity& e)
2121
std::visit(
2222
overloaded{
2323
[&ret](EntityBase& b) { ret = &b; },
24-
[&ret](EntityOther& o) {
24+
[&ret](EntityOther& o)
25+
{
2526
ASSERT_(o);
2627
ret = o.get();
2728
},
@@ -39,7 +40,8 @@ const EntityBase& mola::entity_get_base(const Entity& e)
3940
std::visit(
4041
overloaded{
4142
[&ret](const EntityBase& b) { ret = &b; },
42-
[&ret](const EntityOther& o) {
43+
[&ret](const EntityOther& o)
44+
{
4345
ASSERT_(o);
4446
ret = o.get();
4547
},
@@ -56,15 +58,17 @@ void mola::entity_update_pose(mola::Entity& e, const mrpt::math::TPose3D& p)
5658

5759
std::visit(
5860
overloaded{
59-
[&](RefPose3&) {
61+
[&](RefPose3&)
62+
{
6063
ASSERTMSG_(
6164
p == mrpt::math::TPose3D::Identity(),
6265
"RefPose3 cannot be assigned a pose != Identity()");
6366
},
6467
[&](RelDynPose3KF& ee) { ee.relpose_value = p; },
6568
[&](RelPose3& ee) { ee.relpose_value = p; },
6669
[&](RelPose3KF& ee) { ee.relpose_value = p; },
67-
[]([[maybe_unused]] auto ee) {
70+
[]([[maybe_unused]] auto ee)
71+
{
6872
throw std::runtime_error(
6973
mrpt::format("[updateEntityPose] Unknown Entity type!"));
7074
},
@@ -86,14 +90,16 @@ void mola::entity_update_vel(mola::Entity& e, const std::array<double, 3>& v)
8690
"RefPose3 cannot be assigned a velocity!=0");
8791
#endif
8892
},
89-
[&](RelDynPose3KF& ee) {
93+
[&](RelDynPose3KF& ee)
94+
{
9095
ee.twist_value.vx = v[0];
9196
ee.twist_value.vy = v[1];
9297
ee.twist_value.vz = v[2];
9398
},
9499
[&](RelPose3&) {},
95100
[&](RelPose3KF&) {},
96-
[]([[maybe_unused]] auto ee) {
101+
[]([[maybe_unused]] auto ee)
102+
{
97103
throw std::runtime_error(
98104
mrpt::format("[updateEntityPose] Unknown Entity type!"));
99105
},
@@ -113,7 +119,8 @@ mrpt::math::TTwist3D mola::entity_get_twist(const mola::Entity& e)
113119
[&](const RelDynPose3KF& ee) { ret = ee.twist_value; },
114120
[&](const RelPose3&) {},
115121
[&](const RelPose3KF&) {},
116-
[]([[maybe_unused]] auto ee) {
122+
[]([[maybe_unused]] auto ee)
123+
{
117124
throw std::runtime_error(
118125
mrpt::format("[updateEntityPose] Unknown Entity type!"));
119126
},
@@ -134,7 +141,8 @@ mrpt::math::TPose3D mola::entity_get_pose(const mola::Entity& e)
134141
[&](const RelDynPose3KF& ee) { ret = ee.relpose_value; },
135142
[&](const RelPose3& ee) { ret = ee.relpose_value; },
136143
[&](const RelPose3KF& ee) { ret = ee.relpose_value; },
137-
[]([[maybe_unused]] auto ee) {
144+
[]([[maybe_unused]] auto ee)
145+
{
138146
throw std::runtime_error(
139147
mrpt::format("[getEntityPose] Unknown Entity type!"));
140148
},
@@ -154,7 +162,8 @@ mrpt::Clock::time_point mola::entity_get_timestamp(const mola::Entity& e)
154162
overloaded{
155163
[&](const EntityBase& ee) { ret = ee.timestamp_; },
156164
[&](const EntityOther& ee) { ret = ee->timestamp_; },
157-
[](std::monostate) {
165+
[](std::monostate)
166+
{
158167
throw std::runtime_error(
159168
mrpt::format("[getEntityTimeStamp] Unknown Entity type!"));
160169
},

mola_kernel/src/Factor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ FactorBase& mola::factor_get_base(Factor& f)
2121
std::visit(
2222
overloaded{
2323
[&ret](FactorBase& b) { ret = &b; },
24-
[&ret](FactorOther& o) {
24+
[&ret](FactorOther& o)
25+
{
2526
ASSERT_(o);
2627
ret = o.get();
2728
},
@@ -39,7 +40,8 @@ const FactorBase& mola::factor_get_base(const Factor& f)
3940
std::visit(
4041
overloaded{
4142
[&ret](const FactorBase& b) { ret = &b; },
42-
[&ret](const FactorOther& o) {
43+
[&ret](const FactorOther& o)
44+
{
4345
ASSERT_(o);
4446
ret = o.get();
4547
},

mola_kernel/src/factors/FactorConstVelKinematics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mola::id_t FactorConstVelKinematics::edge_indices(const std::size_t i) const
3434
// Implementation of the CSerializable virtual interface:
3535
uint8_t FactorConstVelKinematics::serializeGetVersion() const { return 0; }
3636
void FactorConstVelKinematics::serializeTo(
37-
mrpt::serialization::CArchive& out) const
37+
mrpt::serialization::CArchive& out) const
3838
{
3939
baseSerializeTo(out);
4040
out << from_kf_ << to_kf_ << deltaTime_;

mola_kernel/src/factors/FactorStereoProjectionPose.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mola::id_t FactorStereoProjectionPose::edge_indices(const std::size_t i) const
2929
// Implementation of the CSerializable virtual interface:
3030
uint8_t FactorStereoProjectionPose::serializeGetVersion() const { return 0; }
3131
void FactorStereoProjectionPose::serializeTo(
32-
mrpt::serialization::CArchive& out) const
32+
mrpt::serialization::CArchive& out) const
3333
{
3434
baseSerializeTo(out);
3535
out << sigma_xleft_ << sigma_xright_ << sigma_y_ << observation_.x_left

0 commit comments

Comments
 (0)