Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_tos_supervoxels
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
perception
iri_tos_supervoxels
Commits
20523d87
Commit
20523d87
authored
9 years ago
by
NicolaCovallero
Browse files
Options
Downloads
Patches
Plain Diff
added a publisher of the segmented objcts
parent
08b8c527
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+4
-5
4 additions, 5 deletions
CMakeLists.txt
msg/segmented_objects.msg
+1
-0
1 addition, 0 deletions
msg/segmented_objects.msg
src/tos_supervoxels_alg_client_node.cpp
+13
-2
13 additions, 2 deletions
src/tos_supervoxels_alg_client_node.cpp
with
18 additions
and
7 deletions
CMakeLists.txt
+
4
−
5
View file @
20523d87
...
...
@@ -27,11 +27,10 @@ ENDIF (PCL_FOUND)
# Add topic, service and action definition here
# ********************************************************************
## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )
add_message_files
(
FILES
segmented_objects.msg
)
## Generate services in the 'srv' folder
add_service_files
(
...
...
This diff is collapsed.
Click to expand it.
msg/segmented_objects.msg
0 → 100644
+
1
−
0
View file @
20523d87
sensor_msgs/PointCloud2[] objects
This diff is collapsed.
Click to expand it.
src/tos_supervoxels_alg_client_node.cpp
+
13
−
2
View file @
20523d87
...
...
@@ -11,8 +11,11 @@
// srv
#include
"iri_tos_supervoxels/object_segmentation.h"
// msg
#include
"iri_tos_supervoxels/segmented_objects.h"
ros
::
ServiceClient
client
;
ros
::
Publisher
pub
;
ros
::
Publisher
pub
,
pub_segmented_objs
;
std
::
string
service_name
;
void
callback
(
const
sensor_msgs
::
PointCloud2
cloud_msg
)
...
...
@@ -27,6 +30,9 @@ void callback(const sensor_msgs::PointCloud2 cloud_msg)
//creating new point cloud for debugging with random color for each segmented object
sensor_msgs
::
PointCloud2
detected_objects_msg
;
pcl
::
PointCloud
<
pcl
::
PointXYZRGB
>
detected_objects_cloud
;
iri_tos_supervoxels
::
segmented_objects
segmented_objects_msg
;
for
(
int
i
=
0
;
i
<
srv
.
response
.
objects
.
size
();
++
i
)
{
// convert it to pcl
...
...
@@ -50,6 +56,8 @@ void callback(const sensor_msgs::PointCloud2 cloud_msg)
temp_point
.
b
=
b
*
255
;
detected_objects_cloud
.
points
.
push_back
(
temp_point
);
}
segmented_objects_msg
.
objects
.
push_back
(
srv
.
response
.
objects
[
i
]);
}
detected_objects_cloud
.
width
=
detected_objects_cloud
.
points
.
size
();
...
...
@@ -65,6 +73,8 @@ void callback(const sensor_msgs::PointCloud2 cloud_msg)
detected_objects_msg
.
header
.
stamp
=
ros
::
Time
::
now
();
//std::cout << "frame of point cloud: " << detected_objects_msg.header.frame_id << "\n";
pub
.
publish
(
detected_objects_msg
);
pub_segmented_objs
.
publish
(
segmented_objects_msg
);
}
else
ROS_ERROR
(
"Failed to call service %s"
,
service_name
.
c_str
());
...
...
@@ -85,7 +95,8 @@ int main(int argc, char **argv)
ros
::
Subscriber
sub
=
n
.
subscribe
<
sensor_msgs
::
PointCloud2
>
(
input_topic
,
1
,
callback
);
pub
=
n
.
advertise
<
sensor_msgs
::
PointCloud2
>
(
"/detected_objects/points"
,
1
);
pub
=
n
.
advertise
<
sensor_msgs
::
PointCloud2
>
(
"/segmented_objects/points"
,
1
);
pub_segmented_objs
=
n
.
advertise
<
iri_tos_supervoxels
::
segmented_objects
>
(
"/segmented_objects"
,
1
);
client
=
n
.
serviceClient
<
iri_tos_supervoxels
::
object_segmentation
>
(
service_name
);
...
...
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