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
27d3b55d
Commit
27d3b55d
authored
3 years ago
by
Idril-Tadzio Geer Cousté
Browse files
Options
Downloads
Patches
Plain Diff
work
parent
66b5c38a
No related branches found
No related tags found
3 merge requests
!11
new release
,
!10
new release
,
!9
WP: Publisher Trajectory
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/publisher_trajectory.h
+0
-1
0 additions, 1 deletion
include/publisher_trajectory.h
src/publisher_trajectory.cpp
+25
-18
25 additions, 18 deletions
src/publisher_trajectory.cpp
with
25 additions
and
19 deletions
include/publisher_trajectory.h
+
0
−
1
View file @
27d3b55d
...
...
@@ -52,7 +52,6 @@ class PublisherTrajectory: public Publisher
nav_msgs
::
Path
path_msg_
;
nav_msgs
::
Odometry
odometry_msg_
;
geometry_msgs
::
PoseArray
pose_array_msg_
;
visualization_msgs
::
Marker
marker_msg_
;
std_msgs
::
ColorRGBA
marker_color_
;
SensorBasePtr
sensor_
;
...
...
This diff is collapsed.
Click to expand it.
src/publisher_trajectory.cpp
+
25
−
18
View file @
27d3b55d
...
...
@@ -81,12 +81,19 @@ void PublisherTrajectory::initialize(ros::NodeHandle& nh, const std::string& top
pub_marker_
=
nh
.
advertise
<
visualization_msgs
::
Marker
>
(
topic
+
"_marker"
,
1
);
// Odometry
odometry_msg_
.
header
.
frame_id
=
frame_id_
;
pub_odometry_
=
nh
.
advertise
<
geometry_msgs
::
PoseWithCovarianceStamped
>
(
topic
+
"_pose_with_cov"
,
1
);
}
void
PublisherTrajectory
::
publishDerived
()
{
if
(
pub_path_
.
getNumSubscribers
()
==
0
and
pub_marker_
.
getNumSubscribers
()
==
0
)
pub_marker_
.
getNumSubscribers
()
==
0
and
pub_odometry_
.
getNumSubscribers
()
==
0
)
return
;
VectorComposite
current_state
=
problem_
->
getState
(
"PO"
);
...
...
@@ -162,24 +169,24 @@ void PublisherTrajectory::publishDerived()
if
(
problem_
->
getDim
()
==
2
)
throw
std
::
runtime_error
(
"not implemented"
);
else
std
::
copy
(
cov
.
data
(),
cov
.
data
()
+
cov
.
size
(),
pose_with_cov
_msg_
.
pose
.
covariance
.
data
());
std
::
copy
(
cov
.
data
(),
cov
.
data
()
+
cov
.
size
(),
odometry
_msg_
.
pose
.
covariance
.
data
());
}
else
{
//WOLF_WARN("Last KF covariance could not be recovered, using the previous one");
//
pose_with_cov
_msg_.pose.covariance[0] = -1; // not valid
//
odometry
_msg_.pose.covariance[0] = -1; // not valid
}
// Fill Trajectory msg
pose_with_cov
_msg_
.
header
.
stamp
=
ros
::
Time
(
loc_ts
.
getSeconds
(),
loc_ts
.
getNanoSeconds
());
pose_with_cov
_msg_
.
pose
.
pose
.
position
.
x
=
p
(
0
);
pose_with_cov
_msg_
.
pose
.
pose
.
position
.
y
=
p
(
1
);
pose_with_cov
_msg_
.
pose
.
pose
.
position
.
z
=
p
(
2
);
pose_with_cov
_msg_
.
pose
.
pose
.
orientation
.
x
=
q
.
x
();
pose_with_cov
_msg_
.
pose
.
pose
.
orientation
.
y
=
q
.
y
();
pose_with_cov
_msg_
.
pose
.
pose
.
orientation
.
z
=
q
.
z
();
pose_with_cov
_msg_
.
pose
.
pose
.
orientation
.
w
=
q
.
w
();
odometry
_msg_
.
header
.
stamp
=
ros
::
Time
(
loc_ts
.
getSeconds
(),
loc_ts
.
getNanoSeconds
());
odometry
_msg_
.
pose
.
pose
.
position
.
x
=
p
(
0
);
odometry
_msg_
.
pose
.
pose
.
position
.
y
=
p
(
1
);
odometry
_msg_
.
pose
.
pose
.
position
.
z
=
p
(
2
);
odometry
_msg_
.
pose
.
pose
.
orientation
.
x
=
q
.
x
();
odometry
_msg_
.
pose
.
pose
.
orientation
.
y
=
q
.
y
();
odometry
_msg_
.
pose
.
pose
.
orientation
.
z
=
q
.
z
();
odometry
_msg_
.
pose
.
pose
.
orientation
.
w
=
q
.
w
();
publishTrajectory
();
}
...
...
@@ -188,7 +195,7 @@ void PublisherTrajectory::publishTrajectory()
// fill msgs and publish
if
(
pub_path_
.
getNumSubscribers
()
!=
0
)
{
path_msg_
.
header
.
stamp
=
pose_with_cov
_msg_
.
header
.
stamp
;
path_msg_
.
header
.
stamp
=
odometry
_msg_
.
header
.
stamp
;
if
(
max_points_
>=
0
and
path_msg_
.
poses
.
size
()
>=
max_points_
)
{
...
...
@@ -202,13 +209,13 @@ void PublisherTrajectory::publishTrajectory()
// path_msg_.poses.begin() + max_points_/2);
}
path_msg_
.
poses
.
push_back
(
pose_with_cov
_msg_
.
pose
.
pose
);
path_msg_
.
poses
.
push_back
(
odometry
_msg_
.
pose
.
pose
);
pub_path_
.
publish
(
path_msg_
);
}
if
(
pub_marker_
.
getNumSubscribers
()
!=
0
)
{
marker_msg_
.
header
.
stamp
=
pose_with_cov
_msg_
.
header
.
stamp
;
marker_msg_
.
header
.
stamp
=
odometry
_msg_
.
header
.
stamp
;
if
(
max_points_
>=
0
and
marker_msg_
.
points
.
size
()
>=
max_points_
)
{
...
...
@@ -231,13 +238,13 @@ void PublisherTrajectory::publishTrajectory()
// marker_msg_.points.begin() + max_points_/2);
}
marker_msg_
.
points
.
push_back
(
pose_with_cov
_msg_
.
pose
.
pose
.
position
);
marker_msg_
.
points
.
push_back
(
odometry
_msg_
.
pose
.
pose
.
position
);
pub_marker_
.
publish
(
marker_msg_
);
}
if
(
pub_
pose_with_cov
_
.
getNumSubscribers
()
!=
0
)
if
(
pub_
odometry
_
.
getNumSubscribers
()
!=
0
)
{
pub_
pose_with_cov_
.
publish
(
pose_with_cov
_msg_
);
pub_
odometry_
.
publish
(
odometry
_msg_
);
}
}
...
...
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