5 from ament_index_python.packages
import get_package_share_directory
6 from launch
import LaunchDescription
7 from launch_ros.actions
import Node
8 from launch.actions
import DeclareLaunchArgument, ExecuteProcess, OpaqueFunction
9 from launch.substitutions
import LaunchConfiguration
14 transformer = pyproj.Transformer.from_crs(
"EPSG:4326",
"EPSG:" +
epsgCodeFromUtmZone(zone, is_northern))
15 return transformer.transform(lat, lon)
18 zone_number = int((lon + 180) // 6) + 1
19 is_northern = (lat >= 0)
20 return zone_number, is_northern
24 return f
"utm_{utm_zone}N"
26 return f
"utm_{utm_zone}S"
30 epsg_code = 32600 + utm_zone
32 epsg_code = 32700 + utm_zone
36 l = lon * math.pi / 180
38 l0 = (zone * 6 - 183) * math.pi / 180
39 phi = lat * math.pi / 180
40 return math.atan(math.tan(l - l0) * math.sin(phi))
47 lat = float(LaunchConfiguration(
"lat").perform(launch_context))
48 lon = float(LaunchConfiguration(
"lon").perform(launch_context))
63 parameters=[{
"use_sim_time": LaunchConfiguration(
"use_sim_time")}],
64 arguments=[
"-d", os.path.join(get_package_share_directory(
"etsi_its_rviz_plugins"),
"config/demo.rviz")],
71 executable=
"static_transform_publisher",
72 arguments=[
"--frame-id", utm_frame_name,
"--child-frame-id",
"map",
"--x", str(utm_x),
"--y", str(utm_y),
"--z",
"0.0",
"--roll",
"0.0",
"--pitch",
"0.0",
"--yaw", str(utm_conv_angle)],
77 cmd=[
"ros2",
"topic",
"pub",
"-r 0.1",
"/map_link/navsatfix",
"sensor_msgs/msg/NavSatFix", f
"{{header: {{stamp: {{sec: 0, nanosec: 0}}, frame_id: 'map'}}, latitude: {lat}, longitude: {lon}, altitude: 0.0}}"],
85 return LaunchDescription([
86 DeclareLaunchArgument(
"use_sim_time", default_value=
"false", description=
"use simulation time"),
87 DeclareLaunchArgument(
"lat", default_value=
"50.786750", description=
"reference position latitude (map frame)"),
88 DeclareLaunchArgument(
"lon", default_value=
"6.046295", description=
"reference position longitude (map frame)"),
89 OpaqueFunction(function=generate_launch_description_with_resolved_launch_args)