Skip to content

Commit

Permalink
Merge branch 'main' into moreesp32fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Jul 10, 2024
2 parents 350ed2a + 3863d3d commit 03a3f82
Show file tree
Hide file tree
Showing 182 changed files with 7,682 additions and 4,631 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
hugo-version: "0.128.2"
extended: true

- name: Build
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/get_modular_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ async def main():

# Deleting documents that didn't get updated (presumably deleted)
try:
typesense_client.collections['resources'].documents.delete({'filter_by': 'last_updated: <' + time_now + ',module_id: !builtin' })
typesense_client.collections['mlmodels'].documents.delete({'filter_by': 'last_updated: <' + time_now})
res = typesense_client.collections['resources'].documents.delete({'filter_by': 'last_updated: <' + str(time_now)})
print("Resources deleted")
print(res)
res = typesense_client.collections['mlmodels'].documents.delete({'filter_by': 'last_updated: <' + str(time_now)})
print("ML models deleted")
print(res)
except Exception as e:
print(e)
pass


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-deploy-and-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
hugo-version: "0.128.2"
extended: true

- name: Temp config
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/sdk_protos_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ board,GetPWM,get_pwm,PWM,pwm
board,SetPWM,set_pwm,SetPWM,setPwm
board,PWMFrequency,get_pwm_frequency,PWMFreq,pwmFrequency
board,SetPWMFrequency,set_pwm_frequency,SetPWMFreq,setPwmFrequency
board,AnalogReaderNames,analog_names,AnalogNames,
board,ReadAnalogReader,analog_by_name,AnalogByName,analogReaderValue
board,AnalogNames,analog_names,AnalogNames,
board,AnalogByName,analog_by_name,AnalogByName,analogReaderValue
## HACK: Omitting PySDK: write_analog, currently borked: https://python.viam.dev/autoapi/viam/components/board/client/index.html#viam.components.board.client.BoardClient.write_analog
board,WriteAnalog,,Write,writeAnalog
board,Write,,Write,writeAnalog
board,GetDigitalInterruptValue,digital_interrupt_by_name,DigitalInterruptByName,,
board,StreamTicks,,StreamTicks,streamTicks
board,StreamTicks,stream_ticks,StreamTicks,streamTicks
board,SetPowerMode,set_power_mode,SetPowerMode,setPowerMode
board,GetGeometries,get_geometries,,
## HACK: Board (python, go) provides additional helper functions, adding 5 pseudo-entries:
Expand Down Expand Up @@ -102,7 +102,7 @@ gantry,Close,close,Close,

## Generic Component
## NOTED:Generic Component in Go SDK doesn't appear to implement (inherit) these:
generic_component,DoCommand,do_command,,doCommand
generic_component,DoCommand,do_command,DoCommand,doCommand
generic_component,GetGeometries,get_geometries,,
## HACK: No proto for close, manually mapping:
## NOTED: Go SDK also missing Close, but we have it in our docs?:
Expand Down Expand Up @@ -230,7 +230,7 @@ data_manager,Close,,Close,

## Generic Service
## NOTED:Generic Component in Go SDK doesn't appear to implement (inherit) these:
generic_service,DoCommand,do_command,,
generic_service,DoCommand,do_command,DoCommand,
## HACK: No proto for close, manually mapping:
## NOTED: Go SDK also missing Close, but we have it in our docs?:
generic_service,Close,close,,
Expand Down Expand Up @@ -420,6 +420,7 @@ data_sync,StreamingDataCaptureUpload,streaming_data_capture_upload,,

## MLTraining
mltraining,SubmitTrainingJob,submit_training_job,,
mltraining,SubmitCustomTrainingJob,submit_custom_training_job,,
mltraining,GetTrainingJob,get_training_job,,
mltraining,ListTrainingJobs,list_training_jobs,,
mltraining,CancelTrainingJob,cancel_training_job,,
Expand All @@ -444,7 +445,7 @@ robot,StopAll,stop_all,StopAll,
robot,StartSession,,,
robot,SendSessionHeartbeat,,,
robot,Log,log,,
robot,GetCloudMetadata,get_cloud_metadata,GetCloudMetadata,getCloudMetadata
robot,GetCloudMetadata,get_cloud_metadata,CloudMetadata,getCloudMetadata
## HACK: Robot (python) provides additional helper function, adding 4 pseudo-entries:
robot,Options.with_api_key,with_api_key,,
robot,AtAddress,at_address,,atAddress
Expand Down
61 changes: 46 additions & 15 deletions .github/workflows/update_sdk_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@
"bool": "https://docs.python.org/3/library/stdtypes.html#boolean-type-bool",
"datetime.datetime": "https://docs.python.org/3/library/datetime.html",
"datetime.timedelta": "https://docs.python.org/3/library/datetime.html#timedelta-objects",
## Third-party data types:
"numpy.typing.NDArray": "https://numpy.org/doc/stable/reference/typing.html#numpy.typing.NDArray",
## Viam-specific data types:
"viam.proto.app.OrganizationMember": "https://python.viam.dev/autoapi/viam/proto/app/index.html#viam.proto.app.OrganizationMember",
"viam.proto.app.OrganizationInvite": "https://python.viam.dev/autoapi/viam/proto/app/index.html#viam.proto.app.OrganizationInvite",
Expand Down Expand Up @@ -725,7 +727,10 @@ def parse(type, names):
pass

## Scrape each parent method tag and all contained child tags for Go by resource:
if sdk == "go" and type != "app":
## Skip Go: App (Go has no App client) and the generic component and service, which
## require explicit in-script workaround (DoCommand neither inherited (from resource.Resource)
## nor explicitly defined in-interface (not in Go docs, only in un-doc'd code):
if sdk == "go" and type != "app" and resource != "generic_component" and resource != "generic_service":

soup = make_soup(url)

Expand Down Expand Up @@ -936,6 +941,20 @@ def parse(type, names):
## in its entirety to the all_methods dictionary using "go" as the key:
all_methods["go"] = go_methods

## Assemble workaround data object for DoCommand for Go generic component and service.
## Using code sample and method_link from resource.Resource, because these cannot be found
## in Go docs for these resources:
elif sdk == "go" and (resource == "generic_component" or resource == "generic_service"):

go_methods[type][resource]['DoCommand'] = {}
go_methods[type][resource]['DoCommand'] = {'proto': 'DoCommand', \
'description': 'DoCommand sends/receives arbitrary data.', \
'usage': 'DoCommand(ctx <a href="/context">context</a>.<a href="/context#Context">Context</a>, cmd map[<a href="/builtin#string">string</a>]interface{}) (map[<a href="/builtin#string">string</a>]interface{}, <a href="/builtin#error">error</a>)', \
'method_link': 'https://pkg.go.dev/go.viam.com/rdk/resource#Resource', \
'code_sample': '// This example shows using DoCommand with an arm component.\nmyArm, err := arm.FromRobot(machine, "my_arm")\n\ncommand := map[string]interface{}{"cmd": "test", "data1": 500}\nresult, err := myArm.DoCommand(context.Background(), command)\n'}

all_methods["go"] = go_methods

elif sdk == "go" and type == "app":
##Go SDK has no APP API!
pass
Expand Down Expand Up @@ -1089,7 +1108,7 @@ def parse(type, names):
this_method_parameters_dict['param_usage'] = strong_tag.parent.text.replace("\n", " ")

## Some params provide data type links in Parameters section only, not initial usage.
## Get that here if soL
## Get that here if so:
if strong_tag.parent.find('a', class_="reference internal"):
param_type_link_raw = strong_tag.parent.find('a', class_="reference internal").get("href")
## Parameter type link is an anchor link:
Expand Down Expand Up @@ -1522,8 +1541,14 @@ def format_method_usage(parsed_usage_string, go_method_name, resource, path_to_m
param_or_return_description = ''
## Param override:
if type_name != '':
# To handle 'ch chan' param name, similar. Use as 'ch' in override filename:
if ' ' in type_name:
type_name_short = type_name.split(' ')[0]
else:
type_name_short = type_name

## .../overrides/methods/{sdk}.{resource}.{method_name}.{param_name}.md
param_desc_override_file = path_to_methods_override + '/go.' + resource + '.' + go_method_name + '.' + type_name + '.md'
param_desc_override_file = path_to_methods_override + '/go.' + resource + '.' + go_method_name + '.' + type_name_short + '.md'
## Return override:
else:
if 'map[string]interface{}' in param_type:
Expand Down Expand Up @@ -1557,8 +1582,9 @@ def format_method_usage(parsed_usage_string, go_method_name, resource, path_to_m
## If we have a param description override, use that. If not, skip:
if param_or_return_description != '':

## Add a trailing period if it is missing, either from upstream or from override file:
if not param_or_return_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not param_or_return_description.endswith('.') and not param_or_return_description.endswith('>'):
param_or_return_description = param_or_return_description + '.'

## Format returns:
Expand Down Expand Up @@ -1793,8 +1819,9 @@ def write_markdown(type, names, methods):

if param_description:

## Add a trailing period if it is missing, either from upstream or from override file:
if not param_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not param_description.endswith('.') and not param_description.endswith('>'):
param_description = param_description + '.'

output_file.write(f": {param_description}")
Expand Down Expand Up @@ -1838,8 +1865,9 @@ def write_markdown(type, names, methods):

if return_description:

## Add a trailing period if it is missing, either from upstream or from override file:
if not return_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not return_description.endswith('.') and not return_description.endswith('>'):
return_description = return_description + '.'

output_file.write(f": {return_description}\n")
Expand All @@ -1858,8 +1886,9 @@ def write_markdown(type, names, methods):
output_file.write(f"- ({raises_type})")
if "raises_description" in raises_object[raises_type]:
raises_description= raises_object[raises_type]["raises_description"]
## Add a trailing period if it is missing:
if not raises_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not raises_description.endswith('.') and not raises_description.endswith('>'):
raises_description = raises_description + '.'

output_file.write(f": {raises_description}\n")
Expand Down Expand Up @@ -2039,8 +2068,9 @@ def write_markdown(type, names, methods):

if param_description:

## Add a trailing period if it is missing, either from upstream or from override file:
if not param_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not param_description.endswith('.') and not param_description.endswith('>'):
param_description = param_description + '.'

output_file.write(f": {param_description}")
Expand Down Expand Up @@ -2092,8 +2122,9 @@ def write_markdown(type, names, methods):

if return_description:

## Add a trailing period if it is missing, either from upstream or from override file:
if not return_description.endswith('.'):
## Add a trailing period if it is missing, either from upstream or from override file,
## but skip doing so if the copy instead ends with an HTML tag (like a closing '</ul>' tag):
if not return_description.endswith('.') and not return_description.endswith('>'):
return_description = return_description + '.'

output_file.write(f": {return_description}\n")
Expand Down
Binary file removed assets/components/camera/configure-velodyne.png
Binary file not shown.
Binary file added assets/get-started/quickstarts/add-machine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/get-started/quickstarts/configure-pi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 03a3f82

Please sign in to comment.