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

Fix errors in rotation function in OSMPDummySensor #95

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

ClemensLinnhoff
Copy link
Contributor

@ClemensLinnhoff ClemensLinnhoff commented Mar 14, 2023

Reference to a related issue in the repository

Fixes #94

Add a description

  • Added a transpose function for the rotation matrix, as it is a transformation from a global coordinate system to a local system and therefore, the inverse needs to be used
  • Changed using the objects orientation to using the ego orientation for calculating the relative position of an object with respect to the ego vehicle.

Check the checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation for osi-sensor-model-packaging.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works: Failed unit test, Passing unit test
  • New and existing unit tests / Github Actions pass locally with my changes.

…tation to ego orientation

Signed-off-by: ClemensLinnhoff <clemens.linnhoff@persival.de>
@ClemensLinnhoff ClemensLinnhoff added the bug Problems in the build system, build scripts, etc or faults in the interface. label Mar 14, 2023
@ClemensLinnhoff ClemensLinnhoff self-assigned this Mar 14, 2023
Copy link
Contributor

@PhRosenberger PhRosenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this occured during unit testing and is now solved, it should be merged asap.

Signed-off-by: Thomas Sedlmayer <tsedlmayer@pmsfit.de>
- Change transformation matrix to XYZ rotation order acc. to OSI3 def.
- Consider center rear axle for transformation
- Consider virt. sensor mounting position/orientation for transformation
- Copy/translate object orientations from SensorView to SensorData
- Copy virtual sensor mounting position from SensorView to SensorData

Signed-off-by: Thomas Sedlmayer <tsedlmayer@pmsfit.de>
@thomassedlmayer
Copy link
Contributor

Thanks for noticing/fixing the bug! The fix works with our tools.

Though, I thought we would maybe want to use the actual roll-pitch-yaw rotation matrix instead of using the yaw-pitch-roll matrix and then transpose? I made a proposal in my commit. What do you think?

I also added the transformation to vehicle coordinate system (center rear axle) and virtual sensor coordinate system as this was missing anyways. And I removed the rotatePoint function from the DummySource as this probably was a copy/paste mistake.

@ClemensLinnhoff Could you check if this works for you?

Copy link
Contributor Author

@ClemensLinnhoff ClemensLinnhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the individual comments in the code, I would acutally prefer to use the inverse of the rotation matrix instead of reversing the rotation order and the angles, because it would then be alligned with the mathematical definitions in the documentation.

examples/OSMPDummySensor/OSMPDummySensor.cpp Show resolved Hide resolved
examples/OSMPDummySensor/OSMPDummySensor.cpp Show resolved Hide resolved
examples/OSMPDummySensor/OSMPDummySensor.cpp Show resolved Hide resolved
@ClemensLinnhoff
Copy link
Contributor Author

As I said above, for me it is easier to understand the coordinate transformtion by having only one rotation matrix and using the inverse depending on the transformation direction. But I can understand, that people might also find it easier doing it by reversing the rotation direction and the angle directions. So it would be fine for me to use your approach @thomassedlmayer

I tested the current implementation with some unit tests and could not find an error, so the transformation (incl. translation and rotation) to vehicle and to the sensor seem to work.

@ClemensLinnhoff
Copy link
Contributor Author

After removing the transpose function as noted above, the PR can be merged from my point of view.

Signed-off-by: Thomas Sedlmayer <tsedlmayer@pmsfit.de>
@PhRosenberger PhRosenberger added this to the 3.6 milestone May 9, 2023
@PhRosenberger PhRosenberger added the ReadyForCCBReview Indicates that this MR is ready for a final review and merge by the CCB. label May 9, 2023
@pmai pmai added ReadyToMerge and removed ReadyForCCBReview Indicates that this MR is ready for a final review and merge by the CCB. labels May 22, 2023
@pmai
Copy link
Contributor

pmai commented May 22, 2023

CCB 2023-05-22: Merge as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problems in the build system, build scripts, etc or faults in the interface. ReadyToMerge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors in rotation function in OSMPDummySensor
4 participants