forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
69 lines (51 loc) · 2.28 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import copy
from jetson_containers import L4T_VERSION
from .version import ROS_DISTROS, ROS2_DISTROS, ROS_PACKAGES
# add permutations of ROS distros/packages as subpackages
template = package.copy()
template['group'] = 'ros'
template['depends'] = ['cuda', 'cudnn', 'tensorrt', 'opencv', 'cmake']
template['postfix'] = f"l4t-r{L4T_VERSION}"
template['docs'] = "docs.md"
package = []
for ROS_DISTRO in ROS_DISTROS:
for ROS_PACKAGE in ROS_PACKAGES:
pkg = copy.deepcopy(template)
pkg['name'] = f"ros:{ROS_DISTRO}-{ROS_PACKAGE.replace('_', '-')}"
pkg['build_args'] = {
'ROS_VERSION': ROS_DISTRO,
'ROS_PACKAGE': ROS_PACKAGE
}
if ROS_DISTRO == 'melodic':
pkg['dockerfile'] = 'Dockerfile.ros.melodic'
pkg['test'] = 'test_ros.sh'
pkg['requires'] = '<34' # melodic is for 18.04 only
pkg['notes'] = 'ROS Melodic is for JetPack 4 only'
pkg['depends'].remove('opencv') # melodic apt packages install the ubuntu opencv
pkg['depends'][0] = 'cmake:apt' # melodic (python 2.7) doesn't like pip-based cmake
elif ROS_DISTRO == 'noetic':
pkg['dockerfile'] = 'Dockerfile.ros.noetic'
pkg['test'] = 'test_ros.sh'
else:
pkg['dockerfile'] = 'Dockerfile.ros2'
pkg['test'] = 'test_ros2.sh'
package.append(pkg)
def ros_container(name, *packages, distros=ROS2_DISTROS, base_packages='desktop'):
if not isinstance(distros, (list, tuple)):
distros = [distros]
if not isinstance(packages, (list, tuple)):
packages = [packages]
if not isinstance(base_packages, (list, tuple)):
base_packages = [base_packages]
packages = ' '.join(packages)
if not packages:
return
for distro in distros:
for base_package in base_packages:
pkg = template.copy()
pkg['name'] = f'ros:{distro}-{name}'
pkg['dockerfile'] = 'Dockerfile.ros2.extras'
pkg['depends'] = f"ros:{distro}-{base_package}"
pkg['build_args'] = {'ROS_PACKAGES': f'{packages}'}
package.append(pkg)
ros_container('foxglove', 'foxglove_bridge')