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(emergency_handler, mrm_handler) change MRM operators to classes inside Handler Nodes #6589

Closed

Conversation

veqcc
Copy link
Contributor

@veqcc veqcc commented Mar 11, 2024

Description

Delete MRM operators and implemented those operators inside Handlers (Emergency Handler, MRM Handler) as classes based on #6539 .

Related links

#6539

Tests performed

Not yet.

Notes for reviewers

Please review especially in terms of:

  • namespace structure
  • update_rate of handlers
    • Previously, it was 10 Hz in emergency_handler, while 33 Hz in emergency_stop_operator.
  • how to pass parameters to each operator
  • When to publish emergency commands in emergency_stop operator class
    • only in operate() or both operate() and onTimer() ?
  • Are commands gear and hazard_light used only when emergency_stop is enabled?
    • If so, should they included in emergency_stop class, not in handlers?

Interface changes

We cannot access MRM operators directly.
All inputs/outputs of operators are included in the Handler's interfaces.

Effects on system behavior

Handlers do not have to call ROS 2 services anymore to invoke mrm oprations.
It changes to function calls and thus mrm operations can work more quickly in terms of:

  • no need to wait next timer callback
  • no need to wait ROS 2 scheduler to schedule

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

…gency Handler

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:system System design and integration. (auto-assigned) component:launch Launch files, scripts and initialization tools. (auto-assigned) labels Mar 11, 2024
pre-commit-ci bot and others added 3 commits March 11, 2024 09:47
Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@veqcc veqcc changed the title update(emergency_handler, mrm_handler) change MRM operators to classes inside Handler Nodes refactor(emergency_handler, mrm_handler) change MRM operators to classes inside Handler Nodes Mar 12, 2024
@veqcc veqcc requested a review from isamu-takagi March 12, 2024 01:33
Copy link
Contributor

@isamu-takagi isamu-takagi left a comment

Choose a reason for hiding this comment

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

namespace structure

Do you mean comfortable_stop_operator in emergency_handler? It looks fine.
FYI: It can be written as namespace emergency_handler::comfortable_stop_operator

update_rate of handlers
Previously, it was 10 Hz in emergency_handler, while 33 Hz in

Since it changes the publishing rate of control commands, please check whether it has any effect on vehicle control. Also, it is better to treat the topic rate and processing rate separately.

emergency_stop_operator.
how to pass parameters to each operator

Where is this about? I think it would be better to use declare_parameter in each operator class, as is the current implementation.

When to publish emergency commands in emergency_stop operator class
only in operate() or both operate() and onTimer() ?

I think it's better to always publish if there are no performance problems.

Are commands gear and hazard_light used only when emergency_stop is enabled?
If so, should they included in emergency_stop class, not in handlers?

Yes. At the meeting the other day, we decided to publish a command for each MRM, so please move it in the operator class. It should be needed for comfortable_stop as well.

@TetsuKawa
Copy link
Contributor

As soon as this node is started up, the process dies.
I don't know where the bug is, but you should look into the code.

@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

@TetsuKawa
Thank you for your comment.
If the error message is what(): Statically typed parameter 'hoge' must be initialized. or something like this, then adding some parameters to the top-level configuration file (autoware/src/launcher/autoware_launch/autoware_launch/config/system/emergency_handler/emergency_handler.param.yaml) works well.

veqcc and others added 2 commits March 12, 2024 14:08
Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@TetsuKawa
Copy link
Contributor

@veqcc
I'm sorry. You are right, the higher level parameter file was loaded.

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

@isamu-takagi
Thank you for your helpful comments!

namespace structure

Do you mean comfortable_stop_operator in emergency_handler? It looks fine.
FYI: It can be written as namespace emergency_handler::comfortable_stop_operator

Yes I meant it. I have fixed the namespace following it.

@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

emergency_stop_operator. how to pass parameters to each operator

Where is this about? I think it would be better to use declare_parameter in each operator class, as is the current implementation.

Yes I meant the parameters in configuration files.
Thank you for your review.

@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

@isamu-takagi

Are commands gear and hazard_light used only when emergency_stop is enabled? If so, should they included in emergency_stop class, not in handlers?

Yes. At the meeting the other day, we decided to publish a command for each MRM, so please move it in the operator class. It should be needed for comfortable_stop as well.

I see. I will move these parameters and functions to operators from handlers.
One question here is, is it neccesary to modify vehicle_cmd_gate to enable these commands even when comfortable_stop?
It seems the vehicle_cmd_gate chooses emergency commands only when emergency_stop is being operated.
If so, I will make another Pull Request for it after this PR is merged.

veqcc and others added 2 commits March 12, 2024 15:49
@isamu-takagi
Copy link
Contributor

One question here is, is it neccesary to modify vehicle_cmd_gate to enable these commands even when comfortable_stop?
It seems the vehicle_cmd_gate chooses emergency commands only when emergency_stop is being operated.
If so, I will make another Pull Request for it after this PR is merged.

@veqcc That's right. So for this PR, it is enough to move the command publishers to the emergency_stop operator class.

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

update_rate of handlers
Previously, it was 10 Hz in emergency_handler, while 33 Hz in

Since it changes the publishing rate of control commands, please check whether it has any effect on vehicle control. Also, it is better to treat the topic rate and processing rate separately.

I have changed following your advice. Now emergency_handler works in 10Hz, while emergency_stop_operator works in 30Hz as before.

@veqcc
Copy link
Contributor Author

veqcc commented Mar 12, 2024

When to publish emergency commands in emergency_stop operator class. Only in operate() or both operate() and onTimer() ?

I think it's better to always publish if there are no performance problems.

Both the current implementaion and my modification always publish them.
There are no performance problem in Psim on my computer, though I don't know in full Autoware on actual vehicles.
Until any performance problem happens, I will keep the current one.

Copy link

stale bot commented May 12, 2024

This pull request has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the status:stale Inactive or outdated issues. (auto-assigned) label May 12, 2024
@veqcc
Copy link
Contributor Author

veqcc commented May 28, 2024

I willl close it.

@veqcc veqcc closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:launch Launch files, scripts and initialization tools. (auto-assigned) component:system System design and integration. (auto-assigned) status:stale Inactive or outdated issues. (auto-assigned) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants