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
cf2bace8
Commit
cf2bace8
authored
2 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
added sensors extrinsics for remaping axes
parent
e9ad7ad7
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
+2
-0
2 additions, 0 deletions
include/subscriber_landmarks.h
src/subscriber_landmarks.cpp
+12
-2
12 additions, 2 deletions
src/subscriber_landmarks.cpp
with
14 additions
and
2 deletions
include/subscriber_landmarks.h
+
2
−
0
View file @
cf2bace8
...
@@ -43,6 +43,8 @@ class SubscriberLandmarks : public Subscriber
...
@@ -43,6 +43,8 @@ class SubscriberLandmarks : public Subscriber
protected:
protected:
SizeEigen
dim
;
SizeEigen
dim
;
bool
inverse_detections_
;
bool
inverse_detections_
;
Eigen
::
Vector3d
sensor_p_
;
Eigen
::
Quaterniond
sensor_q_
;
public:
public:
...
...
This diff is collapsed.
Click to expand it.
src/subscriber_landmarks.cpp
+
12
−
2
View file @
cf2bace8
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
**************************/
**************************/
// #include <tf/transform_datatypes.h>
// #include <tf/transform_datatypes.h>
using
namespace
Eigen
;
namespace
wolf
namespace
wolf
{
{
SubscriberLandmarks
::
SubscriberLandmarks
(
const
std
::
string
&
_unique_name
,
SubscriberLandmarks
::
SubscriberLandmarks
(
const
std
::
string
&
_unique_name
,
...
@@ -45,6 +47,9 @@ SubscriberLandmarks::SubscriberLandmarks(const std::string& _unique_name,
...
@@ -45,6 +47,9 @@ 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"
);
inverse_detections_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/inverse_detections"
);
auto
sensor_extrinsics
=
_server
.
getParam
<
VectorXd
>
(
prefix_
+
"/sensor_extrinsics"
);
sensor_p_
=
sensor_extrinsics
.
head
<
3
>
();
sensor_q_
=
Quaterniond
(
Vector4d
(
sensor_extrinsics
.
tail
<
4
>
()));
}
}
void
SubscriberLandmarks
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
void
SubscriberLandmarks
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
...
@@ -72,18 +77,23 @@ void SubscriberLandmarks::callback(const wolf_ros_node::LandmarkDetectionArray::
...
@@ -72,18 +77,23 @@ void SubscriberLandmarks::callback(const wolf_ros_node::LandmarkDetectionArray::
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
z
,
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
z
,
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
w
;
msg
->
detections
.
at
(
i
).
pose
.
pose
.
orientation
.
w
;
meas
.
head
<
3
>
()
=
sensor_p_
+
sensor_q_
*
meas
.
head
<
3
>
();
meas
.
tail
<
4
>
()
=
(
sensor_q_
*
Quaterniond
(
Vector4d
(
meas
.
tail
<
4
>
()))).
coeffs
();
// 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
=
Eigen
::
Map
<
const
Eigen
::
Matrix6d
>
(
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
data
());
MatrixXd
cov
=
Eigen
::
Map
<
const
Eigen
::
Matrix6d
>
(
msg
->
detections
.
at
(
i
).
pose
.
covariance
.
data
());
auto
R
=
q2R
(
meas
.
tail
<
4
>
());
cov
.
topLeftCorner
<
3
,
3
>
()
=
R
*
cov
.
topLeftCorner
<
3
,
3
>
()
*
R
.
transpose
();
//TODO: rotate covariance for orientation
// inverse measurement
// inverse measurement
if
(
inverse_detections_
)
if
(
inverse_detections_
)
{
{
meas
=
SE3
::
inverse
(
meas
);
meas
=
SE3
::
inverse
(
meas
);
auto
R
=
q2R
(
meas
.
tail
<
4
>
());
cov
.
topLeftCorner
<
3
,
3
>
()
=
R
.
transpose
()
*
cov
.
topLeftCorner
<
3
,
3
>
()
*
R
;
cov
.
topLeftCorner
<
3
,
3
>
()
=
R
*
cov
.
topLeftCorner
<
3
,
3
>
()
*
R
.
transpose
();
//TODO: rotate covariance for orientation
//TODO: rotate covariance for orientation
}
}
...
...
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