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