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
582e549c
Commit
582e549c
authored
2 years ago
by
Amanda Sanjuan Sánchez
Browse files
Options
Downloads
Patches
Plain Diff
New SubscriberPose
parent
51f5c55e
No related branches found
No related tags found
1 merge request
!16
Devel
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+4
-3
4 additions, 3 deletions
CMakeLists.txt
include/subscriber_pose.h
+64
-0
64 additions, 0 deletions
include/subscriber_pose.h
src/subscriber_pose.cpp
+77
-0
77 additions, 0 deletions
src/subscriber_pose.cpp
with
145 additions
and
3 deletions
CMakeLists.txt
+
4
−
3
View file @
582e549c
...
...
@@ -44,14 +44,15 @@ add_executable(${PROJECT_NAME} src/node.cpp)
add_library
(
subscriber_
${
PROJECT_NAME
}
src/subscriber_diffdrive.cpp
src/subscriber_odom2d.cpp
)
src/subscriber_odom2d.cpp
src/subscriber_pose.cpp
)
add_library
(
publisher_
${
PROJECT_NAME
}
src/publisher_graph.cpp
src/publisher_pose.cpp
src/publisher_trajectory.cpp
src/publisher_state_block.cpp
src/publisher_tf.cpp
)
src/publisher_tf.cpp
src/publisher_trajectory.cpp
)
## Specify libraries to link a library or executable target against
target_link_libraries
(
subscriber_
${
PROJECT_NAME
}
...
...
This diff is collapsed.
Click to expand it.
include/subscriber_pose.h
0 → 100644
+
64
−
0
View file @
582e549c
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef WOLF_SUBSCRIBER_POSE_H_
#define WOLF_SUBSCRIBER_POSE_H_
/**************************
* WOLF includes *
**************************/
#include
"subscriber.h"
#include
<core/common/wolf.h>
#include
<core/utils/params_server.h>
#include
<core/capture/capture_pose.h>
#include
<core/sensor/sensor_pose.h>
#include
<core/processor/processor_pose.h>
/**************************
* ROS includes *
**************************/
#include
<ros/ros.h>
#include
<geometry_msgs/PoseStamped.h>
namespace
wolf
{
class
SubscriberPose
:
public
Subscriber
{
protected:
ros
::
Time
last_pose_stamp_
;
SensorPosePtr
sensor_pose_
;
public:
SubscriberPose
(
const
std
::
string
&
_unique_name
,
const
ParamsServer
&
_server
,
const
SensorBasePtr
_sensor_ptr
);
WOLF_SUBSCRIBER_CREATE
(
SubscriberPose
);
virtual
void
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
);
void
callback
(
const
geometry_msgs
::
PoseStamped
::
ConstPtr
&
msg
);
};
}
// namespace wolf
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/subscriber_pose.cpp
0 → 100644
+
77
−
0
View file @
582e549c
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
/**************************
* WOLF includes *
**************************/
#include
"subscriber_pose.h"
/**************************
* ROS includes *
**************************/
/**************************
* STD includes *
**************************/
#include
<iostream>
#include
<iomanip>
#include
<queue>
namespace
wolf
{
SubscriberPose
::
SubscriberPose
(
const
std
::
string
&
_unique_name
,
const
ParamsServer
&
_server
,
const
SensorBasePtr
_sensor_ptr
)
:
Subscriber
(
_unique_name
,
_server
,
_sensor_ptr
)
,
last_pose_stamp_
(
ros
::
Time
(
0
))
,
sensor_pose_
(
std
::
static_pointer_cast
<
SensorPose
>
(
_sensor_ptr
))
{
assert
(
std
::
dynamic_pointer_cast
<
SensorPose
>
(
_sensor_ptr
)
!=
nullptr
&&
"SubscriberPose: sensor provided is not of type SensorPose!"
);
}
void
SubscriberPose
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
{
sub_
=
nh
.
subscribe
(
topic
,
100
,
&
SubscriberPose
::
callback
,
this
);
}
void
SubscriberPose
::
callback
(
const
geometry_msgs
::
PoseStamped
::
ConstPtr
&
msg
)
{
updateLastHeader
(
msg
->
header
);
if
(
last_pose_stamp_
!=
ros
::
Time
(
0
))
{
double
dt
=
(
msg
->
header
.
stamp
-
last_pose_stamp_
).
toSec
();
Eigen
::
Vector7d
data
;
data
<<
msg
->
pose
.
position
.
x
,
msg
->
pose
.
position
.
y
,
msg
->
pose
.
position
.
z
,
msg
->
pose
.
orientation
.
x
,
msg
->
pose
.
orientation
.
y
,
msg
->
pose
.
orientation
.
z
,
msg
->
pose
.
orientation
.
w
;
CapturePosePtr
new_capture
=
std
::
make_shared
<
CapturePose
>
(
TimeStamp
(
msg
->
header
.
stamp
.
sec
,
msg
->
header
.
stamp
.
nsec
),
sensor_ptr_
,
data
,
sensor_pose_
->
getNoiseCov
());
sensor_ptr_
->
process
(
new_capture
);
}
last_pose_stamp_
=
msg
->
header
.
stamp
;
}
WOLF_REGISTER_SUBSCRIBER
(
SubscriberPose
)
}
// namespace wolf
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