Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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_ros
wolf_ros_node
Commits
e9ad7ad7
Commit
e9ad7ad7
authored
2 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
subscriberlandmarks wip
parent
453ee3c4
No related branches found
No related tags found
1 merge request
!16
Devel
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/subscriber_landmarks.h
+1
-0
1 addition, 0 deletions
include/subscriber_landmarks.h
src/subscriber_landmarks.cpp
+36
-26
36 additions, 26 deletions
src/subscriber_landmarks.cpp
with
37 additions
and
26 deletions
include/subscriber_landmarks.h
+
1
−
0
View file @
e9ad7ad7
...
@@ -42,6 +42,7 @@ class SubscriberLandmarks : public Subscriber
...
@@ -42,6 +42,7 @@ class SubscriberLandmarks : public Subscriber
{
{
protected:
protected:
SizeEigen
dim
;
SizeEigen
dim
;
bool
inverse_detections_
;
public:
public:
...
...
This diff is collapsed.
Click to expand it.
src/subscriber_landmarks.cpp
+
36
−
26
View file @
e9ad7ad7
...
@@ -27,11 +27,13 @@
...
@@ -27,11 +27,13 @@
**************************/
**************************/
#include
<core/capture/capture_landmarks_external.h>
#include
<core/capture/capture_landmarks_external.h>
#include
<core/math/covariance.h>
#include
<core/math/covariance.h>
#include
<core/math/rotations.h>
#include
<core/math/SE3.h>
/**************************
/**************************
* ROS includes *
* ROS includes *
**************************/
**************************/
#include
<tf/transform_datatypes.h>
//
#include <tf/transform_datatypes.h>
namespace
wolf
namespace
wolf
{
{
...
@@ -42,6 +44,7 @@ SubscriberLandmarks::SubscriberLandmarks(const std::string& _unique_name,
...
@@ -42,6 +44,7 @@ SubscriberLandmarks::SubscriberLandmarks(const std::string& _unique_name,
{
{
assert
(
_sensor_ptr
);
assert
(
_sensor_ptr
);
dim
=
_sensor_ptr
->
getProblem
()
->
getDim
();
dim
=
_sensor_ptr
->
getProblem
()
->
getDim
();
inverse_detections_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/inverse_detections"
);
}
}
void
SubscriberLandmarks
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
void
SubscriberLandmarks
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
...
@@ -59,38 +62,45 @@ void SubscriberLandmarks::callback(const wolf_ros_node::LandmarkDetectionArray::
...
@@ -59,38 +62,45 @@ void SubscriberLandmarks::callback(const wolf_ros_node::LandmarkDetectionArray::
// Extract detections from msg
// Extract detections from msg
for
(
auto
i
=
0
;
i
<
msg
->
detections
.
size
();
i
++
)
for
(
auto
i
=
0
;
i
<
msg
->
detections
.
size
();
i
++
)
{
{
// measurement
// 3D measurement from msg
VectorXd
meas
(
dim
==
2
?
3
:
7
);
VectorXd
meas
(
7
);
if
(
dim
==
2
)
meas
<<
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
x
,
{
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
y
,
meas
(
0
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
x
;
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
z
,
meas
(
1
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
y
;
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
x
,
meas
(
2
)
=
tf
::
getYaw
(
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
);
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
y
,
}
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
z
,
else
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
w
;
{
meas
(
0
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
x
;
meas
(
1
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
y
;
meas
(
2
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
position
.
z
;
meas
(
3
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
x
;
meas
(
4
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
y
;
meas
(
5
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
z
;
meas
(
6
)
=
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
w
;
}
// covariance
// PoseWithCovariance documentation:
// PoseWithCovariance documentation:
// Row-major representation of the 6x6 covariance matrix.
// Row-major representation of the 6x6 covariance matrix.
// The orientation parameters use a fixed-axis representation.
// The orientation parameters use a fixed-axis representation.
// In order, the parameters are: (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
// In order, the parameters are: (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
MatrixXd
cov
(
dim
==
2
?
3
:
6
,
dim
==
2
?
3
:
6
);
MatrixXd
cov
=
Eigen
::
Map
<
const
Eigen
::
Matrix6d
>
(
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
data
());
// inverse measurement
if
(
inverse_detections_
)
{
meas
=
SE3
::
inverse
(
meas
);
auto
R
=
q2R
(
meas
.
tail
<
4
>
());
cov
.
topLeftCorner
<
3
,
3
>
()
=
R
*
cov
.
topLeftCorner
<
3
,
3
>
()
*
R
.
transpose
();
//TODO: rotate covariance for orientation
}
// 2D
if
(
dim
==
2
)
if
(
dim
==
2
)
{
{
cov
<<
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
0
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
1
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
5
),
VectorXd
meas2d
=
meas
.
head
<
3
>
();
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
6
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
7
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
11
),
meas2d
(
2
)
=
getYaw
(
q2R
(
meas
.
tail
<
4
>
()));
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
30
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
31
),
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
at
(
35
);
MatrixXd
cov2d
(
3
,
3
);
cov2d
<<
cov
(
0
,
0
),
cov
(
0
,
1
),
cov
(
0
,
5
),
cov
(
1
,
0
),
cov
(
1
,
1
),
cov
(
1
,
5
),
cov
(
5
,
0
),
cov
(
5
,
1
),
cov
(
5
,
5
);
meas
=
meas2d
;
cov
=
cov2d
;
}
}
else
cov
=
Eigen
::
Map
<
const
Eigen
::
Matrix6d
>
(
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
data
());
std
::
cout
<<
"
\t
id "
<<
msg
->
detections
.
at
(
i
).
id
<<
": quality: "
<<
msg
->
detections
.
at
(
i
).
quality
<<
", meas: "
<<
meas
.
transpose
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
id "
<<
msg
->
detections
.
at
(
i
).
id
<<
": quality: "
<<
msg
->
detections
.
at
(
i
).
quality
<<
", meas: "
<<
meas
.
transpose
()
<<
std
::
endl
;
...
...
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