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

Refactor ROS 2 sensor components events management #482

Merged

Conversation

PawelLiberadzki
Copy link
Contributor

This is a proposition of universal sensor events management, that solves issue #295.

I introduce event source interface, and two sample implementations of it - TickBasedSource and PhysicsBasedSource. They are used through event source adapter in a new sensor component base class ROS2SensorComponentBase (previously ROS2SensorComponent).

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
…cessary includes. Update documentation.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
…ntSourceAdapter documentation.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
…edSource.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
…rce.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Copy link
Contributor

@adamdbrw adamdbrw left a comment

Choose a reason for hiding this comment

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

Nice work!

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
…pter.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
… adjustment for PhysicsBasedSource.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Copy link
Contributor

@adamdbrw adamdbrw left a comment

Choose a reason for hiding this comment

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

Good work!

…pdated.

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
@PawelLiberadzki PawelLiberadzki marked this pull request as ready for review September 4, 2023 13:33
@PawelLiberadzki PawelLiberadzki requested review from a team as code owners September 4, 2023 13:33
# Conflicts:
#	Gems/ROS2/Code/Source/Lidar/ROS2Lidar2DSensorComponent.cpp
#	Gems/ROS2/Code/Source/Lidar/ROS2LidarSensorComponent.cpp
#	Gems/ROS2/Code/Source/ROS2SystemComponent.cpp
Copy link
Contributor

@michalpelka michalpelka left a comment

Choose a reason for hiding this comment

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

Please make sure that the contribution compiles with non-unity build.

auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get();
const auto gravity = sceneInterface->GetGravity(sceneHandle);
auto* body = sceneInterface->GetSimulatedBodyFromHandle(sceneHandle, m_bodyHandle);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest multiple assertions here - the code can mistakenly be executed in a different context by mistake (e.g. in Asset Processor) and a good assertion can be helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

I belive gravity is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added an assert on body pointer - this is a good catch. I left sceneInterface as it is - do you maybe think that it is necessary to assert it, when it is a result from:
AZ::InterfaceAzPhysics::SceneInterface::Get()
engine call? Here I assume, that it won't rather fail, and if it will, then we have some critical issue. Is such reasoning not correct?

Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
Signed-off-by: Paweł Liberadzki <pawel.liberadzki@robotec.ai>
@michalpelka michalpelka merged commit 04cbbc8 into o3de:development Sep 13, 2023
2 checks passed
michalpelka pushed a commit to RobotecAI/o3de-extras that referenced this pull request Sep 25, 2023
Universal event management system for sensor components in ROS 2.

---------
Signed-off-by: Paweł Liberadzki <44069826+PawelLiberadzki@users.noreply.github.com >
michalpelka pushed a commit to RobotecAI/o3de-extras that referenced this pull request Sep 25, 2023
Universal event management system for sensor components in ROS 2.

---------
Signed-off-by: Paweł Liberadzki <44069826+PawelLiberadzki@users.noreply.github.com >
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
michalpelka pushed a commit to RobotecAI/o3de-extras that referenced this pull request Oct 2, 2023
Universal event management system for sensor components in ROS 2.

---------
Signed-off-by: Paweł Liberadzki <44069826+PawelLiberadzki@users.noreply.github.com >
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
michalpelka pushed a commit that referenced this pull request Oct 3, 2023
Universal event management system for sensor components in ROS 2.

---------
Signed-off-by: Paweł Liberadzki <44069826+PawelLiberadzki@users.noreply.github.com >
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
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

Successfully merging this pull request may close these issues.

3 participants