moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
create_readme_table.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright 2021 PickNik Inc.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11#
12# * Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15#
16# * Neither the name of the PickNik Inc. nor the names of its
17# contributors may be used to endorse or promote products derived from
18# this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE.
31
32# Usage: python moveit/moveit/scripts/create_readme_table.py > /tmp/table.md
33# First update supported_distro_ubuntu_dict below!
34
35
36from __future__ import print_function
37
38import os
39import sys
40
41from catkin_pkg.packages import find_packages
42import requests
43
44
45def create_header(ros_ubuntu_dict):
46 ros_distros = sorted(ros_ubuntu_dict.keys())
47 section_header = "### ROS Buildfarm\n"
48 header = "MoveIt Package"
49 header_lines = "-" * len(header)
50 for ros in ros_distros:
51 source = " ".join([ros.capitalize(), "Source"])
52 debian = " ".join([ros.capitalize(), "Debian"])
53 header = " | ".join([header, source, debian])
54 header_lines = " | ".join([header_lines, "-" * len(source), "-" * len(debian)])
55 return "\n".join([section_header, header, header_lines])
56
57
58def define_urls(target, params):
59 if target == "src":
60 params["job"] = "{R}src_u{U}__{package}__ubuntu_{ubuntu}__source".format(
61 **params
62 )
63 params["url"] = "{base_url}/view/{R}src_u{U}/job/{job}".format(**params)
64 elif target == "bin":
65 params[
66 "job"
67 ] = "{R}bin_u{U}64__{package}__ubuntu_{ubuntu}_amd64__binary".format(**params)
68 params["url"] = "{base_url}/view/{R}bin_u{U}64/job/{job}".format(**params)
69
70
71def create_line(package, ros_ubuntu_dict):
72 ros_distros = sorted(ros_ubuntu_dict.keys())
73 line_format = " | [![Build Status]({base_url}/buildStatus/icon?job={job})]({url})"
74 line = "\n" + package
75 print(package, file=sys.stderr)
76 for ros in ros_distros:
77 ubuntu = ros_ubuntu_dict[ros]
78 params = {
79 "R": ros[0].upper(),
80 "U": ubuntu[0].upper(),
81 "ubuntu": ubuntu.lower(),
82 "package": package,
83 "base_url": "https://build.ros.org",
84 }
85 for target in ["src", "bin"]:
86 define_urls(target, params)
87 response = requests.get(params["url"]).status_code
88 # we want to show a particular OS's badges to indicate they are not
89 # released / working yet
90 if response < 400 or ubuntu == "focal": # success
91 line += line_format.format(**params)
92 else: # error
93 line += " | "
94 print(
95 " {}: {} {}".format(ros, response, params["url"]), file=sys.stderr
96 )
97
98 return line
99
100
102 """Create MoveIt buildfarm badge table."""
103 # Update the following dictionary with the appropriate ROS-Ubuntu
104 # combinations for supported distribitions. For instance, in Noetic,
105 # remove {"indigo":"trusty"} and add {"noetic":"fbuntu"} with "fbuntu"
106 # being whatever the 20.04 distro is named
107 supported_distro_ubuntu_dict = {
108 "melodic": "bionic",
109 "noetic": "focal",
110 }
111
112 all_packages = sorted(
113 package.name for _, package in find_packages(os.getcwd()).items()
114 )
115 moveit_packages = []
116 other_packages = []
117 for package in all_packages:
118 if package.startswith("moveit"):
119 moveit_packages.append(package)
120 else:
121 other_packages.append(package)
122 moveit_packages.extend(other_packages)
123
124 buildfarm_table = create_header(supported_distro_ubuntu_dict)
125 for package in moveit_packages:
126 buildfarm_table += create_line(package, supported_distro_ubuntu_dict)
127 print(buildfarm_table)
128
129
130if __name__ == "__main__":
create_line(package, ros_ubuntu_dict)
define_urls(target, params)
create_header(ros_ubuntu_dict)
void print(PropagationDistanceField &pdf, int numX, int numY, int numZ)