Nav2 Navigation Stack - rolling  main
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', 'kilted': 'noble'}
22 Prefixs = {'humble': 'H', 'jazzy': 'J', 'kilted': 'K'}
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_ros_common',
51  'nav2_route',
52  'nav2_rviz_plugins',
53  'nav2_simple_commander',
54  'nav2_smac_planner',
55  'nav2_smoother',
56  'nav2_system_tests',
57  'nav2_theta_star_planner',
58  'nav2_util',
59  'nav2_velocity_smoother',
60  'nav2_voxel_grid',
61  'nav2_waypoint_follower',
62 ]
63 
64 # Set which distributions you care about
65 Distros = ['humble', 'jazzy', 'kilted']
66 
67 
68 def getSrcPath(package: str, prefix: str, OS: str) -> str:
69  return f'https://build.ros2.org/job/{prefix}src_u{OS[0]}__{package}__ubuntu_{OS}__source/'
70 
71 
72 def getBinPath(package: str, prefix: str, OS: str) -> str:
73  return (
74  f'https://build.ros2.org/job/{prefix}bin_u{OS[0]}64__{package}__ubuntu_{OS}_'
75  'amd64__binary/'
76  )
77 
78 
79 def createPreamble(Distros: list[str]) -> str:
80  table = '| Package | '
81  for distro in Distros:
82  table += distro + ' Source | ' + distro + ' Debian | '
83  table = table[:-1] # Remove the last space
84  table += '\n'
85  table += '| :---: |'
86  for distro in Distros:
87  table += ' :---: | :---: |'
88  return table
89 
90 
91 def main() -> None:
92  header = createPreamble(Distros)
93 
94  body = ''
95  for package in Packages:
96  entry = f'| {package} | '
97  for distro in Distros:
98  # TODO check if website exists with requests
99  prefix = Prefixs[distro]
100  OS = OSs[distro]
101  srcURL = getSrcPath(package, prefix, OS)
102  binURL = getBinPath(package, prefix, OS)
103  response = requests.get(srcURL)
104  # Check if package isn't in a given distribution
105  if response.status_code != 200:
106  entry += 'N/A | N/A | '
107  else:
108  entry += f'[![Build Status]({srcURL}badge/icon)]({srcURL}) | '
109  entry += f'[![Build Status]({binURL}badge/icon)]({binURL}) | '
110  entry = entry[:-1]
111  entry += '\n'
112  body += entry
113 
114  # Special case for Opennav Docking for directory structure of Nav2
115  body = body.replace('| opennav_docking |', '| nav2_docking |')
116  # Special case for reducing the label length
117  body = body.replace('| nav2_regulated_pure_pursuit_controller |',
118  '| nav2_regulated_pure_pursuit |')
119 
120  print(header + '\n' + body)
121 
122 
123 if __name__ == '__main__':
124  main()