Carma-platform v4.11.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.
carma_cloud_client_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"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# 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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15from ament_index_python import get_package_share_directory
16from launch import LaunchDescription
17from launch_ros.actions import ComposableNodeContainer
18from launch_ros.descriptions import ComposableNode
19from carma_ros2_utils.launch.get_current_namespace import GetCurrentNamespace
20
21import os
22import subprocess
23
24'''
25This file is can be used to launch the CARMA carma_cloud_client_node.
26 Though in carma-platform it may be launched directly from the base launch file.
27'''
28
29
30def open_tunnels():
31
32 REMOTE_USER="ubuntu"
33 REMOTE_ADDR="carma-cloud.com" # Dev instance is www.carma-cloud.com, prod instance is carma-cloud.com
34 KEY_FILE="carma-cloud-1.pem" # Dev key is carma-cloud-test-1.pem, prod key is carma-cloud-1.pem
35 HOST_PORT="33333" # This port is forwarded to remote host (carma-cloud)
36 REMOTE_PORT="22222" # This port is forwarded to local host
37
38 param_launch_path = os.path.join(
39 get_package_share_directory('carma_cloud_client'), 'launch/scripts')
40
41 cmd = param_launch_path + '/open_tunnels.sh'
42
43 subprocess.check_call(['chmod','u+x', cmd])
44
45 key_path = "/opt/carma/vehicle/calibration/cloud_permission"
46
47 key = key_path + '/' + KEY_FILE
48
49 subprocess.check_call(['sudo','chmod','400', key])
50 subprocess.check_call(['sudo', cmd, '-u', REMOTE_USER, '-a', REMOTE_ADDR, '-k', key, '-p', REMOTE_PORT, '-r', HOST_PORT])
51
52
54
56
57 # Get parameter file path
58 param_file_path = os.path.join(
59 get_package_share_directory('carma_cloud_client'), 'config/parameters.yaml')
60
61 # Launch node(s) in a carma container to allow logging to be configured
62 container = ComposableNodeContainer(
63 package='carma_ros2_utils',
64 name='carma_cloud_client_container',
65 namespace=GetCurrentNamespace(),
66 executable='carma_component_container_mt',
67 composable_node_descriptions=[
68
69 # Launch the core node(s)
70 ComposableNode(
71 package='carma_cloud_client',
72 plugin='carma_cloud_client::CarmaCloudClient',
73 name='carma_cloud_client',
74 extra_arguments=[
75 {'use_intra_process_comms': True},
76 ],
77 parameters=[ param_file_path ]
78 ),
79 ]
80 )
81
82 return LaunchDescription([
83 container
84 ])