Skip to content

two terminals to input two point clouds and perform two conversions #101

@lina11116666

Description

@lina11116666

Use two terminals to input two point clouds respectively, one called /trans_cloud and the other called /camera/depth/color/points, and convert the two point clouds to lidar, and output one called scan1 and the other called scan2 respectively. The following are the modifications I made to the launch file. Do I need to make any modifications to the cpp file of the conversion node?
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node

lidar :
def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument(
name='scanner', default_value='scanner',
description='Namespace for sample topics'
),
Node(
package='pointcloud_to_laserscan', executable='dummy_pointcloud_publisher',
remappings=[('cloud', '/trans_cloud'),('scan', '/trans_scan')],
name='cloud_publisher'
),
Node(
package='pointcloud_to_laserscan', executable='pointcloud_to_laserscan_node',
remappings=[('cloud_in', '/trans_cloud'), ('scan', '/scan1')],
parameters=[{
'target_frame': 'base_footprint',
'transform_tolerance': 0.01,
'min_height': 0.25,
'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.25,
'range_min': 0.10,
'range_max': 20.0,
'use_inf': True,
'inf_epsilon': 1.0,
}],
name='pointcloud_to_laserscan'
)
])

camera:
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='scanner',
description='Namespace for sample topics'
),
Node(
package='tf2_ros',
executable='static_transform_publisher',
name='static_transform_publisher',
arguments=['0', '0', '0', '0', '0', '0', '1', 'base_footprint', 'camera_link']
),
Node(
package='pointcloud_to_laserscan', executable='pointcloud_to_laserscan_node',
remappings=[('cloud_in', '/camera/depth/color/points'), ('scan', '/scan2')],
parameters=[{
'target_frame': 'base_footprint',
'transform_tolerance': 0.01,
'min_height': 0.1,
'max_height': 1.5,
'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.25,
'range_min': 0.10,
'range_max': 5.0,
'use_inf': True,
'inf_epsilon': 1.0,
}],
name='pointcloud_to_laserscan'
)
])
I don't know how to modify the pointcloud_to_laserscan_node.cpp file. Can I just modify these two lines?
sub_.subscribe(this, "/trans_cloud",A qos.get_rmw_qos_profile());
sub_.subscribe(this, "/camera/depth/color/points", qos.get_rmw_qos_profile());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions