Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E57 element path well formed but not defined (ErrorPathUndefined) #58

Open
spro1976 opened this issue Apr 23, 2024 · 5 comments
Open

E57 element path well formed but not defined (ErrorPathUndefined) #58

spro1976 opened this issue Apr 23, 2024 · 5 comments

Comments

@spro1976
Copy link

spro1976 commented Apr 23, 2024

I had the error
File ".venv\lib\site-packages\pye57\e57.py", line 214, in read_scan xyz = self.to_global(xyz, header.rotation, header.translation) File ".venv\lib\site-packages\pye57\scan_header.py", line 32, in rotation q = Quaternion([e.value() for e in self.node["pose"]["rotation"]]) pye57.libe57.E57Exception: E57 element path well formed but not defined (ErrorPathUndefined)
for e57 files created from Recap and also the downloaded e57 sample file Trimble Data - Muliple Scans point cloud from libe57
Does anybody know this topic?

@dancergraham
Copy link
Collaborator

Hello,
Thanks for the sample file - that should help with debugging. I'm on holiday right now but I can have a look in a week or two if no-one has had the opportunity sooner

@Eecornwell
Copy link

I have had a similar error attempting to re-apply a previous header onto a new scan write. Any followup on what this error means?

@Eecornwell
Copy link

Eecornwell commented Jul 24, 2024

I was able to solve my issue by commenting out header attributes inside of e57.py (lines starting at 234) that are not currently in my scan headers. I believe temperature, humidity, and datetime were not in my original header that I was attempting to copy over.

@meLordlp
Copy link

Hi, I have the same issue. I solved it with changing the code locally.
In the scan_header.py in line 31 you should check if rotation is in self.node["pose"]. If not just return Quaternion([1, 0, 0, 0]).elements.
Can this be fixed?

@Napam
Copy link

Napam commented Jan 28, 2025

I am also experiencing the same issue related to the scan_header. The error I get the following:

---------------------------------------------------------------------------
E57Exception                              Traceback (most recent call last)
Cell In[3], line 2
      1 e57_handle = pye57.E57("data/Tunnel nygårdsviken.e57")
----> 2 e57_data = e57_handle.read_scan(0, ignore_missing_fields=True)

File ~/work/projects/wg-scan/.venv/lib/python3.12/site-packages/pye57/e57.py:214, in E57.read_scan(self, index, intensity, colors, row_column, transform, ignore_missing_fields)
    212 # translation to global coordinates
    213 if header.has_pose():
--> 214     xyz = self.to_global(xyz, header.rotation, header.translation)
    215 data["cartesianX"] = xyz[:, 0]
    216 data["cartesianY"] = xyz[:, 1]

File ~/work/projects/wg-scan/.venv/lib/python3.12/site-packages/pye57/scan_header.py:37, in ScanHeader.rotation(self)
     34 @property
     35 def rotation(self) -> np.array:
     36     try:
---> 37         rotation = self.node["pose"]["rotation"]
     38         q = Quaternion([e.value() for e in rotation])
     39     except KeyError:

E57Exception: E57 element path well formed but not defined (ErrorPathUndefined)

**** Got an e57 exception: E57 element path well formed but not defined (ErrorPathUndefined)
  Debug info: 
    context: this->pathName=/data3D/0/pose pathName=rotation
    sourceFunctionName: get
    reportingFunctionName: operator()
/Users/runner/work/pye57/pye57/libE57Format/src/StructureNodeImpl.cpp(145) : error C22:  <--- occurred on
src/pye57/libe57_wrapper.cpp(49) : error C0:  <--- reported on

I did a very dirty quickfix by simply altering the error handling code in ScanHeader.rotation from this:

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

to this:

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

I am not sure what is the most correct way to handle this though. But at least doing this for me lets me work on the point cloud.

Maybe header.hasPose could do some kind of check whether the pose information is valid?

Or, are there are any easy ways to amend such a .e57 file with a "corrupt" scanheader?

EDIT: A better quickfix I did was to set transform=False, which just skips all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants