Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
larm-astro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Inès EL HADRI
larm-astro
Commits
3fdca3c9
Commit
3fdca3c9
authored
Dec 22, 2023
by
Inès EL HADRI
💤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cloud point converter
parent
0479b0f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tuto_scan_echo
tuto_kickoff/scripts/tuto_scan_echo
+3
-3
No files found.
tuto_kickoff/scripts/tuto_scan_echo
View file @
3fdca3c9
...
@@ -3,7 +3,7 @@ import rclpy
...
@@ -3,7 +3,7 @@ import rclpy
import
math
import
math
from
rclpy.node
import
Node
from
rclpy.node
import
Node
from
sensor_msgs.msg
import
LaserScan
,
PointCloud2
from
sensor_msgs.msg
import
LaserScan
,
PointCloud2
import
sensor_msgs_py.
point_cloud2
from
sensor_msgs_py
import
point_cloud2
from
std_msgs.msg
import
Header
from
std_msgs.msg
import
Header
rosNode
=
None
rosNode
=
None
...
@@ -13,10 +13,10 @@ def scan_callback(scanMsg):
...
@@ -13,10 +13,10 @@ def scan_callback(scanMsg):
obstacles
=
ranges_to_positions
(
scanMsg
)
obstacles
=
ranges_to_positions
(
scanMsg
)
sample
=
[
[
round
(
p
[
0
],
2
),
round
(
p
[
1
],
2
),
round
(
p
[
2
],
2
)
]
for
p
in
obstacles
[
10
:
20
]
]
sample
=
[
[
round
(
p
[
0
],
2
),
round
(
p
[
1
],
2
),
round
(
p
[
2
],
2
)
]
for
p
in
obstacles
[
10
:
20
]
]
rosNode
.
get_logger
()
.
info
(
f
"
\n
header:
\n
{scanMsg.header}
\n
number of ranges: {len(scanMsg.ranges)}
\n
Sample: {sample}
\n
"
)
#
rosNode.get_logger().info( f"\nheader:\n{scanMsg.header}\nnumber of ranges: {len(scanMsg.ranges)}\nSample: {sample}\n" )
# Publish a msg
# Publish a msg
pointCloud
=
sensor_msgs_py
.
point_cloud2
.
create_cloud_xyz32
(
Header
(
frame_id
=
scanMsg
.
header
.
frame_id
),
obstacles
)
pointCloud
=
point_cloud2
.
create_cloud_xyz32
(
Header
(
frame_id
=
scanMsg
.
header
.
frame_id
),
obstacles
)
point_publisher
.
publish
(
pointCloud
)
point_publisher
.
publish
(
pointCloud
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment