Skip to content

Commit

Permalink
Fixed diagnostic clock with sim time. Updated docker example with exp…
Browse files Browse the repository at this point in the history
…licit OMP_WAIT_POLICY=passive to avoid high CPU usage. Added log_level argument to rtabmap.launch.py.
  • Loading branch information
matlabbe committed Jun 2, 2024
1 parent 613b73f commit 54f9ec9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
docker run -it --rm \
--user $UID \
-e ROS_HOME=/tmp/.ros \
-e OMP_WAIT_POLICY=passive \
--network=host \
--ipc=host \
-v ~/.ros:/tmp/.ros \
Expand All @@ -35,6 +36,7 @@
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e XAUTHORITY=$XAUTH \
-e OMP_WAIT_POLICY=passive \
--user $UID \
-e ROS_HOME=/tmp/.ros \
-v ~/.ros:/tmp/.ros \
Expand Down
16 changes: 11 additions & 5 deletions rtabmap_launch/launch/rtabmap.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def launch_setup(context, *args, **kwargs):
DeclareLaunchArgument('qos_user_data', default_value=LaunchConfiguration('qos'), description='Specific QoS used for user input data: 0=system default, 1=Reliable, 2=Best Effort.'),
DeclareLaunchArgument('qos_imu', default_value=LaunchConfiguration('qos'), description='Specific QoS used for imu input data: 0=system default, 1=Reliable, 2=Best Effort.'),
DeclareLaunchArgument('qos_gps', default_value=LaunchConfiguration('qos'), description='Specific QoS used for gps input data: 0=system default, 1=Reliable, 2=Best Effort.'),

DeclareLaunchArgument('odom_log_level', default_value=LaunchConfiguration('log_level'), description='Specific ROS logger level for odometry node.'),

#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"]), ''.join(LaunchConfiguration('rgb_topic').perform(context)), LaunchConfiguration('compressed').perform(context)), description='Should not be modified manually!'),
Expand Down Expand Up @@ -182,7 +184,7 @@ def launch_setup(context, *args, **kwargs):
("rgbd_image", LaunchConfiguration('rgbd_topic_relay')),
("odom", LaunchConfiguration('odom_topic')),
("imu", LaunchConfiguration('imu_topic'))],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args")],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args"), "--ros-args", "--log-level", [LaunchConfiguration('namespace'), '.rgbd_odometry:=', LaunchConfiguration('odom_log_level')], "--log-level", ['rgbd_odometry:=', LaunchConfiguration('odom_log_level')]],
prefix=LaunchConfiguration('launch_prefix'),
namespace=LaunchConfiguration('namespace')),

Expand Down Expand Up @@ -217,7 +219,7 @@ def launch_setup(context, *args, **kwargs):
("rgbd_image", LaunchConfiguration('rgbd_topic_relay')),
("odom", LaunchConfiguration('odom_topic')),
("imu", LaunchConfiguration('imu_topic'))],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args")],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args"), "--ros-args", "--log-level", [LaunchConfiguration('namespace'), '.stereo_odometry:=', LaunchConfiguration('odom_log_level')], "--log-level", ['stereo_odometry:=', LaunchConfiguration('odom_log_level')]],
prefix=LaunchConfiguration('launch_prefix'),
namespace=LaunchConfiguration('namespace')),

Expand Down Expand Up @@ -246,7 +248,7 @@ def launch_setup(context, *args, **kwargs):
("scan_cloud", LaunchConfiguration('scan_cloud_topic')),
("odom", LaunchConfiguration('odom_topic')),
("imu", LaunchConfiguration('imu_topic'))],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args")],
arguments=[LaunchConfiguration("args"), LaunchConfiguration("odom_args"), "--ros-args", "--log-level", [LaunchConfiguration('namespace'), '.icp_odometry:=', LaunchConfiguration('odom_log_level')], "--log-level", ['icp_odometry:=', LaunchConfiguration('odom_log_level')]],
prefix=LaunchConfiguration('launch_prefix'),
namespace=LaunchConfiguration('namespace')),

Expand Down Expand Up @@ -290,6 +292,7 @@ def launch_setup(context, *args, **kwargs):
"Mem/InitWMWithAllNodes": ConditionalText("true", "false", IfCondition(PythonExpression(["'", LaunchConfiguration('localization'), "' == 'true'"]))._predicate_func(context)).perform(context)
}],
remappings=[
("map", LaunchConfiguration('map_topic')),
("rgb/image", LaunchConfiguration('rgb_topic_relay')),
("depth/image", LaunchConfiguration('depth_topic_relay')),
("rgb/camera_info", LaunchConfiguration('camera_info_topic')),
Expand All @@ -307,7 +310,7 @@ def launch_setup(context, *args, **kwargs):
("fiducial_transforms", LaunchConfiguration('fiducial_topic')),
("odom", LaunchConfiguration('odom_topic')),
("imu", LaunchConfiguration('imu_topic'))],
arguments=[LaunchConfiguration("args")],
arguments=[LaunchConfiguration("args"), "--ros-args", "--log-level", [LaunchConfiguration('namespace'), '.rtabmap:=', LaunchConfiguration('log_level')], "--log-level", ['rtabmap:=', LaunchConfiguration('log_level')]],
prefix=LaunchConfiguration('launch_prefix'),
namespace=LaunchConfiguration('namespace')),

Expand Down Expand Up @@ -346,7 +349,7 @@ def launch_setup(context, *args, **kwargs):
("scan_cloud", LaunchConfiguration('scan_cloud_topic')),
("odom", LaunchConfiguration('odom_topic'))],
condition=IfCondition(LaunchConfiguration("rtabmap_viz")),
arguments=[LaunchConfiguration("gui_cfg")],
arguments=[LaunchConfiguration("gui_cfg"), "--ros-args", "--log-level", [LaunchConfiguration('namespace'), '.rtabmap_viz:=', LaunchConfiguration('log_level')], "--log-level", ['rtabmap_viz:=', LaunchConfiguration('log_level')]],
prefix=LaunchConfiguration('launch_prefix'),
namespace=LaunchConfiguration('namespace')),
Node(
Expand Down Expand Up @@ -391,6 +394,8 @@ def generate_launch_description():

DeclareLaunchArgument('use_sim_time', default_value='false', description='Use simulation (Gazebo) clock if true'),

DeclareLaunchArgument('log_level', default_value='info', description="ROS logging level (debug, info, warn, error). For RTAB-Map\'s logger level, use \"args\" argument."),

# 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('gui_cfg', default_value='~/.ros/rtabmap_gui.ini', description='Configuration path of rtabmap_viz.'),
Expand All @@ -399,6 +404,7 @@ def generate_launch_description():
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('map_frame_id', default_value='map', description='Output map frame id (TF).'),
DeclareLaunchArgument('map_topic', default_value='map', description='Map topic name.'),
DeclareLaunchArgument('publish_tf_map', default_value='true', description='Publish TF between map and odomerty.'),
DeclareLaunchArgument('namespace', default_value='rtabmap', description=''),
DeclareLaunchArgument('database_path', default_value='~/.ros/rtabmap.db', description='Where is the map saved/loaded.'),
Expand Down
16 changes: 8 additions & 8 deletions rtabmap_sync/include/rtabmap_sync/SyncDiagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ namespace rtabmap_sync {
class SyncDiagnostic {
public:
SyncDiagnostic(rclcpp::Node * node, double tolerance = 0.1, int windowSize = 5) :
node_(node),
diagnosticUpdater_(node),
frequencyStatus_(diagnostic_updater::FrequencyStatusParam(&targetFrequency_, &targetFrequency_, tolerance)),
timeStampStatus_(diagnostic_updater::TimeStampStatusParam()),
compositeTask_("Sync status"),
lastCallbackCalledStamp_(rtabmap_conversions::timestampFromROS(node_->now())-1),
targetFrequency_(0.0),
windowSize_(windowSize)
node_(node),
diagnosticUpdater_(node),
frequencyStatus_(diagnostic_updater::FrequencyStatusParam(&targetFrequency_, &targetFrequency_, tolerance), node->get_clock()),
timeStampStatus_(diagnostic_updater::TimeStampStatusParam(), node->get_clock()),
compositeTask_("Sync status"),
lastCallbackCalledStamp_(rtabmap_conversions::timestampFromROS(node_->now())-1),
targetFrequency_(0.0),
windowSize_(windowSize)
{
UASSERT(windowSize_ >= 1);
}
Expand Down

0 comments on commit 54f9ec9

Please sign in to comment.