Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ cython_debug/

# WEI
.wei

.pdm-python
.vscode
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
tags:
- ghcr.io/ad-sdl/camera_module:latest
- ghcr.io/ad-sdl/camera_module:dev
command: python camera_module/src/camera_rest_node.py --definition definitions/camera_node_template.node.yaml
command: python camera_module/src/camera_rest_node.py --node_definition definitions/camera_node_template.node.yaml
volumes:
- ./definitions:/home/madsci/definitions
privileged: true
Expand Down
263 changes: 111 additions & 152 deletions definitions/camera_node_template.node.info.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
node_name: camera_node_template
node_id: 01JPN93A0G54674CMHJ0N04PB2
node_url: null
node_description: A template for defining a camera node
node_id: 01K9T47YGD515GTRJJ0Y2HNR6F
node_description: null
node_type: device
module_name: camera_module
module_version: 0.0.1
module_name: camera_node
module_version: 3.0.0
capabilities:
get_info: true
get_state: true
get_status: true
send_action: true
get_action_status: true
get_action_result: true
get_action_history: true
action_files: true
Expand All @@ -18,13 +18,11 @@ capabilities:
get_resources: false
get_log: true
admin_commands:
- reset
- lock
- unlock
- reset
- shutdown
commands: {}
is_template: false
config_defaults: {}
- unlock
node_url: null
actions:
take_picture:
name: take_picture
Expand All @@ -45,126 +43,105 @@ actions:
default: null
locations: {}
files: {}
results: {}
results:
file:
result_label: file
description: null
result_type: file
blocking: false
asynchronous: true
accepts_var_args: false
accepts_var_kwargs: false
var_args_schema: null
var_kwargs_schema: null
read_barcode:
name: read_barcode
description: "\n Takes an image and returns the values of any barcodes\
\ present in the image. Camera focus can be adjusted using the provided parameters\
\ if necessary.\n\n Args:\n focus (Optional[int]): The desired\
\ focus value (used if autofocus is disabled).\n autofocus (Optional[bool]):\
\ Whether to enable or disable autofocus.\n\n Returns:\n A\
\ tuple containing:\n - The barcode string (empty if no barcode\
\ found)\n - Path to the captured image\n\n "
args:
focus:
name: focus
description: ''
argument_type: int
required: false
default: null
autofocus:
name: autofocus
description: ''
argument_type: bool
required: false
default: null
locations: {}
files: {}
results:
json_result:
result_label: json_result
description: null
result_type: json
json_schema:
properties:
data:
title: Data
type: string
required:
- data
title: strModel
type: object
file:
result_label: file
description: null
result_type: file
blocking: false
asynchronous: true
accepts_var_args: false
accepts_var_kwargs: false
var_args_schema: null
var_kwargs_schema: null
config:
node_definition: definitions/camera_node_template.node.yaml
node_info_path: null
update_node_files: true
status_update_interval: 2.0
state_update_interval: 2.0
event_client_config: null
resource_server_url: null
host: 127.0.0.1
port: 8000
protocol: http
node_url: http://parker.cels.anl.gov:2000/
uvicorn_kwargs: {}
camera_address: 0
config_schema:
$defs:
EventClientConfig:
description: Configuration for an Event Client.
properties:
name:
anyOf:
- type: string
- type: 'null'
default: null
description: The name of the event client.
title: Event Client Name
event_server_url:
anyOf:
- type: string
- type: 'null'
default: null
description: The URL of the event server.
title: Event Server URL
log_level:
default: 20
description: The log level of the event client.
title: Event Client Log Level
type: integer
source:
$ref: '#/$defs/OwnershipInfo'
description: Information about the source of the event client.
title: Source
log_dir:
anyOf:
- type: string
- format: path
type: string
description: The directory to store logs in.
title: Log Directory
title: EventClientConfig
type: object
OwnershipInfo:
description: Information about the ownership of a MADSci object.
properties:
user_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the user who owns the object.
title: User ID
experiment_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the experiment that owns the object.
title: Experiment ID
campaign_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the campaign that owns the object.
title: Campaign ID
project_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the project that owns the object.
title: Project ID
node_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the node that owns the object.
title: Node ID
workcell_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the workcell that owns the object.
title: Workcell ID
lab_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the lab that owns the object.
title: Lab ID
step_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the step that owns the object.
title: Step ID
workflow_id:
anyOf:
- type: string
- type: 'null'
default: null
description: The ID of the workflow that owns the object.
title: Workflow ID
title: OwnershipInfo
type: object
additionalProperties: true
description: Configuration for the camera node module.
properties:
node_definition:
anyOf:
- type: string
- format: path
type: string
- type: 'null'
default: default.node.yaml
description: Path to the node definition file to use. If set, the node will
load the definition from this file on startup. Otherwise, a default configuration
will be created.
title: Node Definition File
node_info_path:
anyOf:
- type: string
- format: path
type: string
- type: 'null'
default: null
description: Path to export the generated node info file. If not set, will use
the node name and the node_definition's path.
title: Node Info Path
update_node_files:
default: true
description: Whether to update the node definition and info files on startup.
If set to False, the node will not update the files even if they are out of
date.
title: Update Node Files
type: boolean
status_update_interval:
anyOf:
- type: number
Expand All @@ -179,42 +156,24 @@ config_schema:
default: 2.0
description: The interval in seconds at which the node should update its state.
title: State Update Interval
event_client_config:
anyOf:
- $ref: '#/$defs/EventClientConfig'
- type: 'null'
default: null
description: The configuration for a MADSci event client.
title: Event Client Configuration
resource_server_url:
anyOf:
- format: uri
minLength: 1
type: string
- type: 'null'
default: null
description: The URL of the resource server for this node to use.
title: Resource Client URL
host:
default: 127.0.0.1
description: The host of the REST API.
title: Host
type: string
port:
default: 8000
description: The port of the REST API.
title: Port
type: integer
protocol:
default: http
description: The protocol of the REST API, either 'http' or 'https'.
title: Protocol
node_url:
default: http://127.0.0.1:2000/
description: The URL used to communicate with the node. This is the base URL
for the REST API.
format: uri
minLength: 1
title: Node URL
type: string
uvicorn_kwargs:
additionalProperties: true
description: Configuration for the Uvicorn server that runs the REST API.
title: Uvicorn Configuration
type: object
camera_address:
anyOf:
- type: integer
- type: string
default: 0
title: Camera Address
title: CameraConfig
title: CameraNodeConfig
type: object
30 changes: 5 additions & 25 deletions definitions/camera_node_template.node.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
node_name: camera_node_template
node_id: 01JPN93A0G54674CMHJ0N04PB2
node_url: null
node_description: A template for defining a camera node
node_id: 01K9T47YGD515GTRJJ0Y2HNR6F
node_description: null
node_type: device
module_name: camera_module
module_version: 0.0.1
capabilities:
get_info: true
get_state: true
get_status: true
send_action: true
get_action_result: true
get_action_history: true
action_files: true
send_admin_commands: true
set_config: true
get_resources: false
get_log: true
admin_commands:
- reset
- lock
- unlock
- shutdown
commands: {}
is_template: false
config_defaults: {}
module_name: camera_node
module_version: 3.0.0
capabilities: null
Loading