Skip to content
Snippets Groups Projects
Commit a07a5180 authored by Andi Gerken's avatar Andi Gerken
Browse files

Merge branch 'develop_marc' into develop

parents 7f07029f a2cca45d
No related branches found
No related tags found
No related merge requests found
import pandas as pd
import numpy as np
import robofish.io
def convertTrajectory(path, save_path):
ar = pd.read_csv(path, sep=";").to_numpy()
new = robofish.io.File(world_size=[100, 100])
# convert orientation from radians to orientation vector
ori_vec = np.array([np.cos(ar[:, 2]), np.sin(ar[:, 2])]).T
print(ori_vec.shape)
# get new trajectory with x, y, ori_x, ori_y
temp = np.append(ar[:, [0, 1]], ori_vec, axis=1)
print(temp.shape)
# convert x,y from m to cm
temp[:, [0, 1]] = temp[:, [0, 1]] * 100
new.create_single_entity(type_="fish", name="fish_1", poses=temp, monotonic_step=50)
# convert orientation from radians to orientation vector
ori_vec = np.array([np.cos(ar[:, 5]), np.sin(ar[:, 5])]).T
# get new trajectory with x, y, ori_x, ori_y
temp = np.append(ar[:, [3, 4]], ori_vec, axis=1)
# convert x,y from m to cm
temp[:, [0, 1]] = temp[:, [0, 1]] * 100
new.create_single_entity(type_="fish", name="fish_2", poses=temp, monotonic_step=50)
new.validate()
new.save(save_path)
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment