Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gnss_utils
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
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
labrobotica
algorithms
gnss_utils
Commits
7338f7b3
Commit
7338f7b3
authored
4 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
wip test
parent
14e0b62b
No related branches found
No related tags found
3 merge requests
!20
new tag
,
!19
new tag
,
!17
Resolve "TDCP batch implementation"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_tdcp.cpp
+12
-10
12 additions, 10 deletions
test/gtest_tdcp.cpp
with
12 additions
and
10 deletions
test/gtest_tdcp.cpp
+
12
−
10
View file @
7338f7b3
#include
"gtest/utils_gtest.h"
#include
"gtest/utils_gtest.h"
#include
"gnss_utils/tdcp.h"
#include
"gnss_utils/snapshot.h"
#include
"gnss_utils/utils/satellite.h"
#include
"gnss_utils/utils/satellite.h"
#include
"gnss_utils/utils/transformations.h"
#include
"gnss_utils/utils/transformations.h"
...
@@ -19,7 +21,7 @@ Vector3d computeRandomReceiverLatLonAlt()
...
@@ -19,7 +21,7 @@ Vector3d computeRandomReceiverLatLonAlt()
void
computeRandomVisibleSatellite
(
const
Vector3d
&
receiver_latlonalt
,
void
computeRandomVisibleSatellite
(
const
Vector3d
&
receiver_latlonalt
,
Vector3d
&
sat_ENU
,
Vector3d
&
sat_ENU
,
Vector3d
&
sat_ECEF
,
Vector3d
&
sat_ECEF
,
Vecto
x_k
d
&
sat_azel
,
Vecto
r2
d
&
sat_azel
,
double
range
)
double
range
)
{
{
Vector3d
t_ECEF_ENU
,
t_ENU_ECEF
;
Vector3d
t_ECEF_ENU
,
t_ENU_ECEF
;
...
@@ -30,7 +32,7 @@ void computeRandomVisibleSatellite(const Vector3d& receiver_latlonalt,
...
@@ -30,7 +32,7 @@ void computeRandomVisibleSatellite(const Vector3d& receiver_latlonalt,
computeEnuEcefFromLatLonAlt
(
receiver_latlonalt
,
R_ENU_ECEF
,
t_ENU_ECEF
);
computeEnuEcefFromLatLonAlt
(
receiver_latlonalt
,
R_ENU_ECEF
,
t_ENU_ECEF
);
// random elevation and azimuth
// random elevation and azimuth
sat_azel
=
Vecto
x_k
d
::
Random
();
// in [-1, 1]
sat_azel
=
Vecto
r2
d
::
Random
();
// in [-1, 1]
sat_azel
(
0
)
*=
M_PI
;
// in [-pi, pi]
sat_azel
(
0
)
*=
M_PI
;
// in [-pi, pi]
sat_azel
(
1
)
=
(
sat_azel
(
1
)
/
2
+
0.5
)
*
M_PI
/
2
;
// in [0, pi/2]
sat_azel
(
1
)
=
(
sat_azel
(
1
)
/
2
+
0.5
)
*
M_PI
/
2
;
// in [0, pi/2]
range
=
VectorXd
::
Random
(
1
)(
0
)
*
5e2
+
1e3
;
// in [500, 1500]
range
=
VectorXd
::
Random
(
1
)(
0
)
*
5e2
+
1e3
;
// in [500, 1500]
...
@@ -53,7 +55,7 @@ TEST(Tdcp, Tdcp)
...
@@ -53,7 +55,7 @@ TEST(Tdcp, Tdcp)
Vector3d
sat_ENU
,
sat_ECEF
;
Vector3d
sat_ENU
,
sat_ECEF
;
Vector3d
x_r_LLA
,
x_r_ECEF
,
x_k_LLA
,
x_k_ECEF
,
d_ECEF
;
Vector3d
x_r_LLA
,
x_r_ECEF
,
x_k_LLA
,
x_k_ECEF
,
d_ECEF
;
Matrix3d
R_ENU_ECEF
;
Matrix3d
R_ENU_ECEF
;
Vecto
x_k
d
azel
,
azel2
;
Vecto
r2
d
azel
,
azel2
;
Vector4d
d
,
d_gt
;
Vector4d
d
,
d_gt
;
Matrix4d
cov_d
;
Matrix4d
cov_d
;
double
residual
;
double
residual
;
...
@@ -87,21 +89,21 @@ TEST(Tdcp, Tdcp)
...
@@ -87,21 +89,21 @@ TEST(Tdcp, Tdcp)
{
{
common_sats
.
insert
(
j
);
common_sats
.
insert
(
j
);
// Satellite
1
(random)
// Satellite
r
(random)
computeRandomVisibleSatellite
(
x_r_LLA
,
sat_ENU
,
sat_ECEF
,
azel
,
range
);
computeRandomVisibleSatellite
(
x_r_LLA
,
sat_ENU
,
sat_ECEF
,
azel
,
range
);
EXPECT_MATRIX_APPROX
(
azel
,
computeAzel
(
sat_ECEF
,
x_r_ECEF
),
1e-6
);
EXPECT_MATRIX_APPROX
(
azel
,
computeAzel
(
sat_ECEF
,
x_r_ECEF
),
1e-6
);
Satellite
sat
1
({
0
,
j
,
sat_ECEF
,
Vector3d
::
Zero
(),
1.0
,
0
,
0
,
1
});
Satellite
sat
_r
({
0
,
j
,
sat_ECEF
,
Vector3d
::
Zero
(),
1.0
,
0
,
0
,
1
});
snapshot
1
.
getSatellites
().
emplace
(
j
,
sat
1
);
snapshot
_r
->
getSatellites
().
emplace
(
j
,
sat
_r
);
// TODO: compute range and add random clock bias
// TODO: compute range and add random clock bias
// Satellite
2
(random)
// Satellite
k
(random)
computeRandomVisibleSatellite
(
x_k_LLA
,
sat_ENU
,
sat_ECEF
,
azel
,
range
);
computeRandomVisibleSatellite
(
x_k_LLA
,
sat_ENU
,
sat_ECEF
,
azel
,
range
);
EXPECT_MATRIX_APPROX
(
azel
,
computeAzel
(
sat_ECEF
,
x_k_ECEF
),
1e-6
);
EXPECT_MATRIX_APPROX
(
azel
,
computeAzel
(
sat_ECEF
,
x_k_ECEF
),
1e-6
);
Satellite
sat
2
({
0
,
j
,
sat_ECEF
,
Vector3d
::
Zero
(),
1.0
,
0
,
0
,
1
});
Satellite
sat
_k
({
0
,
j
,
sat_ECEF
,
Vector3d
::
Zero
(),
1.0
,
0
,
0
,
1
});
snapshot
2
.
getSatellites
().
emplace
(
j
,
sat
2
);
snapshot
_k
->
getSatellites
().
emplace
(
j
,
sat
_k
);
// TODO: compute range and add random clock bias
// TODO: compute range and add random clock bias
}
}
...
@@ -120,7 +122,7 @@ TEST(Tdcp, Tdcp)
...
@@ -120,7 +122,7 @@ TEST(Tdcp, Tdcp)
EXPECT_TRUE
(
tdcp_ok
);
EXPECT_TRUE
(
tdcp_ok
);
EXPECT_MATRIX_APPROX
(
d
,
d_gt
,
1e-9
);
EXPECT_MATRIX_APPROX
(
d
,
d_gt
,
1e-9
);
EXPECT_LE
Q
(
residual
,
1e-9
);
EXPECT_LE
(
residual
,
1e-9
);
}
}
}
}
...
...
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