rtabmap.launch.py: fixed wrong relay remap names when compressed is false. Fixed warnings showing the base topic names and not the remap names. Added rtabmap.launch.py usage in example launch files. Install rtabmap.launch.py.

This commit is contained in:
matlabbe
2021-10-01 18:48:45 -04:00
parent 75ce3a56e7
commit ccf152d877
14 changed files with 132 additions and 89 deletions
+1 -1
View File
@@ -617,7 +617,7 @@ install(FILES
launch/ros2/turtlebot3_rgbd.launch.py launch/ros2/turtlebot3_rgbd.launch.py
launch/ros2/turtlebot3_rgbd_sync.launch.py launch/ros2/turtlebot3_rgbd_sync.launch.py
launch/ros2/realsense_d400.launch.py launch/ros2/realsense_d400.launch.py
# launch/rtabmap.launch launch/ros2/rtabmap.launch.py
# launch/rgbd_mapping.launch # launch/rgbd_mapping.launch
# launch/stereo_mapping.launch # launch/stereo_mapping.launch
# launch/data_recorder.launch # launch/data_recorder.launch
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDE_RTABMAP_ROS_COMMONDATASUBSCRIBERIMPL_H_ #define INCLUDE_RTABMAP_ROS_COMMONDATASUBSCRIBERIMPL_H_
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <rtabmap_ros/GetTopicName.h>
#define DATA_SYNC2(PREFIX, SYNC_NAME, MSG0, MSG1) \ #define DATA_SYNC2(PREFIX, SYNC_NAME, MSG0, MSG1) \
typedef message_filters::sync_policies::SYNC_NAME##Time<MSG0, MSG1> PREFIX##SYNC_NAME##SyncPolicy; \ typedef message_filters::sync_policies::SYNC_NAME##Time<MSG0, MSG1> PREFIX##SYNC_NAME##SyncPolicy; \
@@ -122,8 +122,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str()); getTopicName(SUB1.getSubscriber()).c_str());
#define SYNC_DECL3(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2) \ #define SYNC_DECL3(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2) \
if(APPROX) \ if(APPROX) \
@@ -141,9 +141,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str()); getTopicName(SUB2.getSubscriber()).c_str());
#define SYNC_DECL4(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3) \ #define SYNC_DECL4(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3) \
if(APPROX) \ if(APPROX) \
@@ -161,10 +161,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str(), \ getTopicName(SUB2.getSubscriber()).c_str(), \
SUB3.getTopic().c_str()); getTopicName(SUB3.getSubscriber()).c_str());
#define SYNC_DECL5(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4) \ #define SYNC_DECL5(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4) \
if(APPROX) \ if(APPROX) \
@@ -182,11 +182,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
approxSync?"approx":"exact", \ approxSync?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str(), \ getTopicName(SUB2.getSubscriber()).c_str(), \
SUB3.getTopic().c_str(), \ getTopicName(SUB3.getSubscriber()).c_str(), \
SUB4.getTopic().c_str()); getTopicName(SUB4.getSubscriber()).c_str());
#define SYNC_DECL6(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5) \ #define SYNC_DECL6(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5) \
if(APPROX) \ if(APPROX) \
@@ -204,12 +204,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str(), \ getTopicName(SUB2.getSubscriber()).c_str(), \
SUB3.getTopic().c_str(), \ getTopicName(SUB3.getSubscriber()).c_str(), \
SUB4.getTopic().c_str(), \ getTopicName(SUB4.getSubscriber()).c_str(), \
SUB5.getTopic().c_str()); getTopicName(SUB5.getSubscriber()).c_str());
#define SYNC_DECL7(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5, SUB6) \ #define SYNC_DECL7(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5, SUB6) \
if(APPROX) \ if(APPROX) \
@@ -227,13 +227,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str(), \ getTopicName(SUB2.getSubscriber()).c_str(), \
SUB3.getTopic().c_str(), \ getTopicName(SUB3.getSubscriber()).c_str(), \
SUB4.getTopic().c_str(), \ getTopicName(SUB4.getSubscriber()).c_str(), \
SUB5.getTopic().c_str(), \ getTopicName(SUB5.getSubscriber()).c_str(), \
SUB6.getTopic().c_str()); getTopicName(SUB6.getSubscriber()).c_str());
#define SYNC_DECL8(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5, SUB6, SUB7) \ #define SYNC_DECL8(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5, SUB6, SUB7) \
if(APPROX) \ if(APPROX) \
@@ -251,14 +251,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \ subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", \
name_.c_str(), \ name_.c_str(), \
APPROX?"approx":"exact", \ APPROX?"approx":"exact", \
SUB0.getTopic().c_str(), \ getTopicName(SUB0.getSubscriber()).c_str(), \
SUB1.getTopic().c_str(), \ getTopicName(SUB1.getSubscriber()).c_str(), \
SUB2.getTopic().c_str(), \ getTopicName(SUB2.getSubscriber()).c_str(), \
SUB3.getTopic().c_str(), \ getTopicName(SUB3.getSubscriber()).c_str(), \
SUB4.getTopic().c_str(), \ getTopicName(SUB4.getSubscriber()).c_str(), \
SUB5.getTopic().c_str(), \ getTopicName(SUB5.getSubscriber()).c_str(), \
SUB6.getTopic().c_str(), \ getTopicName(SUB6.getSubscriber()).c_str(), \
SUB7.getTopic().c_str()); getTopicName(SUB7.getSubscriber()).c_str());
#endif /* INCLUDE_RTABMAP_ROS_COMMONDATASUBSCRIBERIMPL_H_ */ #endif /* INCLUDE_RTABMAP_ROS_COMMONDATASUBSCRIBERIMPL_H_ */
+35
View File
@@ -0,0 +1,35 @@
/*
* GetTopicName.h
*
* Created on: Oct 1, 2021
* Author: mathieu
*/
#ifndef INCLUDE_RTABMAP_ROS_GETTOPICNAME_H_
#define INCLUDE_RTABMAP_ROS_GETTOPICNAME_H_
#include <string>
template<class T>
auto getTopicNameImpl(T const& obj, int)
-> decltype(obj->get_topic_name(), std::string())
{
return obj->get_topic_name();
}
template<class T>
auto getTopicNameImpl(T const& obj, long)
-> decltype(obj.getTopic(), std::string())
{
return obj.getTopic();
}
template<class T>
auto getTopicName(T const& obj)
-> decltype(getTopicNameImpl(obj, 0), std::string())
{
return getTopicNameImpl(obj, 0);
}
#endif /* INCLUDE_RTABMAP_ROS_GETTOPICNAME_H_ */
+3 -2
View File
@@ -3,7 +3,10 @@
# Install realsense2 ros2 package (refactor branch) # Install realsense2 ros2 package (refactor branch)
# Example: # Example:
# $ ros2 launch realsense2_camera rs_launch.py align_depth:=true # $ ros2 launch realsense2_camera rs_launch.py align_depth:=true
#
# $ ros2 launch rtabmap_ros realsense_d400.launch.py # $ ros2 launch rtabmap_ros realsense_d400.launch.py
# OR
# $ ros2 launch rtabmap_ros rtabmap.launch.py frame_id:=camera_link args:="-d" rgb_topic:=/camera/color/image_raw depth_topic:=/camera/aligned_depth_to_color/image_raw camera_info_topic:=/camera/color/camera_info approx_sync:=false
from launch import LaunchDescription from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
@@ -22,8 +25,6 @@ def generate_launch_description():
('depth/image', '/camera/aligned_depth_to_color/image_raw')] ('depth/image', '/camera/aligned_depth_to_color/image_raw')]
return LaunchDescription([ return LaunchDescription([
# Set env var to print messages to stdout immediately
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
# Nodes to launch # Nodes to launch
Node( Node(
+16 -12
View File
@@ -4,6 +4,7 @@ from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable, LogInf
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PythonExpression from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PythonExpression
from launch.conditions import IfCondition, UnlessCondition from launch.conditions import IfCondition, UnlessCondition
from launch_ros.actions import Node from launch_ros.actions import Node
from launch_ros.actions import SetParameter
from typing import Text from typing import Text
#Based on https://answers.ros.org/question/363763/ros2-how-best-to-conditionally-include-a-prefix-in-a-launchpy-file/ #Based on https://answers.ros.org/question/363763/ros2-how-best-to-conditionally-include-a-prefix-in-a-launchpy-file/
@@ -14,7 +15,7 @@ class ConditionalText(Substitution):
self.condition = condition self.condition = condition
def perform(self, context: 'LaunchContext') -> Text: def perform(self, context: 'LaunchContext') -> Text:
if self.condition: if self.condition == True or self.condition == 'true' or self.condition == 'True':
return self.text_if return self.text_if
else: else:
return self.text_else return self.text_else
@@ -38,11 +39,14 @@ def launch_setup(context, *args, **kwargs):
DeclareLaunchArgument('subscribe_rgb', default_value=LaunchConfiguration('depth'), description=''), DeclareLaunchArgument('subscribe_rgb', default_value=LaunchConfiguration('depth'), description=''),
#These arguments should not be modified directly, see referred topics without "_relay" suffix above #These arguments should not be modified directly, see referred topics without "_relay" suffix above
DeclareLaunchArgument('rgb_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('rgb_topic').perform(context), "_relay"]), LaunchConfiguration('rgb_topic').perform(context), LaunchConfiguration('compressed')), description='Should not be modified manually!'), DeclareLaunchArgument('rgb_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('rgb_topic').perform(context), "_relay"]), ''.join(LaunchConfiguration('rgb_topic').perform(context)), LaunchConfiguration('compressed').perform(context)), description='Should not be modified manually!'),
DeclareLaunchArgument('depth_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('depth_topic').perform(context), "_relay"]), LaunchConfiguration('depth_topic').perform(context), LaunchConfiguration('compressed')), description='Should not be modified manually!'), DeclareLaunchArgument('depth_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('depth_topic').perform(context), "_relay"]), ''.join(LaunchConfiguration('depth_topic').perform(context)), LaunchConfiguration('compressed').perform(context)), description='Should not be modified manually!'),
DeclareLaunchArgument('left_image_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('left_image_topic').perform(context), "_relay"]), LaunchConfiguration('left_image_topic').perform(context), LaunchConfiguration('compressed')), description='Should not be modified manually!'), DeclareLaunchArgument('left_image_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('left_image_topic').perform(context), "_relay"]), ''.join(LaunchConfiguration('left_image_topic').perform(context)), LaunchConfiguration('compressed').perform(context)), description='Should not be modified manually!'),
DeclareLaunchArgument('right_image_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('right_image_topic').perform(context), "_relay"]), LaunchConfiguration('right_image_topic'), LaunchConfiguration('compressed')), description='Should not be modified manually!'), DeclareLaunchArgument('right_image_topic_relay', default_value=ConditionalText(''.join([LaunchConfiguration('right_image_topic').perform(context), "_relay"]), ''.join(LaunchConfiguration('right_image_topic').perform(context)), LaunchConfiguration('compressed').perform(context)), description='Should not be modified manually!'),
DeclareLaunchArgument('rgbd_topic_relay', default_value=ConditionalText(LaunchConfiguration('rgbd_topic').perform(context), ''.join([LaunchConfiguration('rgbd_topic').perform(context), "_relay"]), LaunchConfiguration('rgbd_sync')), description='Should not be modified manually!'), DeclareLaunchArgument('rgbd_topic_relay', default_value=ConditionalText(''.join(LaunchConfiguration('rgbd_topic').perform(context)), ''.join([LaunchConfiguration('rgbd_topic').perform(context), "_relay"]), LaunchConfiguration('rgbd_sync').perform(context)), description='Should not be modified manually!'),
SetParameter(name='use_sim_time', value=LaunchConfiguration('use_sim_time')),
# 'use_sim_time' will be set on all nodes following the line above
# Relays RGB-Depth # Relays RGB-Depth
Node( Node(
@@ -299,8 +303,6 @@ def launch_setup(context, *args, **kwargs):
def generate_launch_description(): def generate_launch_description():
return LaunchDescription([ return LaunchDescription([
# Set env var to print messages to stdout immediately
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
# Arguments # Arguments
DeclareLaunchArgument('stereo', default_value='false', description='Use stereo input instead of RGB-D.'), DeclareLaunchArgument('stereo', default_value='false', description='Use stereo input instead of RGB-D.'),
@@ -308,13 +310,15 @@ def generate_launch_description():
DeclareLaunchArgument('localization', default_value='false', description='Launch in localization mode.'), DeclareLaunchArgument('localization', default_value='false', description='Launch in localization mode.'),
DeclareLaunchArgument('rtabmapviz', default_value='true', description='Launch RTAB-Map UI (optional).'), DeclareLaunchArgument('rtabmapviz', default_value='true', description='Launch RTAB-Map UI (optional).'),
DeclareLaunchArgument('use_sim_time', default_value='false', description='Use simulation (Gazebo) clock if true'),
# Config files # Config files
DeclareLaunchArgument('cfg', default_value='', description='To change RTAB-Map\'s parameters, set the path of config file (*.ini) generated by the standalone app.'), DeclareLaunchArgument('cfg', default_value='', description='To change RTAB-Map\'s parameters, set the path of config file (*.ini) generated by the standalone app.'),
DeclareLaunchArgument('gui_cfg', default_value='~/.ros/rtabmap_gui.ini', description='Configuration path of rtabmapviz.'), DeclareLaunchArgument('gui_cfg', default_value='~/.ros/rtabmap_gui.ini', description='Configuration path of rtabmapviz.'),
DeclareLaunchArgument('frame_id', default_value='base_link', description='Fixed frame id of the robot (base frame), you may set "base_link" or "base_footprint" if they are published. For camera-only config, this could be "camera_link".'), DeclareLaunchArgument('frame_id', default_value='base_link', description='Fixed frame id of the robot (base frame), you may set "base_link" or "base_footprint" if they are published. For camera-only config, this could be "camera_link".'),
DeclareLaunchArgument('odom_frame_id', default_value='', description='If set, TF is used to get odometry instead of the topic.'), DeclareLaunchArgument('odom_frame_id', default_value='', description='If set, TF is used to get odometry instead of the topic.'),
DeclareLaunchArgument('map_frame_id', default_value='', description='Output map frame id (TF).'), DeclareLaunchArgument('map_frame_id', default_value='map', description='Output map frame id (TF).'),
DeclareLaunchArgument('publish_tf_map', default_value='true', description='Publish TF between map and odomerty.'), DeclareLaunchArgument('publish_tf_map', default_value='true', description='Publish TF between map and odomerty.'),
DeclareLaunchArgument('namespace', default_value='rtabmap', description=''), DeclareLaunchArgument('namespace', default_value='rtabmap', description=''),
DeclareLaunchArgument('database_path', default_value='~/.ros/rtabmap.db', description='Where is the map saved/loaded.'), DeclareLaunchArgument('database_path', default_value='~/.ros/rtabmap.db', description='Where is the map saved/loaded.'),
@@ -349,9 +353,9 @@ def generate_launch_description():
DeclareLaunchArgument('depth_scale', default_value='1.0', description=''), DeclareLaunchArgument('depth_scale', default_value='1.0', description=''),
# Image topic compression # Image topic compression
DeclareLaunchArgument('compressed', default_value='false', description='If you want to subscribe to compressed image topics'), DeclareLaunchArgument('compressed', default_value='false', description='If you want to subscribe to compressed image topics'),
DeclareLaunchArgument('rgb_image_transport', default_value='compressed', description='Common types: compressed, theora (see "rosrun image_transport list_transports")'), DeclareLaunchArgument('rgb_image_transport', default_value='compressed', description='Common types: compressed, theora (see "rosrun image_transport list_transports")'),
DeclareLaunchArgument('depth_image_transport', default_value='compressedDepth', description='Depth compatible types: compressedDepth (see "rosrun image_transport list_transports")'), DeclareLaunchArgument('depth_image_transport', default_value='compressedDepth', description='Depth compatible types: compressedDepth (see "rosrun image_transport list_transports")'),
# LiDAR # LiDAR
DeclareLaunchArgument('subscribe_scan', default_value='false', description=''), DeclareLaunchArgument('subscribe_scan', default_value='false', description=''),
+3 -2
View File
@@ -3,7 +3,10 @@
# Install https://github.com/mlherd/ros2_turtlebot3_waffle_intel_realsense # Install https://github.com/mlherd/ros2_turtlebot3_waffle_intel_realsense
# Example: # Example:
# $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py # $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
#
# $ ros2 launch rtabmap_ros turtlebot3_rgbd.launch.py # $ ros2 launch rtabmap_ros turtlebot3_rgbd.launch.py
# OR
# $ ros2 launch rtabmap_ros rtabmap.launch.py visual_odometry:=false frame_id:=base_footprint odom_topic:=/odom args:="-d" use_sim_time:=true rgb_topic:=/intel_realsense_r200_depth/image_raw depth_topic:=/intel_realsense_r200_depth/depth/image_raw camera_info_topic:=/intel_realsense_r200_depth/camera_info approx_sync:=true
from launch import LaunchDescription from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
@@ -25,8 +28,6 @@ def generate_launch_description():
('depth/image', '/intel_realsense_r200_depth/depth/image_raw')] ('depth/image', '/intel_realsense_r200_depth/depth/image_raw')]
return LaunchDescription([ return LaunchDescription([
# Set env var to print messages to stdout immediately
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
# Launch arguments # Launch arguments
DeclareLaunchArgument( DeclareLaunchArgument(
+3 -2
View File
@@ -3,7 +3,10 @@
# Install https://github.com/mlherd/ros2_turtlebot3_waffle_intel_realsense # Install https://github.com/mlherd/ros2_turtlebot3_waffle_intel_realsense
# Example: # Example:
# $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py # $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
#
# $ ros2 launch rtabmap_ros turtlebot3_rgbd_sync.launch.py # $ ros2 launch rtabmap_ros turtlebot3_rgbd_sync.launch.py
# OR
# $ ros2 launch rtabmap_ros rtabmap.launch.py visual_odometry:=false frame_id:=base_footprint subscribe_scan:=true approx_sync:=true odom_topic:=/odom args:="-d" use_sim_time:=true rgbd_sync:=true rgb_topic:=/intel_realsense_r200_depth/image_raw depth_topic:=/intel_realsense_r200_depth/depth/image_raw camera_info_topic:=/intel_realsense_r200_depth/camera_info
from launch import LaunchDescription from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
@@ -27,8 +30,6 @@ def generate_launch_description():
('depth/image', '/intel_realsense_r200_depth/depth/image_raw')] ('depth/image', '/intel_realsense_r200_depth/depth/image_raw')]
return LaunchDescription([ return LaunchDescription([
# Set env var to print messages to stdout immediately
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
# Launch arguments # Launch arguments
DeclareLaunchArgument( DeclareLaunchArgument(
+3 -2
View File
@@ -2,7 +2,10 @@
# Install Turtlebot3 packages # Install Turtlebot3 packages
# Example: # Example:
# $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py # $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
#
# $ ros2 launch rtabmap_ros turtlebot3_scan.launch.py # $ ros2 launch rtabmap_ros turtlebot3_scan.launch.py
# OR
# $ ros2 launch rtabmap_ros rtabmap.launch.py visual_odometry:=false frame_id:=base_footprint subscribe_scan:=true depth:=false approx_sync:=true odom_topic:=/odom args:="-d" use_sim_time:=true
from launch import LaunchDescription from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
@@ -27,8 +30,6 @@ def generate_launch_description():
('scan', '/scan')] ('scan', '/scan')]
return LaunchDescription([ return LaunchDescription([
# Set env var to print messages to stdout immediately
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
# Launch arguments # Launch arguments
DeclareLaunchArgument( DeclareLaunchArgument(
+1 -1
View File
@@ -341,7 +341,7 @@ void CommonDataSubscriber::setupDepthCallbacks(
imageSub_.subscribe(&node, "rgb/image", hints.getTransport(), rmw_qos_profile_sensor_data); imageSub_.subscribe(&node, "rgb/image", hints.getTransport(), rmw_qos_profile_sensor_data);
imageDepthSub_.subscribe(&node, "depth/image", hints.getTransport(), rmw_qos_profile_sensor_data); imageDepthSub_.subscribe(&node, "depth/image", hints.getTransport(), rmw_qos_profile_sensor_data);
cameraInfoSub_.subscribe(&node, "rgb/camera_info", rmw_qos_profile_sensor_data); cameraInfoSub_.subscribe(&node, "rgb/camera_info", rmw_qos_profile_sensor_data);
if(subscribeOdom && subscribeUserData) if(subscribeOdom && subscribeUserData)
{ {
odomSub_.subscribe(&node, "odom", rmw_qos_profile_sensor_data); odomSub_.subscribe(&node, "odom", rmw_qos_profile_sensor_data);
+12 -12
View File
@@ -128,8 +128,8 @@ void RGBDOdometry::onOdomInit()
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
rgbd_image1_sub_.getTopic().c_str(), rgbd_image1_sub_.getSubscriber()->get_topic_name(),
rgbd_image2_sub_.getTopic().c_str()); rgbd_image2_sub_.getSubscriber()->get_topic_name());
} }
else if(rgbdCameras == 3) else if(rgbdCameras == 3)
{ {
@@ -154,9 +154,9 @@ void RGBDOdometry::onOdomInit()
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
rgbd_image1_sub_.getTopic().c_str(), rgbd_image1_sub_.getSubscriber()->get_topic_name(),
rgbd_image2_sub_.getTopic().c_str(), rgbd_image2_sub_.getSubscriber()->get_topic_name(),
rgbd_image3_sub_.getTopic().c_str()); rgbd_image3_sub_.getSubscriber()->get_topic_name());
} }
else if(rgbdCameras == 4) else if(rgbdCameras == 4)
{ {
@@ -183,10 +183,10 @@ void RGBDOdometry::onOdomInit()
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
rgbd_image1_sub_.getTopic().c_str(), rgbd_image1_sub_.getSubscriber()->get_topic_name(),
rgbd_image2_sub_.getTopic().c_str(), rgbd_image2_sub_.getSubscriber()->get_topic_name(),
rgbd_image3_sub_.getTopic().c_str(), rgbd_image3_sub_.getSubscriber()->get_topic_name(),
rgbd_image4_sub_.getTopic().c_str()); rgbd_image4_sub_.getSubscriber()->get_topic_name());
} }
} }
else else
@@ -220,9 +220,9 @@ void RGBDOdometry::onOdomInit()
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
image_mono_sub_.getTopic().c_str(), image_mono_sub_.getSubscriber().getTopic().c_str(),
image_depth_sub_.getTopic().c_str(), image_depth_sub_.getSubscriber().getTopic().c_str(),
info_sub_.getTopic().c_str()); info_sub_.getSubscriber()->get_topic_name());
} }
this->startWarningThread(subscribedTopicsMsg, approxSync); this->startWarningThread(subscribedTopicsMsg, approxSync);
} }
+3 -3
View File
@@ -82,9 +82,9 @@ RGBDSync::RGBDSync(const rclcpp::NodeOptions & options) :
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s", subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
imageSub_.getTopic().c_str(), imageSub_.getSubscriber().getTopic().c_str(),
imageDepthSub_.getTopic().c_str(), imageDepthSub_.getSubscriber().getTopic().c_str(),
cameraInfoSub_.getTopic().c_str()); cameraInfoSub_.getSubscriber()->get_topic_name());
RCLCPP_INFO(this->get_logger(), "%s", subscribedTopicsMsg_.c_str()); RCLCPP_INFO(this->get_logger(), "%s", subscribedTopicsMsg_.c_str());
+8 -8
View File
@@ -162,10 +162,10 @@ private:
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s, \n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s, \n %s",
getName().c_str(), getName().c_str(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
image_mono_sub_.getTopic().c_str(), image_mono_sub_.getSubscriber().getTopic().c_str(),
image_depth_sub_.getTopic().c_str(), image_depth_sub_.getSubscriber().getTopic().c_str(),
info_sub_.getTopic().c_str(), info_sub_.getSubscriber()->get_topic_name(),
cloud_sub_.getTopic().c_str()); cloud_sub_.getSubscriber()->get_topic_name());
} }
else else
{ {
@@ -184,10 +184,10 @@ private:
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s, \n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s, \n %s",
getName().c_str(), getName().c_str(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
image_mono_sub_.getTopic().c_str(), image_mono_sub_.getSubscriber().getTopic().c_str(),
image_depth_sub_.getTopic().c_str(), image_depth_sub_.getSubscriber().getTopic().c_str(),
info_sub_.getTopic().c_str(), info_sub_.getSubscriber()->get_topic_name(),
scan_sub_.getTopic().c_str()); scan_sub_.getSubscriber()->get_topic_name());
} }
this->startWarningThread(subscribedTopicsMsg, approxSync); this->startWarningThread(subscribedTopicsMsg, approxSync);
} }
+4 -4
View File
@@ -103,10 +103,10 @@ void StereoOdometry::onOdomInit()
subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s", subscribedTopicsMsg = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
imageRectLeft_.getTopic().c_str(), imageRectLeft_.getSubscriber().getTopic().c_str(),
imageRectRight_.getTopic().c_str(), imageRectRight_.getSubscriber().getTopic().c_str(),
cameraInfoLeft_.getTopic().c_str(), cameraInfoLeft_.getSubscriber()->get_topic_name(),
cameraInfoRight_.getTopic().c_str()); cameraInfoRight_.getSubscriber()->get_topic_name());
} }
this->startWarningThread(subscribedTopicsMsg, approxSync); this->startWarningThread(subscribedTopicsMsg, approxSync);
+4 -4
View File
@@ -81,10 +81,10 @@ StereoSync::StereoSync(const rclcpp::NodeOptions & options) :
subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s", subscribedTopicsMsg_ = uFormat("\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s",
get_name(), get_name(),
approxSync?"approx":"exact", approxSync?"approx":"exact",
imageLeftSub_.getTopic().c_str(), imageLeftSub_.getSubscriber().getTopic().c_str(),
imageRightSub_.getTopic().c_str(), imageRightSub_.getSubscriber().getTopic().c_str(),
cameraInfoLeftSub_.getTopic().c_str(), cameraInfoLeftSub_.getSubscriber()->get_topic_name(),
cameraInfoRightSub_.getTopic().c_str()); cameraInfoRightSub_.getSubscriber()->get_topic_name());
RCLCPP_INFO(this->get_logger(), "%s", subscribedTopicsMsg_.c_str()); RCLCPP_INFO(this->get_logger(), "%s", subscribedTopicsMsg_.c_str());