include
opw_kinematics
opw_utilities.h
Go to the documentation of this file.
1
#ifndef OPW_UTILITIES_H
2
#define OPW_UTILITIES_H
3
4
#include <cmath>
5
#include <
opw_kinematics/opw_kinematics.h
>
6
7
namespace
opw_kinematics
8
{
9
template
<
typename
T>
10
inline
bool
isValid
(
const
std::array<T, 6>& qs)
11
{
12
return
std::isfinite(qs[0]) && std::isfinite(qs[1]) && std::isfinite(qs[2]) && std::isfinite(qs[3]) &&
13
std::isfinite(qs[4]) && std::isfinite(qs[5]);
14
}
15
16
template
<
typename
T>
17
inline
void
harmonizeTowardZero
(std::array<T, 6>& qs)
18
{
19
const
static
auto
pi = T(M_PI);
20
const
static
auto
two_pi = T(2.0 * M_PI);
21
22
for
(
auto
& q : qs)
23
{
24
if
(q > pi)
25
q -= two_pi;
26
else
if
(q < -pi)
27
q += two_pi;
28
}
29
}
30
31
}
// namespace opw_kinematics
32
33
#endif // OPW_UTILITIES_H
opw_kinematics::isValid
bool isValid(const std::array< T, 6 > &qs)
Definition:
opw_utilities.h:10
opw_kinematics
Definition:
opw_io.h:7
opw_kinematics.h
opw_kinematics::harmonizeTowardZero
void harmonizeTowardZero(std::array< T, 6 > &qs)
Definition:
opw_utilities.h:17
opw_kinematics
Author(s): Jon Meyer
, Jeroen De Maeyer
autogenerated on Thu Jan 16 2025 03:40:37