Matlab API: various bug fixes#47
Conversation
The crg rerender function did not handle the increment arguments correctly which let to issues which are hard to understand for the caller. Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Fix bugs where OpenCRG Matlab API would not handle arguments correctly, remove necessary components of the CRG header, introudce unwanted coordinate shifts, or rely on optional header entries. Resolves: #9 Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
|
ASAM OpenCRG CCB 2025 12 15: Approved and can be merged for the next release. |
jorauh
left a comment
There was a problem hiding this comment.
I don't like fault tolerance, so I suggest to
- improve documentation
- implement argument checking with useful error messages.
Fault tolerance hides users's mis-understanding and increases further fault risks.
If you are ok with that, may I give some proposal?
e.g.
% V vector of v values (single)
% length(v) == 1: defines half width of road (postive value)
% length(v) == 2: defines right/left edge of road [vmin vmax]
% length(v) == nv: defines length cut positions [vmin ... vmax]
case 1
if v < 0 error ...
case 2
if v(1) >= v(2) error ...
case 3
... (check for increasing values)
There was a problem hiding this comment.
If the crg struct is successfully checked, poff is always defined (see crg_check_data.m)
The idea behind is to avoid this kind of individual checks in all routines by providing a complete check of all structure elements at single check routines.
There was a problem hiding this comment.
This is an older "bug fix" used in our company and I can not tell you why this was changed but I agree that it should be unnecessary
There was a problem hiding this comment.
This was introduced as easy workaround, otherwise crg_cut_iuiv using an CRG which has an mpro field does not work.
There was a problem hiding this comment.
The problem was the crg_cut_iuiv function, where poff was erroneously omitted. This issue is addressed in the latest commit
jorauh
left a comment
There was a problem hiding this comment.
I suppose these are mostley errors due to missing checks, which should guarantee a complete crg struct. Please let us look for the real reasons behind the problems and not fix them later in individual routines - we will never find all of them.
|
#47 (review) #47 (review) Fixing the underlying problem is obviously preferrable but someone has to spend the time to get to the root of the problems, test every possible combination of valid crg header parameters with all api functions because the crg check surely has to be changed and preferrably write unit tests. But I am open to discuss how to tackle these bugs. This will also lead to the general problems with the map projection that many api functions cant handle properly (see #10 (comment)) |
|
If we introduce workarounds, we will worsen the long-term stability of opencrg. Even though analyzing (and fixing) problems may seem difficult, this is the only way to ensure that we will continue to have a stable product in the long term. If the introduction of map projections in Release 1.2.0 has not yet been fully implemented in a number of MATLAB tools, that is another task. |
|
Agreed, then the only bug fixes we keep from these commits are proper numerical function argument checks but removing fault tolerances and the ones where position information is thrown away for no reason |
Undoing workarounds that would prevent errors due to the underlying crg check issues. Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Remove fault tolerance, check arguments and throw error on invalid arguments. Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Without copying poff the crg check would fail if mpro is present. Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
|
Workarounds have been removed again. |
|
OpenCRG 2026.02.09: @CarawaySeed42 & @jorauh are still working on it. |
The extract slope and banking functions introduced or removed offsets from the data. Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
|
Latest commit introduced a workaround free solution for extract slope and banking functions, when considering the master branch code as not a workaround. |
fix for #5
|
@CarawaySeed42 : |
|
@jorauh |
|
One more addition to handling lat/lon and mpro in API functions modifying the refline: |
jorauh
left a comment
There was a problem hiding this comment.
Suggesting to merge this PR, since my further fixes on the georeferencing topics will take some more time.
fixed error: added missing dim argument to size function removed dead code to write unknown header element data.head.rccl corrected some comments
|
One more fix for crg_write which didn't work on current matlab release. |
| default = crg_check_opts(default); | ||
| f = fieldnames(opts); | ||
| for i = 1:size(f) | ||
| for i = 1:size(f, 1) |
There was a problem hiding this comment.
for i = 1:numel(f) would be independent of the size/dimension of f, but this is good as well
Otherwise no objections to the commited changes to crg_write
This is not always possible: if the modifiers e.g. scale the refline, the map projection becomes invalid. I will handle this and further cases in #77 |
|
True, my answer was directed towards cutting or appending CRGs. |
|
OpenCRG CCB 2026.03.09: Ready for merge |
Fix bugs where OpenCRG Matlab API functions would not handle arguments correctly,
remove necessary components of the CRG header, introduce unwanted coordinate shifts,
or rely on optional header entries.
Resolves: #9
Signed-off-by: Patrick Kuemmerle patrick.kuemmerle@3d-mapping.de
Remaining issues: