|
23 | 23 | ## at runtime if desired: |
24 | 24 | components = ["arm", "base", "board", "button", "camera", "encoder", "gantry", "generic_component", "gripper", |
25 | 25 | "input_controller", "motor", "movement_sensor", "power_sensor", "sensor", "servo", "switch", "audio_in", "audio_out"] |
26 | | -services = ["base_remote_control", "data_manager", "discovery", "generic_service", "mlmodel", "motion", "navigation", "slam", "vision", "world_state_store"] |
| 26 | +services = ["base_remote_control", "data_manager", "discovery", "generic_service", "mlmodel", "motion", "slam", "vision", "world_state_store"] |
27 | 27 | app_apis = ["app", "billing", "data", "dataset", "data_sync", "mltraining"] |
28 | 28 | robot_apis = ["robot"] |
29 | 29 |
|
|
279 | 279 | "name": "MotionServiceClient", |
280 | 280 | "methods": [] |
281 | 281 | }, |
282 | | - "navigation": { |
283 | | - "url": "https://raw.githubusercontent.com/viamrobotics/api/main/service/navigation/v1/navigation_grpc.pb.go", |
284 | | - "name": "NavigationServiceClient", |
285 | | - "methods": [] |
286 | | - }, |
287 | 282 | "slam": { |
288 | 283 | "url": "https://raw.githubusercontent.com/viamrobotics/api/main/service/slam/v1/slam_grpc.pb.go", |
289 | 284 | "name": "SLAMServiceClient", |
@@ -936,7 +931,7 @@ def write_markdown(type, names, methods): |
936 | 931 | ## Replace underscores, and convert generic_component to just generic: |
937 | 932 | resource_adjusted = resource.replace('generic_component', 'generic').replace('_','-') |
938 | 933 | proto_anchor_link = '/dev/reference/apis/components/' + resource_adjusted + '/#' + proto_link |
939 | | - elif type == 'service' and resource in ['base_remote_control', 'motion', 'navigation', 'slam', 'vision']: |
| 934 | + elif type == 'service' and resource in ['base_remote_control', 'motion', 'slam', 'vision']: |
940 | 935 | proto_anchor_link = '/dev/reference/apis/services/' + resource.replace('base_remote_control', 'base-rc') + '/#' + proto_link |
941 | 936 | elif type == 'service' and resource == 'data_manager': |
942 | 937 | proto_anchor_link = '/dev/reference/apis/services/data/#' + proto_link |
@@ -966,20 +961,28 @@ def write_markdown(type, names, methods): |
966 | 961 | ## first sentence: |
967 | 962 |
|
968 | 963 |
|
969 | | - with open(proto_override_file, 'r') as f: |
970 | | - file_contents = f.read().strip() |
971 | | - file_contents = regex.sub(r'\{\{\%.*\%\}\}.*\{\{\% \/[a-b].* \%\}\}', '', file_contents, flags=regex.DOTALL) |
972 | | - search_result = file_contents.split('.\n', 1)[0].strip().replace("\n", " ") |
973 | | - |
974 | | - ## If the proto description contains any MD links, strip them out: |
975 | | - search_result = regex.sub(r'\[([A-Za-z0-9\.\(\)\-\_\`\s]*)\]\([A-Za-z0-9\.\:\/\-\_\#]*\)', r'\1', search_result) |
976 | | - |
977 | | - ## If the proto description is missing a trailing period, or we stripped it off during the above matching, append |
978 | | - ## (restore) the period character: |
979 | | - if not search_result.endswith('.'): |
980 | | - proto_description_first_sentence = search_result + '.' |
981 | | - else: |
982 | | - proto_description_first_sentence = search_result |
| 964 | + if os.path.isfile(proto_override_file): |
| 965 | + with open(proto_override_file, 'r') as f: |
| 966 | + file_contents = f.read().strip() |
| 967 | + file_contents = regex.sub(r'\{\{\%.*\%\}\}.*\{\{\% \/[a-b].* \%\}\}', '', file_contents, flags=regex.DOTALL) |
| 968 | + search_result = file_contents.split('.\n', 1)[0].strip().replace("\n", " ") |
| 969 | + |
| 970 | + ## If the proto description contains any MD links, strip them out: |
| 971 | + search_result = regex.sub(r'\[([A-Za-z0-9\.\(\)\-\_\`\s]*)\]\([A-Za-z0-9\.\:\/\-\_\#]*\)', r'\1', search_result) |
| 972 | + |
| 973 | + ## If the proto description is missing a trailing period, or we stripped it off during the above matching, append |
| 974 | + ## (restore) the period character: |
| 975 | + if not search_result.endswith('.'): |
| 976 | + proto_description_first_sentence = search_result + '.' |
| 977 | + else: |
| 978 | + proto_description_first_sentence = search_result |
| 979 | + else: |
| 980 | + ## No proto description override file (for example a proto whose |
| 981 | + ## docs section was removed); leave the description blank instead |
| 982 | + ## of crashing on the missing file, but warn so a genuinely |
| 983 | + ## missing override (an authoring gap) is still surfaced. |
| 984 | + print(f"WARNING: {type} {resource} {proto} has no proto description override file ({proto_override_file}); leaving description blank") |
| 985 | + proto_description_first_sentence = '' |
983 | 986 |
|
984 | 987 | ## Write out this proto's entry to this resource's table_file: |
985 | 988 | if resource != 'movement_sensor': |
|
0 commit comments