ros-perception / pointcloud_to_laserscan

Converts a 3D Point Cloud into a 2D laser scan.
http://wiki.ros.org/pointcloud_to_laserscan
BSD 3-Clause "New" or "Revised" License
410 stars 278 forks source link

Problems running ros2 run pointcloud_to_laserscan in ROS2 Foxy #68

Closed Marcelomm103 closed 2 years ago

Marcelomm103 commented 2 years ago

Hey you all!

I'm trying to get laserscan readings from a 3D point cloud from a lidar in ignitio gazebo fortress. I can see the pointcloud just fine in rviz after i bridged it but haven't managed to use the pointcloud_to_laserscan package. If i try to run ros2 run pointcloud_to_laserscan pointcloud_to_laserscan_node --ros-args --remap cloud_in:="/model/prius_hybrid/laserscan/points", nothing happens, no node or topic created.

I also tried with the launch file provided, sample_pointcloud_to_laserscan_launch.py and tweaked a little with the params. With that the node is created and the topics /cloud and /scan as well, il post the launch file, my /scan topic echo and my /cloud topic echo, as well a img of my rviz and ignition and my ign topic list and ros2 topic list:

Screenshot from 2022-05-25 19-17-59

My sample_pointcloud_to_laserscan.launch.py

` from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node

def generate_launch_description(): return LaunchDescription([ DeclareLaunchArgument( name='scanner', default_value='model/prius_hybrid/laserscan', description='Namespace for sample topics' ), Node( package='pointcloud_to_laserscan', executable='dummy_pointcloud_publisher', remappings=[('cloud', [LaunchConfiguration(variable_name='scanner'), '/cloud'])], parameters=[{'cloud_frame_id': 'cloud', 'cloud_extent': 2.0, 'cloud_size': 500}], name='cloud_publisher' ), Node( package='tf2_ros', executable='static_transform_publisher', name='static_transform_publisher', arguments=['0', '0', '0', '0', '0', '0', '1', 'map', 'cloud'] ), Node( package='pointcloud_to_laserscan', executable='pointcloud_to_laserscan_node', remappings=[('cloud_in', [LaunchConfiguration(variable_name='scanner'), '/points']), ('scan', [LaunchConfiguration(variable_name='scanner'), '/scan'])], parameters=[{ 'target_frame': 'prius_hybrid/base_link/lidar', 'transform_tolerance': 0.01, 'min_height': 0.0, 'max_height': 1.0, 'angle_min': -3.14, # -M_PI/2 'angle_max': 3.14, # M_PI/2 'angle_increment': 0.0087, # M_PI/360.0 'scan_time': 0.3333, 'range_min': 0.45, 'range_max': 10.0, 'use_inf': True, 'inf_epsilon': 1.0 }], name='pointcloud_to_laserscan' ) ]) `

My /scan topic echo:

` header: stamp: sec: 1451 nanosec: 400000000 frame_id: prius_hybrid/base_link/lidar angle_min: -3.140000104904175 angle_max: 3.140000104904175 angle_increment: 0.008700000122189522 time_increment: 0.0 scan_time: 0.33329999446868896 range_min: 0.44999998807907104 range_max: 10.0 ranges:

` header: stamp: sec: 1653517593 nanosec: 138440161 frame_id: cloud height: 1 width: 500 fields:

My ros2 topic list:

/clock /joint_states /model/prius_hybrid/laserscan/cloud /model/prius_hybrid/laserscan/points /model/prius_hybrid/laserscan/scan /parameter_events /robot_description /rosout /scanner/scan /tf /tf_static

My ign topic list:

/clock /gazebo/resource_paths /gui/camera/pose /model/prius_hybrid/imu /model/prius_hybrid/laserscan /model/prius_hybrid/laserscan/points /model/prius_hybrid/odometry /stats /world/empty/clock /world/empty/dynamic_pose/info /world/empty/model/prius_hybrid/joint_state /world/empty/pose/info /world/empty/scene/deletion /world/empty/scene/info /world/empty/state /world/empty/stats

I've already tried to change the max and min height, the target frames, scan time, range max and diferent namespaces. All help will be welcomed, thank you all!

lenaNzrva commented 1 year ago

@Marcelomm103 What was the problem? Thanks