Skip to content

Commit

Permalink
Merge pull request #43 from romaintha/rotation_issue
Browse files Browse the repository at this point in the history
fix issue when rotation is not provided in pose
  • Loading branch information
dancergraham authored Aug 12, 2024
2 parents 14342f8 + 383d39b commit cb9c5c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pye57/scan_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
from pye57.utils import get_fields, get_node

class ScanHeader:
"""Provides summary statistics for an individual lidar scan in an E57 file.
Including the number of points, bounds and pose of the scan.
"""
def __init__(self, scan_node):
self.node = scan_node
points = self.node["points"]
Expand All @@ -29,7 +33,11 @@ def rotation_matrix(self) -> np.array:

@property
def rotation(self) -> np.array:
q = Quaternion([e.value() for e in self.node["pose"]["rotation"]])
try:
rotation = self.node["pose"]["rotation"]
q = Quaternion([e.value() for e in rotation])
except KeyError:
q = Quaternion()
return q.elements

@property
Expand Down

0 comments on commit cb9c5c7

Please sign in to comment.