better_launch.wrapper module

better_launch.wrapper.launch_this(launch_func: Callable = None, *, ui: bool = False, colormode: Colormode = Colormode.DEFAULT, print_limit: int = 0, screen_log_level: str | int = 20, screen_log_format: str = '[{levelcolor_start}{levelname}{levelcolor_end}] [{sourcecolor_start}{name}{sourcecolor_end}] [{asctime}]\n{message}', file_log_level: str | int = 20, file_log_format: str = '[{levelname}] [{asctime}] {message}', manage_foreign_nodes: bool = False, join: bool = True, keep_alive: bool = False)

Use this to decorate your launch function. The function will be run automatically. The function is allowed to block even when using the UI.

NOTE: this decorator cannot be used more than once per module.

Parameters

launch_funcCallable, optional

Your launch function, typically using BetterLaunch to start ROS2 nodes.

uibool, optional

Whether to start the better_launch TUI. Superseded by the BL_UI environment variable and the –bl_ui_override argument.

colormodeColormode, optional

Decides what colors will be used for: * default: one color per log severity level and a single color for all message sources * severity: one color per log severity, don’t colorize message sources * source: one color per message source, don’t colorize log severity * none: don’t colorize anything * rainbow: colorize log severity and give each message source its own color Superseded by the BL_COLORMODE environment variable and the –bl_colormode_override argument.

print_limitint, optional

Limit the length of messages printed to the screen.

screen_log_levelstr | int, optional

The minimum level for log messages to be printed to the terminal/screen. Can be either “info”, “warning”, “error”, “critical”, or an arbitrary integer (e.g. logging.WARNING).

screen_log_formatstr, optional

Customize how log output will be formatted when printing it to the screen. Will be overridden by the BL_SCREEN_LOG_FORMAT environment variable. See [PrettyLogFormatter][better_launch.utils.better_logging.PrettyLogFormatter] for details.

file_log_levelstr | int, optional

The minimum level for log messages to be written to the lot file. Can be either “info”, “warning”, “error”, “critical”, or an arbitrary integer (e.g. logging.WARNING).

file_log_formatstr, optional

Customize how log output will be formatted when writing it to a file. Will be overridden by the BL_FILE_LOG_FORMAT environment variable. See [PrettyLogFormatter][better_launch.utils.better_logging.PrettyLogFormatter] for details.

manage_foreign_nodesbool, optional

If True, the TUI will also include node processes not started by this process. Has no effect if the TUI is not started.

joinbool, optional

If True, join the better_launch process. Has no effect when ui == True.

keep_alivebool, optional

If True, keep the process alive even when all nodes have stopped.