Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Model registry
Analyze
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
Avionics
Software Development
Skyward Boardcore
Commits
f310dc03
Commit
f310dc03
authored
4 months ago
by
Matteo Pancotti
Browse files
Options
Downloads
Patches
Plain Diff
propagator with acceleration
parent
434855b5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/algorithms/Propagator/Propagator.cpp
+17
-1
17 additions, 1 deletion
src/shared/algorithms/Propagator/Propagator.cpp
src/shared/algorithms/Propagator/PropagatorData.h
+20
-0
20 additions, 0 deletions
src/shared/algorithms/Propagator/PropagatorData.h
with
37 additions
and
1 deletion
src/shared/algorithms/Propagator/Propagator.cpp
+
17
−
1
View file @
f310dc03
...
@@ -31,6 +31,8 @@ using namespace Eigen;
...
@@ -31,6 +31,8 @@ using namespace Eigen;
namespace
Boardcore
namespace
Boardcore
{
{
static
constexpr
bool
useAcceleration
=
true
;
//set true to use the propagator with acceleration
Propagator
::
Propagator
(
std
::
chrono
::
milliseconds
pUpdatePeriod
)
Propagator
::
Propagator
(
std
::
chrono
::
milliseconds
pUpdatePeriod
)
:
updatePeriod
(
static_cast
<
float
>
(
pUpdatePeriod
.
count
())
/
1000
),
state
()
:
updatePeriod
(
static_cast
<
float
>
(
pUpdatePeriod
.
count
())
/
1000
),
state
()
{
{
...
@@ -52,10 +54,24 @@ void Propagator::step()
...
@@ -52,10 +54,24 @@ void Propagator::step()
getRocketNasState
())
getRocketNasState
())
:
oldState
);
:
oldState
);
// Update Position propagating it with velocity
if
(
useAcceleration
)
// Update Position assuming constant acceleration
{
// checking that last two states are not propagated
if
(
state
.
nPropagations
==
0
&&
oldState
.
nPropagations
==
0
)
state
.
setAProp
((
state
.
getVProp
()
-
oldState
.
getVProp
())
/
updatePeriod
);
state
.
setVProp
((
state
.
getVProp
()
+
state
.
getAProp
())
*
updatePeriod
);
state
.
setXProp
((
state
.
getXProp
()
+
state
.
getVProp
())
*
updatePeriod
);
state
.
nPropagations
++
;
state
.
timestamp
=
TimestampTimer
::
getTimestamp
();
}
else
// Update Position propagating assuming costant velocity
{
state
.
setXProp
(
state
.
getXProp
()
+
state
.
getVProp
()
*
updatePeriod
);
state
.
setXProp
(
state
.
getXProp
()
+
state
.
getVProp
()
*
updatePeriod
);
state
.
nPropagations
++
;
state
.
nPropagations
++
;
state
.
timestamp
=
TimestampTimer
::
getTimestamp
();
state
.
timestamp
=
TimestampTimer
::
getTimestamp
();
}
// Log propagator state
// Log propagator state
PropagatorState
logState
(
state
);
PropagatorState
logState
(
state
);
...
...
This diff is collapsed.
Click to expand it.
src/shared/algorithms/Propagator/PropagatorData.h
+
20
−
0
View file @
f310dc03
...
@@ -42,6 +42,8 @@ struct PropagatorState
...
@@ -42,6 +42,8 @@ struct PropagatorState
uint32_t
nPropagations
;
///< Predictions from last received NAS state
uint32_t
nPropagations
;
///< Predictions from last received NAS state
NASState
nas
;
NASState
nas
;
Eigen
::
Vector3f
acceleration
=
Eigen
::
Vector3f
::
Zero
();
PropagatorState
()
:
timestamp
(
0
),
nPropagations
(
0
),
nas
()
{}
PropagatorState
()
:
timestamp
(
0
),
nPropagations
(
0
),
nas
()
{}
PropagatorState
(
uint64_t
timestamp
,
uint32_t
nPropagations
,
PropagatorState
(
uint64_t
timestamp
,
uint32_t
nPropagations
,
...
@@ -102,6 +104,24 @@ struct PropagatorState
...
@@ -102,6 +104,24 @@ struct PropagatorState
nas
.
vd
=
vProp
(
2
);
nas
.
vd
=
vProp
(
2
);
}
}
/**
* @brief Setter for the vector acceleration
*/
void
setAProp
(
Eigen
::
Vector3f
aProp
)
{
acceleration
=
aProp
;
}
/**
* @brief Getter for the vector acceleration
*
* @return Eigen::Vector3f acceleration
*/
Eigen
::
Vector3f
getAProp
()
const
{
return
acceleration
;
}
/**
/**
* @brief Getter for the vector of quaternions
* @brief Getter for the vector of quaternions
*
*
...
...
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