Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
11d48024
Commit
11d48024
authored
7 years ago
by
Matthias Grob
Committed by
Daniel Agar
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
mathlib Functions: removed inline, fixed style
parent
8e68f5ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/mathlib/math/Functions.hpp
+9
-9
9 additions, 9 deletions
src/lib/mathlib/math/Functions.hpp
with
9 additions
and
9 deletions
src/lib/mathlib/math/Functions.hpp
+
9
−
9
View file @
11d48024
...
...
@@ -61,9 +61,9 @@ int sign(T val)
* @return result of function output
*/
template
<
typename
T
>
inline
const
T
expo
(
const
T
&
value
,
const
T
&
e
)
const
T
expo
(
const
T
&
value
,
const
T
&
e
)
{
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
ec
=
constrain
(
e
,
(
T
)
0
,
(
T
)
1
);
return
(
1
-
ec
)
*
x
+
ec
*
x
*
x
*
x
;
}
...
...
@@ -80,9 +80,9 @@ inline const T expo(const T &value, const T &e)
* @return result of function output
*/
template
<
typename
T
>
inline
const
T
superexpo
(
const
T
&
value
,
const
T
&
e
,
const
T
&
g
)
const
T
superexpo
(
const
T
&
value
,
const
T
&
e
,
const
T
&
g
)
{
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
gc
=
constrain
(
g
,
(
T
)
0
,
(
T
)
0.99
);
return
expo
(
x
,
e
)
*
(
1
-
gc
)
/
(
1
-
fabsf
(
x
)
*
gc
);
}
...
...
@@ -102,9 +102,9 @@ inline const T superexpo(const T &value, const T &e, const T &g)
* 0.99 - almost entire span is deadzone
*/
template
<
typename
T
>
inline
const
T
deadzone
(
const
T
&
value
,
const
T
&
dz
)
const
T
deadzone
(
const
T
&
value
,
const
T
&
dz
)
{
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
x
=
constrain
(
value
,
(
T
)
-
1
,
(
T
)
1
);
T
dzc
=
constrain
(
dz
,
(
T
)
0
,
(
T
)
0.99
);
// Rescale the input such that we get a piecewise linear function that will be continuous with applied deadzone
T
out
=
(
x
-
sign
(
x
)
*
dzc
)
/
(
1
-
dzc
);
...
...
@@ -113,7 +113,7 @@ inline const T deadzone(const T &value, const T &dz)
}
template
<
typename
T
>
inline
const
T
expo_deadzone
(
const
T
&
value
,
const
T
&
e
,
const
T
&
dz
)
const
T
expo_deadzone
(
const
T
&
value
,
const
T
&
e
,
const
T
&
dz
)
{
return
expo
(
deadzone
(
value
,
dz
),
e
);
}
...
...
@@ -129,7 +129,7 @@ inline const T expo_deadzone(const T &value, const T &e, const T &dz)
* x_low x_high
*/
template
<
typename
T
>
inline
const
T
gradual
(
const
T
&
value
,
const
T
&
x_low
,
const
T
&
x_high
,
const
T
&
y_low
,
const
T
&
y_high
)
const
T
gradual
(
const
T
&
value
,
const
T
&
x_low
,
const
T
&
x_high
,
const
T
&
y_low
,
const
T
&
y_high
)
{
if
(
value
<
x_low
)
{
return
y_low
;
...
...
@@ -145,4 +145,4 @@ inline const T gradual(const T &value, const T &x_low, const T &x_high, const T
}
}
}
}
/* namespace math */
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