Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
update_readme_table.py
1 #!/usr/bin/python3
2 # Copyright (c) 2024 Open Navigation LLC
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 # This tool populates the README table of build status for each package
17 
18 import requests
19 
20 # Global information about current distributions, shouldn't need to update
21 OSs = {'humble': 'jammy', 'jazzy': 'noble'}
22 Prefixs = {'humble': 'H', 'jazzy': 'J'}
23 
24 # Set your packages here
25 Packages = [
26  'navigation2',
27  'nav2_amcl',
28  'nav2_behavior_tree',
29  'nav2_behaviors',
30  'nav2_bringup',
31  'nav2_bt_navigator',
32  'nav2_collision_monitor',
33  'nav2_common',
34  'nav2_constrained_smoother',
35  'nav2_controller',
36  'nav2_core',
37  'nav2_costmap_2d',
38  'opennav_docking',
39  'nav2_dwb_controller', # Controller plugin for DWB packages
40  'nav2_graceful_controller',
41  'nav2_lifecycle_manager',
42  'nav2_loopback_sim',
43  'nav2_map_server',
44  'nav2_mppi_controller',
45  'nav2_msgs',
46  'nav2_navfn_planner',
47  'nav2_planner',
48  'nav2_regulated_pure_pursuit_controller',
49  'nav2_rotation_shim_controller',
50  'nav2_rviz_plugins',
51  'nav2_simple_commander',
52  'nav2_smac_planner',
53  'nav2_smoother',
54  'nav2_system_tests',
55  'nav2_theta_star_planner',
56  'nav2_util',
57  'nav2_velocity_smoother',
58  'nav2_voxel_grid',
59  'nav2_waypoint_follower',
60 ]
61 
62 # Set which distributions you care about
63 Distros = ['humble', 'jazzy']
64 
65 
66 def getSrcPath(package: str, prefix: str, OS: str) -> str:
67  return f'https://build.ros2.org/job/{prefix}src_u{OS[0]}__{package}__ubuntu_{OS}__source/'
68 
69 
70 def getBinPath(package: str, prefix: str, OS: str) -> str:
71  return (
72  f'https://build.ros2.org/job/{prefix}bin_u{OS[0]}64__{package}__ubuntu_{OS}_'
73  'amd64__binary/'
74  )
75 
76 
77 def createPreamble(Distros: list[str]) -> str:
78  table = '| Package | '
79  for distro in Distros:
80  table += distro + ' Source | ' + distro + ' Debian | '
81  table += '\n'
82  table += '| :---: |'
83  for distro in Distros:
84  table += ' :---: | :---: |'
85  return table
86 
87 
88 def main() -> None:
89  header = createPreamble(Distros)
90 
91  body = ''
92  for package in Packages:
93  entry = f'| {package} | '
94  for distro in Distros:
95  # TODO check if website exists with requests
96  prefix = Prefixs[distro]
97  OS = OSs[distro]
98  srcURL = getSrcPath(package, prefix, OS)
99  binURL = getBinPath(package, prefix, OS)
100  response = requests.get(srcURL)
101  # Check if package isn't in a given distribution
102  if response.status_code != 200:
103  entry += 'N/A | N/A | '
104  else:
105  entry += f'[![Build Status]({srcURL}badge/icon)]({srcURL}) | '
106  entry += f'[![Build Status]({binURL}badge/icon)]({binURL}) | '
107  entry = entry[:-1]
108  entry += '\n'
109  body += entry
110 
111  # Special case for Opennav Docking for directory structure of Nav2
112  body = body.replace('| opennav_docking |', '| nav2_docking |')
113  # Special case for reducing the label length
114  body = body.replace('| nav2_regulated_pure_pursuit_controller |',
115  '| nav2_regulated_pure_pursuit |')
116 
117  print(header + '\n' + body)
118 
119 
120 if __name__ == '__main__':
121  main()