Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
transforms.launch.py
Go to the documentation of this file.
1# Copyright (C) 2022 LEIDOS.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15from launch import LaunchDescription
16from launch_ros.actions import Node
17from carma_ros2_utils.launch.get_current_namespace import GetCurrentNamespace
18from launch.substitutions import LaunchConfiguration
19from launch.actions import DeclareLaunchArgument
20
21import os
22
23
25 """
26 Launch robot_state_publisher to read in URDF file
27 """
28 use_sim_time = LaunchConfiguration('use_sim_time')
29 declare_use_sim_time_arg = DeclareLaunchArgument(
30 name = 'use_sim_time',
31 default_value = "False",
32 description = "True if simulation mode is on"
33 )
34
35 # Since the file needs to be actually read a substition does not work here
36 # For now the path must be hardcoded so it can be read into a string and passed as a parameter
37 with open('/opt/carma/vehicle/calibration/urdf/carma.urdf', 'r') as in_file:
38 robot_description = in_file.read()
39
40 start_robot_state_publisher_cmd = Node(
41 package='robot_state_publisher',
42 executable='robot_state_publisher',
43 name='robot_state_publisher',
44 namespace=GetCurrentNamespace(),
45 parameters=[
46 {'robot_description': robot_description},
47 {"use_sim_time" : use_sim_time}
48 ]
49 )
50
51 return LaunchDescription([
52 start_robot_state_publisher_cmd,
53 declare_use_sim_time_arg
54 ])
def generate_launch_description()