|
2 | 2 | import plotly.express as px |
3 | 3 | import plotly.io as pio |
4 | 4 | from data_loading import load |
| 5 | +from dataset import FallenDataset |
5 | 6 |
|
6 | 7 |
|
7 | 8 | def main(): |
8 | 9 | pio.renderers.default = "browser" |
9 | | - data = load("data.parquet") |
10 | | - # px.scatter( |
11 | | - # data, x="time", y="Control.main_outputs.fall_state", color="robot_identifier" |
12 | | - # ).show() |
| 10 | + |
| 11 | + df = load("data.parquet") |
| 12 | + dataset = FallenDataset( |
| 13 | + df, |
| 14 | + group_keys=["robot_identifier", "match_identifier"], |
| 15 | + features=[ |
| 16 | + pl.col("Control.main_outputs.robot_orientation.pitch"), |
| 17 | + pl.col("Control.main_outputs.robot_orientation.roll"), |
| 18 | + pl.col("Control.main_outputs.robot_orientation.yaw"), |
| 19 | + pl.col("Control.main_outputs.has_ground_contact"), |
| 20 | + ], |
| 21 | + ) |
| 22 | + dataset.to_windowed(window_stride=1 / 83) |
| 23 | + |
| 24 | + df = ( |
| 25 | + dataset.input_data.hstack(dataset.labels) |
| 26 | + .with_row_index() |
| 27 | + .hstack( |
| 28 | + dataset.input_data.select( |
| 29 | + pl.col( |
| 30 | + "Control.main_outputs.robot_orientation.pitch" |
| 31 | + ).list.last() |
| 32 | + ).rename({"Control.main_outputs.robot_orientation.pitch": "pitch"}) |
| 33 | + ) |
| 34 | + ) |
| 35 | + print(df) |
| 36 | + # print(df[0, 0].shape) |
| 37 | + |
13 | 38 | # px.scatter( |
14 | | - # data.filter(pl.col("robot_identifier") == "10.1.24.33"), |
| 39 | + # data, |
15 | 40 | # x="time", |
16 | | - # y="Control.main_outputs.robot_orientation.pitch", |
17 | | - # color="Control.main_outputs.fall_state", |
| 41 | + # y="Control.main_outputs.fall_state", |
| 42 | + # color="robot_identifier", |
18 | 43 | # ).show() |
| 44 | + print( |
| 45 | + df.select( |
| 46 | + pl.col("Control.main_outputs.robot_orientation.pitch").list.last() |
| 47 | + ) |
| 48 | + ) |
| 49 | + px.scatter( |
| 50 | + df, # .filter(pl.col("robot_identifier") == "10.1.24.33"), |
| 51 | + x="index", |
| 52 | + y="pitch", |
| 53 | + color="labels", |
| 54 | + ).show() |
19 | 55 |
|
20 | 56 |
|
21 | 57 | if __name__ == "__main__": |
|
0 commit comments