Skip to content

Commit ded85a1

Browse files
authored
Specify clang-format option to always use left pointer alignment (UBC-Thunderbots#3678)
* Specify clang-format option to always use left pointer alignment * Formatting
1 parent dbb6bc3 commit ded85a1

235 files changed

Lines changed: 1675 additions & 1674 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ BreakBeforeBraces: Allman
1515
BreakStringLiterals: 'false'
1616
ColumnLimit: '90'
1717
Cpp11BracedListStyle: 'true'
18+
DerivePointerAlignment: 'false'
1819
IncludeBlocks: Regroup
1920
IndentCaseLabels: 'true'
2021
IndentWidth: '4'

src/extlibs/er_force_sim/src/amun/simulator/simball.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ void SimBall::begin(bool robot_collision)
225225

226226
// samples a plane rotated towards the camera, sets p to the average position of
227227
// the visible points and returns the relative amount of visible pixels
228-
static float positionOfVisiblePixels(btVector3 &p, const btVector3 &simulatorBallPosition,
229-
const btVector3 &simulatorCameraPosition,
230-
const btCollisionWorld *const m_world)
228+
static float positionOfVisiblePixels(btVector3& p, const btVector3& simulatorBallPosition,
229+
const btVector3& simulatorCameraPosition,
230+
const btCollisionWorld* const m_world)
231231
{
232232
const float simulatorBallRadius =
233233
static_cast<float>(BALL_MAX_RADIUS_METERS) * SIMULATOR_SCALE;
@@ -299,8 +299,8 @@ static float positionOfVisiblePixels(btVector3 &p, const btVector3 &simulatorBal
299299
return static_cast<float>(cameraHitCounter) / static_cast<float>(maxHits);
300300
}
301301

302-
bool SimBall::update(SSLProto::SSL_DetectionBall &ball, float stddev, float stddevArea,
303-
const btVector3 &cameraPosition, bool enableInvisibleBall,
302+
bool SimBall::update(SSLProto::SSL_DetectionBall& ball, float stddev, float stddevArea,
303+
const btVector3& cameraPosition, bool enableInvisibleBall,
304304
float visibilityThreshold, btVector3 positionOffset)
305305
{
306306
btTransform transform;
@@ -311,8 +311,8 @@ bool SimBall::update(SSLProto::SSL_DetectionBall &ball, float stddev, float stdd
311311
enableInvisibleBall, visibilityThreshold, positionOffset);
312312
}
313313

314-
bool SimBall::addDetection(SSLProto::SSL_DetectionBall &ball, btVector3 pos, float stddev,
315-
float stddevArea, const btVector3 &cameraPosition,
314+
bool SimBall::addDetection(SSLProto::SSL_DetectionBall& ball, btVector3 pos, float stddev,
315+
float stddevArea, const btVector3& cameraPosition,
316316
bool enableInvisibleBall, float visibilityThreshold,
317317
btVector3 positionOffset)
318318
{
@@ -382,7 +382,7 @@ bool SimBall::addDetection(SSLProto::SSL_DetectionBall &ball, btVector3 pos, flo
382382
return true;
383383
}
384384

385-
void SimBall::move(const sslsim::TeleportBall &ball)
385+
void SimBall::move(const sslsim::TeleportBall& ball)
386386
{
387387
m_move = ball;
388388
}
@@ -398,7 +398,7 @@ btVector3 SimBall::speed() const
398398
return m_body->getLinearVelocity();
399399
}
400400

401-
void SimBall::writeBallState(world::SimBall &ball) const
401+
void SimBall::writeBallState(world::SimBall& ball) const
402402
{
403403
const btVector3 ballPosition =
404404
m_body->getWorldTransform().getOrigin() / SIMULATOR_SCALE;
@@ -415,7 +415,7 @@ void SimBall::writeBallState(world::SimBall &ball) const
415415
ball.set_angular_z(angularVelocity.z());
416416
}
417417

418-
void SimBall::restoreState(const world::SimBall &ball)
418+
void SimBall::restoreState(const world::SimBall& ball)
419419
{
420420
btVector3 position(ball.p_x(), ball.p_y(), ball.p_z());
421421
m_body->getWorldTransform().setOrigin(position * SIMULATOR_SCALE);
@@ -440,7 +440,7 @@ bool SimBall::isInvalid() const
440440
return isNan || isBelowField;
441441
}
442442

443-
void SimBall::kick(const btVector3 &power)
443+
void SimBall::kick(const btVector3& power)
444444
{
445445
m_body->activate();
446446
m_body->applyCentralForce(power);

src/extlibs/er_force_sim/src/amun/simulator/simball.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class camun::simulator::SimBall
5252
*/
5353
void begin(bool robot_collision);
5454

55-
bool update(SSLProto::SSL_DetectionBall &ball, float stddev, float stddevArea,
56-
const btVector3 &cameraPosition, bool enableInvisibleBall,
55+
bool update(SSLProto::SSL_DetectionBall& ball, float stddev, float stddevArea,
56+
const btVector3& cameraPosition, bool enableInvisibleBall,
5757
float visibilityThreshold, btVector3 positionOffset);
5858

59-
void move(const sslsim::TeleportBall &ball);
59+
void move(const sslsim::TeleportBall& ball);
6060

61-
void kick(const btVector3 &power);
61+
void kick(const btVector3& power);
6262

6363
/**
6464
* Returns the ball's position projected onto the floor (z component is not included)
@@ -74,20 +74,20 @@ class camun::simulator::SimBall
7474
*/
7575
btVector3 speed() const;
7676

77-
void writeBallState(world::SimBall &ball) const;
77+
void writeBallState(world::SimBall& ball) const;
7878

79-
void restoreState(const world::SimBall &ball);
79+
void restoreState(const world::SimBall& ball);
8080

81-
btRigidBody *body() const
81+
btRigidBody* body() const
8282
{
8383
return m_body.get();
8484
}
8585

8686
bool isInvalid() const;
8787

8888
// can be used to add ball mis-detections
89-
bool addDetection(SSLProto::SSL_DetectionBall &ball, btVector3 pos, float stddev,
90-
float stddevArea, const btVector3 &cameraPosition,
89+
bool addDetection(SSLProto::SSL_DetectionBall& ball, btVector3 pos, float stddev,
90+
float stddevArea, const btVector3& cameraPosition,
9191
bool enableInvisibleBall, float visibilityThreshold,
9292
btVector3 positionOffset);
9393

src/extlibs/er_force_sim/src/amun/simulator/simfield.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
using namespace camun::simulator;
2626

2727
SimField::SimField(std::shared_ptr<btDiscreteDynamicsWorld> world,
28-
const world::Geometry &geometry)
28+
const world::Geometry& geometry)
2929
: m_world(world)
3030
{
3131
const float totalWidth = geometry.field_width() / 2.0f + geometry.boundary_width();
@@ -100,13 +100,13 @@ SimField::SimField(std::shared_ptr<btDiscreteDynamicsWorld> world,
100100

101101
SimField::~SimField()
102102
{
103-
for (const auto &object : m_objects)
103+
for (const auto& object : m_objects)
104104
{
105105
m_world->removeCollisionObject(object.get());
106106
}
107107
}
108108

109-
void SimField::addObject(btCollisionShape *shape, const btTransform &transform,
109+
void SimField::addObject(btCollisionShape* shape, const btTransform& transform,
110110
float restitution, float friction)
111111
{
112112
std::unique_ptr<btCollisionObject> object = std::make_unique<btCollisionObject>();

src/extlibs/er_force_sim/src/amun/simulator/simfield.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class camun::simulator::SimField
3737
{
3838
public:
3939
SimField(std::shared_ptr<btDiscreteDynamicsWorld> world,
40-
const world::Geometry &geometry);
40+
const world::Geometry& geometry);
4141
~SimField();
4242

4343
private:
44-
void addObject(btCollisionShape *shape, const btTransform &transform,
44+
void addObject(btCollisionShape* shape, const btTransform& transform,
4545
float restitution, float friction);
4646

4747
private:

src/extlibs/er_force_sim/src/amun/simulator/simrobot.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ using namespace camun::simulator;
3131

3232
const float MAX_SPEED = 1000;
3333

34-
SimRobot::SimRobot(const robot::Specs &specs,
35-
std::shared_ptr<btDiscreteDynamicsWorld> world, const btVector3 &pos,
34+
SimRobot::SimRobot(const robot::Specs& specs,
35+
std::shared_ptr<btDiscreteDynamicsWorld> world, const btVector3& pos,
3636
float dir)
3737
: m_specs(specs),
3838
m_world(world),
@@ -54,11 +54,11 @@ SimRobot::SimRobot(const robot::Specs &specs,
5454
createRobotMesh(m_specs.radius() - COLLISION_MARGIN / SIMULATOR_SCALE,
5555
m_specs.height() - 2 * COLLISION_MARGIN / SIMULATOR_SCALE,
5656
m_specs.angle(), 0.04f, m_specs.dribbler_height() + 0.02f);
57-
for (const auto &hullPart : mesh)
57+
for (const auto& hullPart : mesh)
5858
{
5959
std::unique_ptr<btConvexHullShape> hullPartShape =
6060
std::make_unique<btConvexHullShape>();
61-
for (const auto &[x, y, z] : hullPart)
61+
for (const auto& [x, y, z] : hullPart)
6262
{
6363
hullPartShape->addPoint(btVector3(x, y, z) * SIMULATOR_SCALE);
6464
}
@@ -158,7 +158,7 @@ void SimRobot::calculateDribblerMove(const btVector3 pos, const btQuaternion rot
158158
m_dribblerBody->setAngularVelocity(btVector3(0, 0, 0));
159159
}
160160

161-
void SimRobot::dribble(const SimBall &ball, float speed)
161+
void SimRobot::dribble(const SimBall& ball, float speed)
162162
{
163163
if (m_perfectDribbler)
164164
{
@@ -210,7 +210,7 @@ void SimRobot::setDribbleMode(bool perfectDribbler)
210210
m_perfectDribbler = perfectDribbler;
211211
}
212212

213-
void SimRobot::begin(SimBall &ball, double time)
213+
void SimRobot::begin(SimBall& ball, double time)
214214
{
215215
m_commandTime += time;
216216
m_inStandby = false;
@@ -235,7 +235,7 @@ void SimRobot::begin(SimBall &ball, double time)
235235
stopDribbling();
236236
}
237237

238-
auto sendPartialCoordError = [this](const std::string &msg)
238+
auto sendPartialCoordError = [this](const std::string& msg)
239239
{
240240
std::cerr << "Partial coordinates are not implemented yet" << msg << std::endl;
241241
if (!m_move.has_by_force() || !m_move.by_force())
@@ -335,7 +335,7 @@ void SimRobot::begin(SimBall &ball, double time)
335335
}
336336
else
337337
{
338-
const auto &transform = m_body->getWorldTransform();
338+
const auto& transform = m_body->getWorldTransform();
339339
rot = transform.getRotation();
340340
pos = transform.getOrigin();
341341
}
@@ -543,7 +543,7 @@ float SimRobot::bound(float acceleration, float oldSpeed, float speedupLimit,
543543
}
544544
}
545545

546-
btVector3 SimRobot::relativeBallSpeed(const SimBall &ball) const
546+
btVector3 SimRobot::relativeBallSpeed(const SimBall& ball) const
547547
{
548548
btTransform t = m_body->getWorldTransform();
549549
const btVector3 ballSpeed = ball.speed();
@@ -554,7 +554,7 @@ btVector3 SimRobot::relativeBallSpeed(const SimBall &ball) const
554554
return diff;
555555
}
556556

557-
bool SimRobot::canKickBall(const SimBall &ball) const
557+
bool SimRobot::canKickBall(const SimBall& ball) const
558558
{
559559
const btVector3 ballPos = ball.position();
560560
// can't kick jumping ball
@@ -572,17 +572,17 @@ bool SimRobot::canKickBall(const SimBall &ball) const
572572
int numManifolds = m_world->getDispatcher()->getNumManifolds();
573573
for (int i = 0; i < numManifolds; ++i)
574574
{
575-
btPersistentManifold *contactManifold =
575+
btPersistentManifold* contactManifold =
576576
m_world->getDispatcher()->getManifoldByIndexInternal(i);
577-
btCollisionObject *objectA = (btCollisionObject *)(contactManifold->getBody0());
578-
btCollisionObject *objectB = (btCollisionObject *)(contactManifold->getBody1());
577+
btCollisionObject* objectA = (btCollisionObject*)(contactManifold->getBody0());
578+
btCollisionObject* objectB = (btCollisionObject*)(contactManifold->getBody1());
579579
if ((objectA == m_dribblerBody.get() && objectB == ball.body()) ||
580580
(objectA == ball.body() && objectB == m_dribblerBody.get()))
581581
{
582582
int numContacts = contactManifold->getNumContacts();
583583
for (int j = 0; j < numContacts; ++j)
584584
{
585-
btManifoldPoint &pt = contactManifold->getContactPoint(j);
585+
btManifoldPoint& pt = contactManifold->getContactPoint(j);
586586
if (pt.getDistance() < 0.001f * SIMULATOR_SCALE)
587587
{
588588
return true;
@@ -593,8 +593,8 @@ bool SimRobot::canKickBall(const SimBall &ball) const
593593
return false;
594594
}
595595

596-
robot::RadioResponse SimRobot::setCommand(const SSLSimulationProto::RobotCommand &command,
597-
const SimBall &ball, bool charge, float rxLoss,
596+
robot::RadioResponse SimRobot::setCommand(const SSLSimulationProto::RobotCommand& command,
597+
const SimBall& ball, bool charge, float rxLoss,
598598
float txLoss)
599599
{
600600
m_sslCommand = command;
@@ -619,15 +619,15 @@ robot::RadioResponse SimRobot::setCommand(const SSLSimulationProto::RobotCommand
619619
float v_s = v_local.x() / SIMULATOR_SCALE;
620620
float omega = m_body->getAngularVelocity().z();
621621

622-
robot::SpeedStatus *speedStatus = response.mutable_estimated_speed();
622+
robot::SpeedStatus* speedStatus = response.mutable_estimated_speed();
623623
speedStatus->set_v_f(v_f);
624624
speedStatus->set_v_s(v_s);
625625
speedStatus->set_omega(omega);
626626

627627
return response;
628628
}
629629

630-
void SimRobot::update(SSLProto::SSL_DetectionRobot &robot, float stddev_p,
630+
void SimRobot::update(SSLProto::SSL_DetectionRobot& robot, float stddev_p,
631631
float stddev_phi, int64_t time, btVector3 positionOffset)
632632
{
633633
// setup vision packet
@@ -651,7 +651,7 @@ void SimRobot::update(SSLProto::SSL_DetectionRobot &robot, float stddev_p,
651651
m_lastSendTime = time;
652652
}
653653

654-
bool SimRobot::touchesBall(const SimBall &ball) const
654+
bool SimRobot::touchesBall(const SimBall& ball) const
655655
{
656656
// for some reason btHingeConstraints, which is used when dribbling, are not always
657657
// detected as contact by bullet. so if the ball is being dribbled then we assume it
@@ -666,12 +666,12 @@ bool SimRobot::touchesBall(const SimBall &ball) const
666666
int num_manifolds = m_world->getDispatcher()->getNumManifolds();
667667
for (int i = 0; i < num_manifolds; ++i)
668668
{
669-
btPersistentManifold *contact_manifold =
669+
btPersistentManifold* contact_manifold =
670670
m_world->getDispatcher()->getManifoldByIndexInternal(i);
671671

672672
// determine if the two objects are the ball and robot body/dribbler
673-
btCollisionObject *objectA = (btCollisionObject *)(contact_manifold->getBody0());
674-
btCollisionObject *objectB = (btCollisionObject *)(contact_manifold->getBody1());
673+
btCollisionObject* objectA = (btCollisionObject*)(contact_manifold->getBody0());
674+
btCollisionObject* objectB = (btCollisionObject*)(contact_manifold->getBody1());
675675
if ((objectA == m_dribblerBody.get() && objectB == ball.body()) ||
676676
(objectA == ball.body() && objectB == m_dribblerBody.get()) ||
677677
(objectA == m_body.get() && objectB == ball.body()) ||
@@ -681,7 +681,7 @@ bool SimRobot::touchesBall(const SimBall &ball) const
681681
int num_contacts = contact_manifold->getNumContacts();
682682
for (int j = 0; j < num_contacts; ++j)
683683
{
684-
btManifoldPoint &pt = contact_manifold->getContactPoint(j);
684+
btManifoldPoint& pt = contact_manifold->getContactPoint(j);
685685
if (pt.getDistance() < 0.001f * SIMULATOR_SCALE)
686686
{
687687
return true;
@@ -693,7 +693,7 @@ bool SimRobot::touchesBall(const SimBall &ball) const
693693
return false;
694694
}
695695

696-
void SimRobot::update(world::SimRobot &robot, const SimBall &ball) const
696+
void SimRobot::update(world::SimRobot& robot, const SimBall& ball) const
697697
{
698698
btTransform transform;
699699
m_motionState->getWorldTransform(transform);
@@ -704,7 +704,7 @@ void SimRobot::update(world::SimRobot &robot, const SimBall &ball) const
704704
robot.set_id(m_specs.id());
705705

706706
const btQuaternion q = transform.getRotation();
707-
auto *rotation = robot.mutable_rotation();
707+
auto* rotation = robot.mutable_rotation();
708708
rotation->set_real(q.getX());
709709
rotation->set_i(q.getY());
710710
rotation->set_j(q.getZ());
@@ -731,10 +731,10 @@ void SimRobot::update(world::SimRobot &robot, const SimBall &ball) const
731731
int numManifolds = m_world->getDispatcher()->getNumManifolds();
732732
for (int i = 0; i < numManifolds; ++i)
733733
{
734-
btPersistentManifold *contactManifold =
734+
btPersistentManifold* contactManifold =
735735
m_world->getDispatcher()->getManifoldByIndexInternal(i);
736-
btCollisionObject *objectA = (btCollisionObject *)(contactManifold->getBody0());
737-
btCollisionObject *objectB = (btCollisionObject *)(contactManifold->getBody1());
736+
btCollisionObject* objectA = (btCollisionObject*)(contactManifold->getBody0());
737+
btCollisionObject* objectB = (btCollisionObject*)(contactManifold->getBody1());
738738
if ((objectA == m_dribblerBody.get() && objectB == ball.body()) ||
739739
(objectA == ball.body() && objectB == m_dribblerBody.get()) ||
740740
(objectA == m_body.get() && objectB == ball.body()) ||
@@ -746,7 +746,7 @@ void SimRobot::update(world::SimRobot &robot, const SimBall &ball) const
746746
robot.set_touches_ball(ballTouchesRobot);
747747
}
748748

749-
void SimRobot::restoreState(const world::SimRobot &robot)
749+
void SimRobot::restoreState(const world::SimRobot& robot)
750750
{
751751
btVector3 position(robot.p_x(), robot.p_y(), robot.p_z());
752752
m_body->getWorldTransform().setOrigin(position * SIMULATOR_SCALE);
@@ -759,7 +759,7 @@ void SimRobot::restoreState(const world::SimRobot &robot)
759759
m_body->setAngularVelocity(angular);
760760
}
761761

762-
void SimRobot::move(const sslsim::TeleportRobot &robot)
762+
void SimRobot::move(const sslsim::TeleportRobot& robot)
763763
{
764764
m_move = robot;
765765
}

0 commit comments

Comments
 (0)