How to transform point clouds from multiple Gazebo Kinects in the world coordinates?
I'm trying to capture a scene with four static Gazebo Kinects from different positions. each camera is defined by its own group in the main launch file. The problem is that the four generated point clouds are correctly displayed in Rviz, which means that the tf_static between each camera and the world frame is correct. However, when I tried to transform the point clouds from the different topics to open3d point clouds and save them, I got them superposed i.e from the same field of view! My questions are the following? 1- what is wrong (or missed) in my configuration that caused these misaligned point clouds? 2- How can I merge and publish all the point cloud messages in one topic?
Here are some screenshots on the target scene, the displayed point clouds in Rviz and the superposed open3d point clouds saved from the topics
Here is my lunch file
<?xml version="1.0"?>
<launch>
<arg name="recordimages" default="false" />
<!-- configuration of the simulation -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find gazebo_sensors_tutorial)/worlds/plane_cube.world"/>
<arg name="paused" value="false" />
<arg name="gui" value="true" />
</include>
<node name="spawn_camera_model_1" pkg="gazebo_ros" type="spawn_model" args="-urdf -param camera_1/robot_description -model camera_1" respawn="false" output="screen" />
<node name="spawn_camera_model_2" pkg="gazebo_ros" type="spawn_model" args="-urdf -param camera_2/robot_description -model camera_2" respawn="false" output="screen" />
<node name="spawn_camera_model_3" pkg="gazebo_ros" type="spawn_model" args="-urdf -param camera_3/robot_description -model camera_3" respawn="false" output="screen" />
<node name="spawn_camera_model_4" pkg="gazebo_ros" type="spawn_model" args="-urdf -param camera_4/robot_description -model camera_4" respawn="false" output="screen" />
<!-- rviz configuration -->
<node name="chess_rviz" pkg="rviz" type="rviz" respawn="false" args="-d $(find gazebo_sensors_tutorial)/config/four_kinects.rviz" output="screen"/>
<group ns="camera_1">
<param name="publish_frequency" value="100"/>
<param name="robot_description" command="$(find xacro)/xacro $(find gazebo_sensors_tutorial)/robot/camera_1.urdf.xacro" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</group>
<group ns="camera_2">
<param name="publish_frequency" value="100"/>
<param name="robot_description" command="$(find xacro)/xacro $(find gazebo_sensors_tutorial)/robot/camera_2.urdf.xacro" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</group>
<group ns="camera_3">
<param name="publish_frequency" value="100"/>
<param name="robot_description" command="$(find xacro)/xacro $(find gazebo_sensors_tutorial)/robot/camera_3.urdf.xacro" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</group>
<group ns="camera_4">
<param name="publish_frequency" value="100"/>
<param name="robot_description" command="$(find xacro)/xacro $(find gazebo_sensors_tutorial)/robot/camera_4.urdf.xacro" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</group>
</launch>
and here is an example of a camera_X.urdf.xacro file
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="camera_1">
<xacro:include filename="$(find gazebo_sensors_tutorial)/robot/sensors/kinect_camera.urdf.xacro"/>
<link name="world" />
<!-- sets camera frame w.r.t. to world frame-->
<xacro:kinect_camera name="camera_1" parent="world" > ...