In the end, I solved the problem. I used a launch file to open several instances of ROS2 and it works quite well, to be honest.
In order to have different instances you can have a launch file like this:
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
config_camera_1 = "config_1.rviz"
config_camera_2 = "config_2.rviz"
config_lidar_1 = "config_3.rviz"
config_lidar_2 = "config_4.rviz"
config_lidar_3 = "config_5.rviz"
print("SHARE_dir: ", get_package_share_directory('offline_sensor_data_server'))
return LaunchDescription([
Node(package='rviz2',
executable='rviz2',
name='rviz2_camera_1',
arguments=['-d', config_camera_1],
output='screen'
),
Node(package='rviz2',
executable='rviz2',
name='rviz2_camera_2',
arguments=['-d', config_camera_2],
output='screen'
),
Node(package='rviz2',
executable='rviz2',
name='rviz2_2',
arguments=['-d', config_lidar_1],
output='screen'
),
Node(package='rviz2',
executable='rviz2',
name='rviz2_3',
arguments=['-d', config_lidar_2],
output='screen'
),
Node(package='rviz2',
executable='rviz2',
name='rviz2_4',
arguments=['-d', config_lidar_3],
output='screen'
),
])
I hope it helps someone in the same situation.