Do not require LDS_MODEL to be set in robot.launch.py - #1152
Open
mmporong wants to merge 1 commit into
Open
Conversation
The Bringup page of the e-Manual documents the startup sequence as
export TURTLEBOT3_MODEL=burger
ros2 launch turtlebot3_bringup robot.launch.py
and never mentions LDS_MODEL. Following it exactly fails before any node
starts:
KeyError: 'LDS_MODEL'
InvalidFrontendLaunchFileError: The launch file may have a syntax error,
or its format is unknown
The second line is misleading, since the launch file is fine and only an
environment variable is missing.
robot.launch.py already defines what to do with an unrecognised LDS_MODEL:
the final else branch selects hls_lfcd_lds_driver, the same driver as the
'LDS-01' branch. An unset variable is the only case that raises instead of
reaching that fallback. Reading it with os.environ.get() lets None fall into
the existing else branch, which is also consistent with the ROS_DISTRO lookup
two lines above.
Explicit values are unaffected: 'LDS-02' still selects ld08_driver and
'LDS-03' still selects coin_d4_driver.
Signed-off-by: mmporong <mmporong@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: Fixes #1151. The e-Manual bringup steps (
export TURTLEBOT3_MODEL=burgerthen
ros2 launch turtlebot3_bringup robot.launch.py) never setLDS_MODEL, sofollowing the documentation raises
KeyError: 'LDS_MODEL'together with themisleading
InvalidFrontendLaunchFileError: The launch file may have a syntax error.Fix: one line.
This relies on behaviour the file already has. The final
elsebranch selectshls_lfcd_lds_driver, the same driver as the'LDS-01'branch, so an unrecognisedvalue is already treated as LDS-01. Only an unset variable raised before reaching that
fallback. It also matches the
ROS_DISTROlookup two lines above, which already usesos.environ.get().Verification:
ros-humble-turtlebot3-bringup2.3.6,TURTLEBOT3_MODEL=burger.LDS_MODELunsetKeyError: 'LDS_MODEL', nothing startsrobot_state_publisher,hlds_laser_publisher,turtlebot3_rosall startLDS_MODEL=LDS-01hls_lfcd_lds_driverLDS_MODEL=LDS-02ld08_driverLDS_MODEL=LDS-03coin_d4_driverIf you would rather keep the variable mandatory, the alternative is to raise a
RuntimeErrornaming the accepted values instead of letting theKeyErrorsurface. Iwent with
.get()because it makes the documented startup sequence work without adocumentation change, but I am happy to switch.