Correct OpenCRG height if reference line has no Z height#72
Correct OpenCRG height if reference line has no Z height#72
Conversation
|
Is this really correct? The removed branch of the condition is also used if the refline has a constant height (no slope, reference_line_start_z = reference_line_end_z). |
I will try to dig up the original context. I have an automated test for this, but will have to see what it tests exactly. This patch has shipped with the Hexagon OdrManager (and thus probably VTD) since sometime in 2020 (I integrated it into our internal toolchain in May 2020). @MJSommerer Maybe you know some background on this? From our internal commits, I can see that this was tracked at https://redmine.vires.com/issues/10737 but I can't access that site anymore. |
CarawaySeed42
left a comment
There was a problem hiding this comment.
I am sure there is a reason this change was made for the Hexagon OdrManager because the integration of CRG with ODR still seems incomplete and needs some workarounds from my experience.
But this change would lead to the C API returning wrong evaluated heights and different ones from the Matlab API (See previous comment; #72 (comment))
|
It's quite possible that the fix was made in the wrong place. It might even be that the CRG file is just wrong. I know neither the spec nor the C code good enough to make a final judgmenent, but I dug up the test case: This file was used in an OpenDRIVE file in (many more So to my limited understanding it does not have a Z reference line, but has an explicit Z offset of 0. It also has explicitly set However, the data actually starts at height 100. What I see in the C code is that To me, the standard is not clear in what should happen here. My naive understanding is that no reference line is provided explicitly, but the parameters say that it has a constant height of zero, and that should not modify the heights from the data in any way (which is not what the C code currently does). I have not checked with Matlab yet since I'm not very familiar with Matlab. |
|
Thank you for the test file. When working with partners that used CRGs for this reason, combining OpenCRG and OpenDRIVE, I had this confusing experience, that they requested Before the removal of the refline height they also reported jumps in height between roads where there shouldn't be any, especially between roads and junctions. |
|
It's not a bug, it's a (default) feature to shift road hight at the beginning to get The CRG-Jump1.crg file has no reference line, no slope, no offsets, it just contains a [5000x151] z matrix and The first 50 lateral road cuts in the z matrix are the next 4950 have small variable values representing an uneven surface. Before any mods are applied, the evaluation will return Applying the default mods (which are applied when there is no mods block in the file) will then shift the reference line down by and remember this shift by The evaluation will then return block could be added, or an explicit un-setting of the vertical shift by would do the same. (Alternatively, the calling program could omit the mods execution call.) Background for this default behavior: the first users of first crg implementations always needed The current documentation is rather bad in explaining the modifiers and the default behavior, the old one was better (but not really good). |
|
@tbleher The hints by @jorauh would work, otherwise if you do not want to change existing CRG files and do not want to change the mods after reading the file then the following would also be a potential fix in the calling function: So, instead of changing the crgEvalz.c function, one could just undo the z-shift that was done by the mods. If I remember correctly when using 'ODR attached' mode (CRG+ODR) then zbeg and zend have to be zero and all of the elevation needs to be stored inside the z-channel grid. At least it was like this a few years ago.
Since the offset was not even read by the C-API previously, this remembering of the offset is not (yet) implemented by the C-API. Not that this is a problem at the moment. This is just for completeness sake. |
No description provided.