Skip to content

Commit

Permalink
[HotFix] Fix Ros2 launch file generator, the imports were missed
Browse files Browse the repository at this point in the history
  • Loading branch information
ipa-nhg committed Feb 8, 2024
1 parent 4b9f44a commit 569641c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ class LaunchFileCompiler_ROS2 {
def compile_toROS2launch(System system) '''
from launch import LaunchDescription
from launch_ros.actions import Node
«IF !getSubsystems(system).empty»from ament_index_python.packages import get_package_share_directory
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource«ENDIF»
«IF !getSubsystems(system).empty»from ament_index_python.packages import get_package_share_directory«ENDIF»
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PythonExpression, PathJoinSubstitution, TextSubstitution

def generate_launch_description():
ld = LaunchDescription()

«FOR component:getNodes(system)»«FOR parameter:component.rosparameters»
«parameter.name»_arg = DeclareLaunchArgument(
parameter.name»", default_value=TextSubstitution(text="«get_param_value(parameter.value,parameter.name)»")
)
ld.add_actionparameter.name»_arg)
«ENDFOR»«ENDFOR»

«FOR component:getNodes(system
Expand Down Expand Up @@ -72,7 +75,9 @@ def generate_launch_description():
ld.add_action(«(component as RosNode).name»)
«ENDFOR»«FOR subsystem:getSubsystems(system)»
ld.add_action(include_«subsystem.name»)
«ENDFOR»
«ENDFOR»«FOR component:getNodes(system)»«FOR parameter:component.rosparameters»
ld.add_action(«parameter.name»_arg)
«ENDFOR»«ENDFOR»

return ld
'''
Expand Down

0 comments on commit 569641c

Please sign in to comment.