Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
1d50907d
Commit
1d50907d
authored
2 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
hotfix: pi2pi efficient for jets
parent
dcc28f45
No related branches found
No related tags found
2 merge requests
!476
spdlog version upgrade
,
!472
Merge ProcessorLandmarkExternal
Pipeline
#14462
passed
2 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/ceres_wrapper/wolf_jet.h
+17
-6
17 additions, 6 deletions
include/core/ceres_wrapper/wolf_jet.h
include/core/math/rotations.h
+17
-12
17 additions, 12 deletions
include/core/math/rotations.h
with
34 additions
and
18 deletions
include/core/ceres_wrapper/wolf_jet.h
+
17
−
6
View file @
1d50907d
...
@@ -27,14 +27,25 @@
...
@@ -27,14 +27,25 @@
#include
"core/math/rotations.h"
#include
"core/math/rotations.h"
namespace
wolf
{
namespace
ceres
{
// // efficient implementation of pi2pi for jets (without while)
// template<int N>
// inline ceres::Jet<double, N> pi2pi(const ceres::Jet<double, N>& _angle)
// {
// ceres::Jet<double, N> angle = _angle;
// angle.a = pi2pi(_angle.a);
// return angle;
// }
// }
using
std
::
remainder
;
// efficient implementation of pi2pi for jets (without while)
template
<
int
N
>
template
<
int
N
>
inline
ceres
::
Jet
<
double
,
N
>
pi2pi
(
const
ceres
::
Jet
<
double
,
N
>&
_angle
)
inline
Jet
<
double
,
N
>
remainder
(
const
Jet
<
double
,
N
>&
_x
,
long
double
_y
)
{
{
ceres
::
Jet
<
double
,
N
>
angle
=
_angle
;
Jet
<
double
,
N
>
res
=
_x
;
angle
.
a
=
pi2pi
(
_angle
.
a
);
res
.
a
=
remainder
(
_x
.
a
,
_y
);
return
angle
;
return
res
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
include/core/math/rotations.h
+
17
−
12
View file @
1d50907d
...
@@ -41,18 +41,23 @@ namespace wolf
...
@@ -41,18 +41,23 @@ namespace wolf
* @param angle
* @param angle
* @return formatted angle
* @return formatted angle
*/
*/
inline
long
double
pi2pi
(
const
long
double
&
_angle
)
template
<
typename
T
>
{
inline
T
pi2pi
(
const
T
&
_angle
)
return
std
::
remainder
(
_angle
,
2
*
M_PI
);
{
}
return
remainder
(
_angle
,
2
*
M_PI
);
inline
double
pi2pi
(
const
double
&
_angle
)
}
{
// inline long double pi2pi(const long double& _angle)
return
std
::
remainder
(
_angle
,
2
*
M_PI
);
// {
}
// return std::remainder(_angle,2*M_PI);
inline
float
pi2pi
(
const
float
&
_angle
)
// }
{
// inline double pi2pi(const double& _angle)
return
std
::
remainder
(
_angle
,
2
*
M_PI
);
// {
}
// return std::remainder(_angle,2*M_PI);
// }
// inline float pi2pi(const float& _angle)
// {
// return std::remainder(_angle,2*M_PI);
// }
/** \brief Conversion to radians
/** \brief Conversion to radians
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment