Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
advLigoRTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
CDS
software
advLigoRTS
Commits
838012cb
Commit
838012cb
authored
5 years ago
by
Erik von Reis
Browse files
Options
Downloads
Patches
Plain Diff
This is somewhat cleaner code flow. It's been re-tested.
parent
404b23c5
No related branches found
Branches containing commit
No related tags found
1 merge request
!52
Paramramp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/include/drv/tRamp.c
+26
-11
26 additions, 11 deletions
src/include/drv/tRamp.c
with
26 additions
and
11 deletions
src/include/drv/tRamp.c
+
26
−
11
View file @
838012cb
...
...
@@ -120,30 +120,45 @@ RampParamUpdate( RampParamState* state )
dxNow
=
dxLand
;
}
// update state
state
->
isRamping
=
!
(
dxNow
==
0
.
0
&&
state
->
dxPrev
==
0
.
0
);
if
(
dxNow
==
dxReq
)
state
->
val
=
state
->
req
;
else
if
(
dxNow
!=
0
.
0
)
{
const
double
minprecision
=
1.1103e-16
;
//approx. minimum fraction of a
// double precision value that when added, changes that value
double
minchange
=
lfabs
(
state
->
val
)
*
minprecision
;
//approx. minimum fraction of a double precision value that when added, changes that value
const
double
minprecision
=
1.1103e-16
;
//minimum change that will affect the current value (this is approximate, and can be bigger than the minimum change).
double
minchange
=
lfabs
(
state
->
val
)
*
minprecision
;
if
(
dxNow
!=
0
.
0
)
{
//handle the case where dxReq is smaller than our approx. minimum
if
(
minchange
>
lfabs
(
dxReq
))
{
state
->
val
=
state
->
req
;
dxNow
=
dxReq
;
}
else
{
//otherwise, use the approx. minimum as a lower limit for our change.
if
(
minchange
>
lfabs
(
dxNow
))
{
dxNow
=
dxNow
>
0
?
minchange
:
-
minchange
;
}
state
->
val
+=
dxNow
;
}
}
// update state
state
->
isRamping
=
!
(
dxNow
==
0
.
0
&&
state
->
dxPrev
==
0
.
0
);
//if close enough, just jump to the end
if
(
lfabs
(
dxNow
)
>
lfabs
(
dxReq
))
{
state
->
val
=
state
->
req
;
dxNow
=
dxReq
;
}
else
{
state
->
val
+=
dxNow
;
}
state
->
dxPrev
=
dxNow
;
return
state
->
val
;
...
...
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