Casper: the reader of the CASPER recording¶
Casper(path).stream(columns, start_h, stop_h) reads the recording of an industrial robot arm from a local copy of the CASPER dataset. The library does not ship the data, so this page has no example that runs without it. The overview of the section is on Datasets.
What it reads¶
Casper(path).stream(columns, start_h, stop_h)readsright_arm.csvfrom a local copy of the CASPER dataset (Kayan et al. 2023, section III-A: a UR3e arm logged at about 20 Hz, a 24-hour test with about half of the samples anomalous); hours are counted from the first timestamp. The code repository of the dataset is MIT (https://github.com/hkayann/CASPER-PerCom), the data are CC BY-SA 4.0 (https://www.kaggle.com/datasets/hkayan/industrial-robotic-arm-anomaly-detection); the library reads the user's copy and redistributes nothing.
API reference¶
casper ¶
CASPER dataset: a UR3e robot arm moving in a pick-and-place loop.
The dataset is from Kayan, H., Rana, O., Burnap, P., Perera, C. (2023), "CASPER: Context-Aware Anomaly Detection System for Industrial Robotic Arms", arXiv:2303.01300. A Universal Robots UR3e performs a repetitive pick-and-place task; the data are logged at about 20 Hz, and the test set is 24 hours long with about 50% anomalous samples (section III-A of the paper). The user passes a folder containing a Kaggle copy of the recording (https://www.kaggle.com/datasets/hkayan/industrial-robotic-arm-anomaly-detection); the library never redistributes the data.
Expected columns: Timestamp in seconds, plus joint columns such as
"Actual Joint Velocities" whose cells hold a six-element Python list
literal, e.g. "[0.1, -0.2, 0.3, 0.0, 0.4, -0.5]". The joint columns
listed in :meth:stream are expanded into six channels each
(<name>_0, ..., <name>_5).
Licences: the code repository is MIT (Copyright (c) 2023 hkayann, https://github.com/hkayann/CASPER-PerCom); the Kaggle dataset is CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/), attribution to Kayan et al. 2023.
Examples:
Casper ¶
Casper(
path: str | Path,
time_col: str = "Timestamp",
file: str = "right_arm.csv",
target_col: str | None = None,
)
CASPER UR3e joint stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
folder containing the CSV files. |
required |
time_col
|
str
|
name of the timestamp column, in seconds. Default
|
'Timestamp'
|
file
|
str
|
name of the CSV file inside |
'right_arm.csv'
|
target_col
|
str | None
|
name of the label column, if present. Default
|
None
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
if the file does not exist. |
Examples:
Source code in dense_armor/core/signals/datasets/casper.py
stream ¶
stream(
columns: list[str],
start_h: float | None = None,
stop_h: float | None = None,
) -> Iterator[tuple[Signal, Any]]
Iterate the joint stream, in time order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list[str]
|
names of the joint columns to expand; each cell holds a six-element list literal and becomes six channels. |
required |
start_h
|
float | None
|
skip rows before |
None
|
stop_h
|
float | None
|
stop as soon as a row goes past |
None
|
Yields:
| Type | Description |
|---|---|
tuple[Signal, Any]
|
|
Source code in dense_armor/core/signals/datasets/casper.py
n_rows ¶
Number of data rows in the CSV file.
Details¶
- Source: Kayan, H., Rana, O., Burnap, P., Perera, C. (2023), "CASPER: Context-aware anomaly detection system for industrial robotic arms".