Skip to content

Commit d1c234b

Browse files
committed
Update clang-format to v14 for jammy
1 parent 84c6cd8 commit d1c234b

File tree

218 files changed

+10970
-11301
lines changed

Some content is hidden

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

218 files changed

+10970
-11301
lines changed

Diff for: examples/ex01_initialize_wam.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
* Shift-idle the WAM and it will again be ready to use.
2121
*/
2222

23-
24-
#include <barrett/systems.h>
2523
#include <barrett/products/product_manager.h>
24+
#include <barrett/systems.h>
2625

2726
// The file below defines Barrett's standard main() function (SMF). It helps you
2827
// initialize Barrett's products properly without having to repeat the necessary
@@ -31,11 +30,9 @@
3130
// wam_main() function below once the WAM is ready to start applying torques.
3231
#include <barrett/standard_main_function.h>
3332

34-
3533
// The root namespace for libbarrett
3634
using namespace barrett;
3735

38-
3936
// In this case, wam_main() is a function template. For a brief introduction to
4037
// C++ templates, see:
4138
// http://www.devarticles.com/c/a/Cplusplus/An-Introduction-to-C-plus-Templates/
@@ -48,14 +45,13 @@ using namespace barrett;
4845
// version of this function where DOF = 7, and a version where DOF = 4. The SMF
4946
// will choose between the two versions based on what kind of robot is present
5047
// when the program is executed.
51-
template<size_t DOF>
52-
int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam) {
53-
48+
template <size_t DOF>
49+
int wam_main(int argc, char **argv, ProductManager &pm,
50+
systems::Wam<DOF> &wam) {
5451

5552
// The WAM is now Shift-activated and applying zero torque with a loop-rate
5653
// of 500Hz.
5754

58-
5955
// Wait for the user to press Shift-idle
6056
pm.getSafetyModule()->waitForMode(SafetyModule::IDLE);
6157
return 0;

Diff for: examples/ex02_hold_position.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@
2727
* configuration files if your WAM is mounted in a different orientation.
2828
*/
2929

30-
3130
#include <iostream>
3231
#include <string>
3332

3433
// Eigen is the C++ math library that libbarrett uses. See:
3534
// http://eigen.tuxfamily.org/dox-2.0/
3635
#include <Eigen/Geometry>
3736

38-
#include <barrett/systems.h>
3937
#include <barrett/products/product_manager.h>
38+
#include <barrett/systems.h>
4039

4140
#include <barrett/standard_main_function.h>
4241

43-
4442
using namespace barrett;
4543

46-
4744
void printMenu() {
4845
printf("Commands:\n");
4946
printf(" j Hold joint positions\n");
@@ -54,8 +51,9 @@ void printMenu() {
5451
printf(" q Quit\n");
5552
}
5653

57-
template<size_t DOF>
58-
int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam) {
54+
template <size_t DOF>
55+
int wam_main(int argc, char **argv, ProductManager &pm,
56+
systems::Wam<DOF> &wam) {
5957
wam.gravityCompensate();
6058
printMenu();
6159

Diff for: examples/ex03_simple_move.cpp

+22-26
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,29 @@
2525
* barrett::units as you see fit!
2626
*/
2727

28-
28+
#include <cstdlib> // For strtod()
2929
#include <iostream>
3030
#include <string>
31-
#include <cstdlib> // For strtod()
3231

3332
// The file below provides access to the barrett::units namespace.
34-
#include <barrett/units.h>
35-
#include <barrett/systems.h>
3633
#include <barrett/products/product_manager.h>
34+
#include <barrett/systems.h>
35+
#include <barrett/units.h>
3736

3837
#include <barrett/standard_main_function.h>
3938

40-
4139
using namespace barrett;
4240

43-
4441
// This function template will accept a math::Matrix with any number of rows,
4542
// any number of columns, and any units. In other words: it will accept any
4643
// barrett::units type.
47-
template<int R, int C, typename Units>
48-
bool parseDoubles(math::Matrix<R,C, Units>* dest, const std::string& str) {
49-
const char* cur = str.c_str();
50-
const char* next = cur;
44+
template <int R, int C, typename Units>
45+
bool parseDoubles(math::Matrix<R, C, Units> *dest, const std::string &str) {
46+
const char *cur = str.c_str();
47+
const char *next = cur;
5148

5249
for (int i = 0; i < dest->size(); ++i) {
53-
(*dest)[i] = strtod(cur, (char**) &next);
50+
(*dest)[i] = strtod(cur, (char **)&next);
5451
if (cur == next) {
5552
return false;
5653
} else {
@@ -59,8 +56,8 @@ bool parseDoubles(math::Matrix<R,C, Units>* dest, const std::string& str) {
5956
}
6057

6158
// Make sure there are no extra numbers in the string.
62-
double ignore = strtod(cur, (char**) &next);
63-
(void)ignore; // Prevent unused variable warnings
59+
double ignore = strtod(cur, (char **)&next);
60+
(void)ignore; // Prevent unused variable warnings
6461

6562
if (cur != next) {
6663
return false;
@@ -69,16 +66,16 @@ bool parseDoubles(math::Matrix<R,C, Units>* dest, const std::string& str) {
6966
return true;
7067
}
7168

72-
template<size_t DOF, int R, int C, typename Units>
73-
void moveToStr(systems::Wam<DOF>& wam, math::Matrix<R,C, Units>* dest,
74-
const std::string& description, const std::string& str)
75-
{
69+
template <size_t DOF, int R, int C, typename Units>
70+
void moveToStr(systems::Wam<DOF> &wam, math::Matrix<R, C, Units> *dest,
71+
const std::string &description, const std::string &str) {
7672
if (parseDoubles(dest, str)) {
7773
std::cout << "Moving to " << description << ": " << *dest << std::endl;
7874
wam.moveTo(*dest);
7975
} else {
8076
printf("ERROR: Please enter exactly %ld numbers separated by "
81-
"whitespace.\n", dest->size());
77+
"whitespace.\n",
78+
dest->size());
8279
}
8380
}
8481

@@ -91,18 +88,18 @@ void printMenu() {
9188
printf(" q Quit\n");
9289
}
9390

94-
template<size_t DOF>
95-
int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam) {
91+
template <size_t DOF>
92+
int wam_main(int argc, char **argv, ProductManager &pm,
93+
systems::Wam<DOF> &wam) {
9694
// The macro below makes a number of typedefs that allow convenient access
9795
// to commonly used barrett::units. For example, the typedefs establish
9896
// "jp_type" as a synonym for "units::JointPositions<DOF>::type". This macro
9997
// (along with a few others) is defined in barrett/units.h.
10098
BARRETT_UNITS_TEMPLATE_TYPEDEFS(DOF);
10199

102100
// These vectors are fixed sized, stack allocated, and zero-initialized.
103-
jp_type jp; // jp is a DOFx1 column vector of joint positions
104-
cp_type cp; // cp is a 3x1 vector representing a Cartesian position
105-
101+
jp_type jp; // jp is a DOFx1 column vector of joint positions
102+
cp_type cp; // cp is a 3x1 vector representing a Cartesian position
106103

107104
wam.gravityCompensate();
108105
printMenu();
@@ -123,8 +120,8 @@ int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam)
123120
break;
124121

125122
case 'h':
126-
std::cout << "Moving to home position: "
127-
<< wam.getHomePosition() << std::endl;
123+
std::cout << "Moving to home position: " << wam.getHomePosition()
124+
<< std::endl;
128125
wam.moveHome();
129126
break;
130127

@@ -148,7 +145,6 @@ int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam)
148145
}
149146
}
150147

151-
152148
wam.idle();
153149
pm.getSafetyModule()->waitForMode(SafetyModule::IDLE);
154150
return 0;

0 commit comments

Comments
 (0)