Skip to content

Commit 338b2d5

Browse files
committed
remove pragmas, enum explicit type
1 parent 337d491 commit 338b2d5

27 files changed

+159
-283
lines changed

fsb-core/cmake/fsb_configuration.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_CONFIGURATION_H
3+
#define FSB_CONFIGURATION_H
34

45
#include <cstddef>
56

@@ -64,3 +65,5 @@ struct MaxSize
6465
*/
6566

6667
} // namespace fsb
68+
69+
#endif // FSB_CONFIGURATION_H

fsb-core/include/fsb_body.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_BODY_H
3+
#define FSB_BODY_H
34

45
#include <array>
56
#include <cstddef>
@@ -185,3 +186,5 @@ bool body_validate_inertia_is_pd(const Inertia& inertia);
185186
*/
186187

187188
} // namespace fsb
189+
190+
#endif

fsb-core/include/fsb_body_tree.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_BODY_TREE_H
3+
#define FSB_BODY_TREE_H
34

45
#include <array>
56
#include <cstddef>
@@ -21,57 +22,57 @@ namespace fsb
2122
/**
2223
* @brief Error list for body tree operations.
2324
*/
24-
enum class BodyTreeError
25+
enum class BodyTreeError : uint8_t
2526
{
26-
SUCCESS,
27+
SUCCESS = 0,
2728
/**
2829
* @brief Index does not point to an existing body in tree.
2930
*/
30-
BODY_NOT_IN_TREE,
31+
BODY_NOT_IN_TREE = 1,
3132
/**
3233
* @brief Index does not point to an existing joint in tree.
3334
*/
34-
JOINT_NOT_IN_TREE,
35+
JOINT_NOT_IN_TREE = 2,
3536
/**
3637
* @brief No more bodies can be added to the body tree. Maximum is specified by @c
3738
* MaxSize::bodies
3839
*/
39-
MAX_BODIES_REACHED,
40+
MAX_BODIES_REACHED = 3,
4041
/**
4142
* @brief Parent body index does not point to an existing body in tree.
4243
*/
43-
PARENT_BODY_NONEXISTENT,
44+
PARENT_BODY_NONEXISTENT = 4,
4445
/**
4546
* @brief No more joints can be added to the body tree. Maximum is specified by @c
4647
* MaxSize::joints
4748
*/
48-
MAX_JOINTS_REACHED,
49+
MAX_JOINTS_REACHED = 5,
4950
/**
5051
* @brief Joint requires more coordinates than is available. Maximum is specified by @c
5152
* MaxSize::coordinates
5253
*/
53-
MAX_JOINT_COORDINATES_REACHED,
54+
MAX_JOINT_COORDINATES_REACHED = 6,
5455
/**
5556
* @brief Joint requires more DoFs than is available. Maximum is specified by @c MaxSize::dofs
5657
*/
57-
MAX_JOINT_DOFS_REACHED,
58+
MAX_JOINT_DOFS_REACHED = 7,
5859
/**
5960
* @brief Body mass is zero with a non-fixed parent joint
6061
*/
61-
MASS_ZERO,
62+
MASS_ZERO = 8,
6263
/**
6364
* @brief At least one of the inertia principal components are zero with a non-fixed parent
6465
* joint
6566
*/
66-
INERTIA_ZERO,
67+
INERTIA_ZERO = 9,
6768
/**
6869
* @brief Body mass is set to zero but with non-zero inertia for a fixed parent joint.
6970
*/
70-
MASS_ZERO_WITH_INERTIA,
71+
MASS_ZERO_WITH_INERTIA = 10,
7172
/**
7273
* @brief Inertia is not positive definite.
7374
*/
74-
INERTIA_NOT_POS_DEF
75+
INERTIA_NOT_POS_DEF = 11
7576
};
7677

7778
/**
@@ -283,3 +284,5 @@ inline BodyTreeError BodyTree::set_parent_joint_transform(
283284
*/
284285

285286
} // namespace fsb
287+
288+
#endif

fsb-core/include/fsb_compute_kinematics.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
2+
#ifndef FSB_COMPUTE_KINEMATICS_H
3+
#define FSB_COMPUTE_KINEMATICS_H
24

35
#include "fsb_body.h"
46
#include "fsb_body_tree.h"
@@ -22,16 +24,16 @@ namespace fsb
2224
* @brief Interface error codes
2325
*
2426
*/
25-
enum class ComputeKinematicsError
27+
enum class ComputeKinematicsError : uint8_t
2628
{
2729
/**
2830
* @brief No error
2931
*/
30-
SUCCESS,
32+
SUCCESS = 0,
3133
/**
3234
* @brief Body tree is invalid
3335
*/
34-
INVALID_BODY_TREE
36+
INVALID_BODY_TREE = 1
3537
};
3638

3739
/**
@@ -153,3 +155,5 @@ inline JacobianError ComputeKinematics::compute_jacobian(
153155
*/
154156

155157
} // namespace fsb
158+
159+
#endif

fsb-core/include/fsb_configuration.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_CONFIGURATION_H
3+
#define FSB_CONFIGURATION_H
34

45
#include <cstddef>
56

@@ -64,3 +65,5 @@ struct MaxSize
6465
*/
6566

6667
} // namespace fsb
68+
69+
#endif // FSB_CONFIGURATION_H

fsb-core/include/fsb_encoder.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_ENCODER_H
3+
#define FSB_ENCODER_H
34

45
#include <cstdint>
56
#include "fsb_types.h"
@@ -18,29 +19,29 @@ namespace fsb
1819
* @brief Status from setting encoder parameters
1920
*
2021
*/
21-
enum class EncoderStatus
22+
enum class EncoderStatus: uint8_t
2223
{
2324
/**
2425
* @brief Parameters applied successfully
2526
*/
26-
SUCCESS,
27+
SUCCESS = 0,
2728
/**
2829
* @brief Resolution of encoder (in number of bits) must be non-zero
2930
*/
30-
RESOLUTION_IS_ZERO,
31+
RESOLUTION_IS_ZERO = 1,
3132
/**
3233
* @brief Encoder resolution exceeds maximum of 32 bits
3334
*/
34-
RESOLUTION_EXCEEDS_MAX,
35+
RESOLUTION_EXCEEDS_MAX = 2,
3536
/**
3637
* @brief Counts per revolution must be non-zero
3738
*/
38-
COUNTS_PER_REV_ZERO,
39+
COUNTS_PER_REV_ZERO = 3,
3940
/**
4041
* @brief Value per revolution is below tolerance
4142
*
4243
*/
43-
VALUE_PER_REV_ZERO
44+
VALUE_PER_REV_ZERO = 4
4445
};
4546

4647
/**
@@ -112,3 +113,5 @@ class IncrementalEncoder
112113
*/
113114

114115
} // namespace fsb
116+
117+
#endif

fsb-core/include/fsb_jacobian.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_JACOBIAN_H
3+
#define FSB_JACOBIAN_H
34

45
#include <array>
56
#include <cstddef>
@@ -138,20 +139,10 @@ JacobianError calculate_jacobian(
138139

139140
MotionVector jacobian_multiply_joint_motion_vector(const Jacobian& jac, const JointSpace& joint_motion, size_t dofs = MaxSize::dofs);
140141

141-
// JacobianError calculate_hessian(
142-
// size_t body_index, const BodyTree& body_tree, const BodyCartesianPva& cartesian_pva, const
143-
// Jacobian& jacobian, Hessian& hessian);
144-
145-
// JacobianError singular_metrics(
146-
// size_t body_index, const BodyTree& body_tree, const BodyCartesianPva& cartesian_pva, const
147-
// Jacobian& jacobian);
148-
149-
// JacobianError observability_metrics(
150-
// size_t body_index, const BodyTree& body_tree, const BodyCartesianPva& cartesian_pva, const
151-
// Jacobian& jacobian);
152-
153142
/**
154143
* @}
155144
*/
156145

157146
} // namespace fsb
147+
148+
#endif // FSB_JACOBIAN_H

fsb-core/include/fsb_joint.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_JOINT_H
3+
#define FSB_JOINT_H
34

45
#include <array>
56
#include <cstddef>
@@ -22,28 +23,28 @@ namespace fsb
2223
/**
2324
* @brief Joint type
2425
*/
25-
enum class JointType
26+
enum class JointType : uint8_t
2627
{
28+
/** @brief Fixed joint */
29+
FIXED = 0,
2730
/** @brief Revolute joint about the x-axis */
28-
REVOLUTE_X,
31+
REVOLUTE_X = 1,
2932
/** @brief Revolute joint about the y-axis */
30-
REVOLUTE_Y,
33+
REVOLUTE_Y = 2,
3134
/** @brief Revolute joint about the z-axis */
32-
REVOLUTE_Z,
35+
REVOLUTE_Z = 3,
3336
/** @brief Prismatic joint along x-axis */
34-
PRISMATIC_X,
37+
PRISMATIC_X = 4,
3538
/** @brief Prismatic joint along y-axis */
36-
PRISMATIC_Y,
39+
PRISMATIC_Y = 5,
3740
/** @brief Prismatic joint along z-axis */
38-
PRISMATIC_Z,
41+
PRISMATIC_Z = 6,
3942
/** @brief Spherical joint */
40-
SPHERICAL,
41-
/** @brief Planar joint in XY plane */
42-
PLANAR,
43+
SPHERICAL = 7,
4344
/** @brief 6 DoF Cartesian joint */
44-
CARTESIAN,
45-
/** @brief Fixed joint */
46-
FIXED
45+
CARTESIAN = 8,
46+
/** @brief Planar joint in XY plane */
47+
PLANAR = 9
4748
};
4849

4950
/**
@@ -176,3 +177,5 @@ bool joint_validate(const Joint& joint);
176177
*/
177178

178179
} // namespace fsb
180+
181+
#endif // FSB_JOINT_H

fsb-core/include/fsb_kinematics.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_KINEMATICS_H
3+
#define FSB_KINEMATICS_H
34

45
#include "fsb_body.h"
56
#include "fsb_body_tree.h"
@@ -19,21 +20,21 @@ namespace fsb
1920
/**
2021
* @brief Forward kinematics options
2122
*/
22-
enum class ForwardKinematicsOption
23+
enum class ForwardKinematicsOption: uint8_t
2324
{
2425
/**
2526
* @brief Calculate Cartesian pose from joint position
2627
*/
27-
POSE,
28+
POSE = 0,
2829
/**
2930
* @brief Calculate Cartesian pose and velocity from joint position and velocity
3031
*/
31-
POSE_VELOCITY,
32+
POSE_VELOCITY = 1,
3233
/**
3334
* @brief Calculate Cartesian pose, velocity and acceleration from
3435
* joint position, velocity, and acceleration
3536
*/
36-
POSE_VELOCITY_ACCELERATION
37+
POSE_VELOCITY_ACCELERATION = 2
3738
};
3839

3940
/**
@@ -65,3 +66,5 @@ void body_com_kinematics(
6566
*/
6667

6768
} // namespace fsb
69+
70+
#endif

fsb-core/include/fsb_linalg3.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#pragma once
2+
#ifndef FSB_LINALG3_H
3+
#define FSB_LINALG3_H
34

45
#include "fsb_types.h"
56

@@ -44,3 +45,5 @@ bool mat3_posdef_symmetric_eigenvectors(
4445
*/
4546

4647
} // namespace fsb
48+
49+
#endif

0 commit comments

Comments
 (0)