Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lidar Odometry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
echelon
Lidar Odometry
Commits
94092a91
"README.md" did not exist on "aa7a8b3d60ab6b5056258292cf30cdc5f6660747"
Commit
94092a91
authored
5 years ago
by
echelon
Browse files
Options
Downloads
Patches
Plain Diff
some testing
parent
1afdf81f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/LidarOdometry.h
+10
-4
10 additions, 4 deletions
include/LidarOdometry.h
src/LidarOdometry.cpp
+25
-9
25 additions, 9 deletions
src/LidarOdometry.cpp
with
35 additions
and
13 deletions
include/LidarOdometry.h
+
10
−
4
View file @
94092a91
...
@@ -6,11 +6,14 @@
...
@@ -6,11 +6,14 @@
#include
<tf2_ros/transform_listener.h>
#include
<tf2_ros/transform_listener.h>
#include
<geometry_msgs/PoseWithCovarianceStamped.h>
#include
<geometry_msgs/PoseWithCovarianceStamped.h>
#include
<nav_msgs/Odometry.h>
#include
<fub_feature_common/Poles.h>
#include
<fub_feature_common/Poles.h>
#include
<fub_feature_common/Edges.h>
#include
<fub_feature_common/Edges.h>
#include
<fub_feature_common/Features.h>
#include
<fub_feature_common/Features.h>
#include
<pole_based_localization/PoleArray.h>
namespace
fub_lidar_odometry
{
namespace
fub_lidar_odometry
{
...
@@ -22,12 +25,15 @@ public:
...
@@ -22,12 +25,15 @@ public:
virtual
void
onInit
()
override
;
virtual
void
onInit
()
override
;
protected:
protected:
void
callbackFeatures
(
const
fub_feature_common
::
Features
&
features
);
//void callbackFeatures(const fub_feature_common::Features& features);
void
callbackFeatures
(
const
pole_based_localization
::
PoleArray
&
features
);
ros
::
Subscriber
mFeaturesSubscriber
;
ros
::
Subscriber
mFeaturesSubscriber
;
std
::
map
<
long
,
fub_feature_common
::
Pole
>
mLastPoles
;
ros
::
Publisher
mOdometryPublisher
;
std
::
map
<
long
,
fub_feature_common
::
Corner
>
mLastCorners
;
std
::
map
<
std
::
string
,
pole_based_localization
::
Pole
>
mLastPoles
;
std
::
map
<
long
,
fub_feature_common
::
Edge
>
mLastEdges
;
//std::map<long, fub_feature_common::Pole> mLastPoles;
std
::
map
<
std
::
string
,
fub_feature_common
::
Corner
>
mLastCorners
;
std
::
map
<
std
::
string
,
fub_feature_common
::
Edge
>
mLastEdges
;
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
src/LidarOdometry.cpp
+
25
−
9
View file @
94092a91
...
@@ -25,11 +25,13 @@ LidarOdometry::~LidarOdometry()
...
@@ -25,11 +25,13 @@ LidarOdometry::~LidarOdometry()
void
LidarOdometry
::
onInit
()
void
LidarOdometry
::
onInit
()
{
{
ros
::
NodeHandle
nh
;
ros
::
NodeHandle
nh
;
mFeaturesSubscriber
=
nh
.
subscribe
(
nh
.
resolveName
(
"/pole_based_localization/detected_features"
),
11
,
&
LidarOdometry
::
callbackFeatures
,
this
);
// mFeaturesSubscriber = nh.subscribe(nh.resolveName("/pole_based_localization/detected_features"), 11, &LidarOdometry::callbackFeatures, this);
mOdometryPublisher
=
nh
.
advertise
<
nav_msgs
::
Odometry
>
(
"/localization/lidar_odom"
,
1
);
mFeaturesSubscriber
=
nh
.
subscribe
(
nh
.
resolveName
(
"/pole_recognition/trackedPolesArray"
),
11
,
&
LidarOdometry
::
callbackFeatures
,
this
);
}
}
void
LidarOdometry
::
callbackFeatures
(
const
fub_feature_common
::
Features
&
features
)
void
LidarOdometry
::
callbackFeatures
(
const
pole_based_localization
::
PoleArray
&
features
)
{
{
/*
/*
// get own position
// get own position
...
@@ -54,18 +56,21 @@ void LidarOdometry::callbackFeatures(const fub_feature_common::Features& feature
...
@@ -54,18 +56,21 @@ void LidarOdometry::callbackFeatures(const fub_feature_common::Features& feature
psIn.header = header;
psIn.header = header;
tf2::doTransform(psIn, posUTM, transformStamped);*/
tf2::doTransform(psIn, posUTM, transformStamped);*/
ROS_INFO
(
"got features"
);
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
cloud_old
;
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
cloud_old
;
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
cloud_new
;
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
cloud_new
;
std
::
map
<
std
::
string
,
pole_based_localization
::
Pole
>
newPoles
;
// correlate last features with current features
// correlate last features with current features
for
(
auto
pole
:
features
.
poles
.
poles
){
for
(
auto
pole
:
features
.
poles
){
if
(
mLastPoles
.
find
(
pole
.
trackingId
)
!=
mLastPoles
.
end
()){
if
(
pole
.
type
>
1
)
pcl
::
PointXYZ
po
(
mLastPoles
.
at
(
pole
.
trackingId
).
position
.
x
,
mLastPoles
.
at
(
pole
.
trackingId
).
position
.
y
,
0
);
continue
;
pcl
::
PointXYZ
pn
(
pole
.
position
.
x
,
pole
.
position
.
y
,
0
);
if
(
mLastPoles
.
find
(
pole
.
ID
)
!=
mLastPoles
.
end
()){
pcl
::
PointXYZ
po
(
mLastPoles
.
at
(
pole
.
ID
).
pose
.
position
.
x
,
mLastPoles
.
at
(
pole
.
ID
).
pose
.
position
.
y
,
0
);
pcl
::
PointXYZ
pn
(
pole
.
pose
.
position
.
x
,
pole
.
pose
.
position
.
y
,
0
);
cloud_old
.
push_back
(
po
);
cloud_old
.
push_back
(
po
);
cloud_new
.
push_back
(
pn
);
cloud_new
.
push_back
(
pn
);
}
}
newPoles
[
pole
.
ID
]
=
pole
;
}
}
//TODO: edges and walls
//TODO: edges and walls
...
@@ -88,11 +93,22 @@ void LidarOdometry::callbackFeatures(const fub_feature_common::Features& feature
...
@@ -88,11 +93,22 @@ void LidarOdometry::callbackFeatures(const fub_feature_common::Features& feature
result
.
orientation
.
x
=
0.0
;
result
.
orientation
.
x
=
0.0
;
result
.
orientation
.
y
=
0.0
;
result
.
orientation
.
y
=
0.0
;
result
.
orientation
.
z
=
0.0
;
//
result.orientation.z = 0.0;
result
.
orientation
.
w
=
1.0
;
result
.
orientation
.
w
=
1.0
;
// publish odometry
// publish odometry
ROS_ERROR_STREAM
(
"x, y, yaw: "
<<
result
.
position
.
x
<<
", "
<<
result
.
position
.
y
<<
", "
<<
result
.
orientation
.
z
);
//ROS_ERROR_STREAM("x, y, yaw: " << result.position.x << ", " << result.position.y << ", " << result.orientation.z);
nav_msgs
::
Odometry
odom
;
odom
.
header
=
features
.
header
;
odom
.
header
.
frame_id
=
"base_link"
;
odom
.
pose
.
pose
.
position
.
x
=
result
.
position
.
x
;
odom
.
pose
.
pose
.
position
.
y
=
result
.
position
.
y
;
odom
.
pose
.
pose
.
orientation
.
z
=
result
.
position
.
z
;
odom
.
pose
.
covariance
[
0
]
+=
0.1
;
odom
.
pose
.
covariance
[
7
]
+=
0.1
;
odom
.
pose
.
covariance
[
35
]
+=
0.1
;
mOdometryPublisher
.
publish
(
odom
);
mLastPoles
=
newPoles
;
}
}
...
...
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