Skip to content

Commit

Permalink
Merge pull request #6 from Passutte/fix/data-generation
Browse files Browse the repository at this point in the history
Use processed training data for re-running the data_generation.py pipeline
  • Loading branch information
MichaelFYang authored Oct 15, 2023
2 parents a3eb911 + f16719f commit ca43b62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions iplanner/data_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
parameters = json.load(json_file)

folder_name = parameters.get('folder_name', "CollectedData")
folder_path = os.path.join(*[os.getcwd(), "data"])
folder_path = os.path.join(*[root_folder, "data"])
ids_path = os.path.join(folder_path, "collect_list.txt")

if not folder_name == "":
Expand All @@ -33,7 +33,7 @@
print("Env List: ", env_list)

outfolder_name = parameters.get('outfolder_name', "TrainingData")
output_folder = os.path.join(*[os.getcwd(), "data", outfolder_name])
output_folder = os.path.join(*[root_folder, "data", outfolder_name])

image_type = parameters.get('image_type', "depth")
voxel_size = parameters.get('voxel_size', 0.05)
Expand Down
11 changes: 7 additions & 4 deletions iplanner/esdf_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,20 @@ def read_intrinsic(intrinsic_path):
with open(intrinsic_path) as f:
lines = f.readlines()
elems = np.fromstring(lines[0][1:-1], dtype=float, sep=', ')
P = np.array(elems).reshape(3, 4)
K = np.concatenate((P, np.array([0.0, 0.0, 0.0, 1.0]).reshape(1,-1)), axis=0)
if len(elems) == 12:
P = np.array(elems).reshape(3, 4)
K = np.concatenate((P, np.array([0.0, 0.0, 0.0, 1.0]).reshape(1,-1)), axis=0)
else:
K = np.array(elems).reshape(4, 4)
return K

@staticmethod
def read_extrinsic(extrinsic_path):
with open(extrinsic_path) as f:
lines = f.readlines()
elems = np.fromstring(lines[0][1:-1], dtype=float, sep=', ')
CT = np.array(elems[:3])
CR = R.from_quat(elems[3:])
CR = R.from_quat(elems[:4])
CT = np.array(elems[4:])
return CR, CT

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion src/data_collect_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def __colorInfoCallback(self, color_info, args):
return

def __writeExtrinstic(self, pos, ori, path, name):
extric_list = [pos[0], pos[1], pos[2], ori[0], ori[1], ori[2], ori[3]]
extric_list = [ori[0], ori[1], ori[2], ori[3], pos[0], pos[1], pos[2]]
open(path, 'w').close() # clear txt file
fc = open(path, 'w')
fc.writelines(str(extric_list))
Expand Down

0 comments on commit ca43b62

Please sign in to comment.