# Instruction of Dataset Obstacle Avoidance

**Authors:** Zenjie Zhang, Jayden Hong

## Data format

- This dataset contains 544 `.csv` files. Each file records one human hand trajectory with a fixed initial position, a random goal, and a random obstacle.
- Each `.csv` file contains a dataframe that records the main information of the hand trajectory. The concerned colunms are:
  - **time**: the real time stamps of the trajectory, with a sampling time $0.01$ s.
  - **x_hand**, **y_hand**, **z_hand**: the realtime hand position in the local tracking coordinate.
  - **x_obstacle**, **y_obstacle**, **z_obstacle**: the position of the obstacle in the local tracking coordinate. It is static for a certain hand trajectory.

*Note that the local tracking coordinate needs to be transformed to the task space. Please refer to the following section for how to retrieve the hand trajectories and obstacle positions.*

## Retriving Hand Trajectories

- *Step 1*: load the file to a dataframe:

```
import pandas as pd
df = pd.read_csv(file_name)
```

Here, `file_name` is the full path of a certain `.csv` data file. The output `df` is the dataframe that contains the data loaded from the file.

- *Step 2*: retrieve the trajectory

```
from retrieve_traj import retrieve_traj
traj_len, traj_pos, traj_vel, obst_pos = retrieve_traj(df)
```

Here, `retrieve_traj` is the module provided together with this dataset and `df` is the dataframe created from the last step. As for the outputs, `traj_len` is an integer to denote the length of the trajectory, `traj_pos` and `traj_vel` are lists (sized 3xtraj_len) that contain the realtime position and velocity of the trajectory, and `obst_pos` is the position of the static obstacle (sized 3x1).

- *Step 3*: retrieve the corresponding initial and goal positions

```
import numpy as np
init_pos = np.transpose(traj_pos)[0]
goal_pos = np.transpose(traj_pos)[-1]
```

- *Step 4*: draw the demo trajectory and obstacle

```
from draw_traj import draw_traj
draw_traj(traj_pos, init_pos, goal_pos, obst_pos)
```

