Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_gnss
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_gnss
Commits
f2cfa4ad
Commit
f2cfa4ad
authored
2 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
optionally publishing ecef TF
parent
b5408f42
No related branches found
No related tags found
1 merge request
!4
Devel
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/publisher_gnss_tf.h
+1
-0
1 addition, 0 deletions
include/publisher_gnss_tf.h
src/publisher_gnss_tf.cpp
+29
-28
29 additions, 28 deletions
src/publisher_gnss_tf.cpp
with
30 additions
and
28 deletions
include/publisher_gnss_tf.h
+
1
−
0
View file @
f2cfa4ad
...
@@ -37,6 +37,7 @@ namespace wolf
...
@@ -37,6 +37,7 @@ namespace wolf
class
PublisherGnssTf
:
public
Publisher
class
PublisherGnssTf
:
public
Publisher
{
{
bool
publish_ecef_
;
std
::
string
map_frame_id_
,
enu_frame_id_
,
ecef_frame_id_
;
std
::
string
map_frame_id_
,
enu_frame_id_
,
ecef_frame_id_
;
tf
::
StampedTransform
T_enu_map_
,
T_ecef_enu_
;
tf
::
StampedTransform
T_enu_map_
,
T_ecef_enu_
;
tf
::
TransformBroadcaster
tfb_
;
tf
::
TransformBroadcaster
tfb_
;
...
...
This diff is collapsed.
Click to expand it.
src/publisher_gnss_tf.cpp
+
29
−
28
View file @
f2cfa4ad
...
@@ -36,18 +36,23 @@ PublisherGnssTf::PublisherGnssTf(const std::string& _unique_name,
...
@@ -36,18 +36,23 @@ PublisherGnssTf::PublisherGnssTf(const std::string& _unique_name,
ProblemConstPtr
_problem
)
:
ProblemConstPtr
_problem
)
:
Publisher
(
_unique_name
,
_server
,
_problem
)
Publisher
(
_unique_name
,
_server
,
_problem
)
{
{
sensor_gnss_
=
std
::
static_pointer_cast
<
const
SensorGnss
>
(
_problem
->
findSensor
(
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/sensor_gnss_name"
)));
auto
sensor
=
std
::
dynamic_pointer_cast
<
const
SensorGnss
>
(
_problem
->
findSensor
(
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/sensor_gnss_name"
)));
if
(
not
sensor_gnss_
)
throw
std
::
runtime_error
(
"PublisherGnssTf: 'sensor_gnss_name' not found or wrong sensor type."
);
T_enu_map_
.
setIdentity
();
T_enu_map_
.
setIdentity
();
T_enu_map_
.
frame_id_
=
"ENU"
;
T_enu_map_
.
frame_id_
=
"ENU"
;
T_enu_map_
.
stamp_
=
ros
::
Time
::
now
();
T_enu_map_
.
stamp_
=
ros
::
Time
::
now
();
T_ecef_enu_
.
setIdentity
();
T_ecef_enu_
.
frame_id_
=
"ECEF"
;
T_ecef_enu_
.
child_frame_id_
=
"ENU"
;
T_ecef_enu_
.
stamp_
=
ros
::
Time
::
now
();
T_enu_map_
.
child_frame_id_
=
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/map_frame_id"
);
T_enu_map_
.
child_frame_id_
=
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/map_frame_id"
);
publish_ecef_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/publish_ecef"
);
if
(
publish_ecef_
)
{
T_ecef_enu_
.
setIdentity
();
T_ecef_enu_
.
frame_id_
=
"ECEF"
;
T_ecef_enu_
.
child_frame_id_
=
"ENU"
;
T_ecef_enu_
.
stamp_
=
ros
::
Time
::
now
();
}
}
}
void
PublisherGnssTf
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
void
PublisherGnssTf
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
...
@@ -56,36 +61,32 @@ void PublisherGnssTf::initialize(ros::NodeHandle& nh, const std::string& topic)
...
@@ -56,36 +61,32 @@ void PublisherGnssTf::initialize(ros::NodeHandle& nh, const std::string& topic)
void
PublisherGnssTf
::
publishDerived
()
void
PublisherGnssTf
::
publishDerived
()
{
{
tf
::
Matrix3x3
tf_R_enu_map
,
tf_R_enu_ecef
;
tf
::
Vector3
tf_t_enu_map
,
tf_t_enu_ecef
;
if
(
not
sensor_gnss_
->
isEnuDefined
())
if
(
not
sensor_gnss_
->
isEnuDefined
())
return
;
return
;
//Eigen::Matrix3d ei_R_enu_ecef = sensor_gnss_->getREnuEcef();
// ENU-MAP
//Eigen::Vector3d ei_t_enu_ecef = sensor_gnss_->gettEnuEcef();
tf
::
Vector3
tf_t_enu_map
;
tf
::
Matrix3x3
tf_R_enu_map
;
//Eigen::Matrix3d ei_R_enu_map = sensor_gnss_->getREnuMap();
//Eigen::Vector3d ei_t_enu_map = sensor_gnss_->gettEnuMap();
//tf::matrixEigenToTF(ei_R_enu_ecef, tf_R_enu_ecef);
//tf::vectorEigenToTF(ei_t_enu_ecef, tf_t_enu_ecef);
tf
::
matrixEigenToTF
(
sensor_gnss_
->
getREnuEcef
(),
tf_R_enu_ecef
);
tf
::
vectorEigenToTF
(
sensor_gnss_
->
gettEnuEcef
(),
tf_t_enu_ecef
);
//tf::matrixEigenToTF(ei_R_enu_map, tf_R_enu_map);
//tf::vectorEigenToTF(ei_t_enu_map, tf_t_enu_map);
tf
::
matrixEigenToTF
(
sensor_gnss_
->
getREnuMap
(),
tf_R_enu_map
);
tf
::
matrixEigenToTF
(
sensor_gnss_
->
getREnuMap
(),
tf_R_enu_map
);
tf
::
vectorEigenToTF
(
sensor_gnss_
->
gettEnuMap
(),
tf_t_enu_map
);
tf
::
vectorEigenToTF
(
sensor_gnss_
->
gettEnuMap
(),
tf_t_enu_map
);
T_ecef_enu_
.
setData
(
tf
::
Transform
(
tf_R_enu_ecef
,
tf_t_enu_ecef
).
inverse
());
T_enu_map_
.
setData
(
tf
::
Transform
(
tf_R_enu_map
,
tf_t_enu_map
));
T_enu_map_
.
setData
(
tf
::
Transform
(
tf_R_enu_map
,
tf_t_enu_map
));
T_ecef_enu_
.
stamp_
=
ros
::
Time
::
now
();
T_enu_map_
.
stamp_
=
ros
::
Time
::
now
();
T_enu_map_
.
stamp_
=
ros
::
Time
::
now
();
tfb_
.
sendTransform
(
T_ecef_enu_
);
tfb_
.
sendTransform
(
T_enu_map_
);
tfb_
.
sendTransform
(
T_enu_map_
);
// ECEF-ENU
if
(
publish_ecef_
)
{
tf
::
Vector3
tf_t_enu_ecef
;
tf
::
Matrix3x3
tf_R_enu_ecef
;
T_ecef_enu_
.
setData
(
tf
::
Transform
(
tf_R_enu_ecef
,
tf_t_enu_ecef
).
inverse
());
T_ecef_enu_
.
stamp_
=
ros
::
Time
::
now
();
tf
::
matrixEigenToTF
(
sensor_gnss_
->
getREnuEcef
(),
tf_R_enu_ecef
);
tf
::
vectorEigenToTF
(
sensor_gnss_
->
gettEnuEcef
(),
tf_t_enu_ecef
);
tfb_
.
sendTransform
(
T_ecef_enu_
);
}
}
}
}
}
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