Skip to content

feat: close GPIO port on node boot if is is already used#25

Merged
drwnz merged 1 commit intogalacticfrom
feat/close_exist_port_on_start
May 19, 2023
Merged

feat: close GPIO port on node boot if is is already used#25
drwnz merged 1 commit intogalacticfrom
feat/close_exist_port_on_start

Conversation

@manato
Copy link
Copy Markdown
Contributor

@manato manato commented May 18, 2023

PR Type

  • Improvement

Related Links

Description

Currently, if the target GPIO port is opened when the node starts, the node exits with an error status.
This PR checks the status of the target GPIO port, closes it if it is in use, and tries to open it on node boot.

Review Procedure

$ echo 216 > /sys/class/gpio/export 
$ ros2 run sensor_trigger sensor_trigger_exe --ros-args -p gpio:=5

Before merging this PR, the node should exit with a message like Failed to initialize GPIO trigger. ... while should not after merging

Remarks

Even if there is another process that uses a specified GPIO port properly, the ownership of the GPIO port is forcely taken by this sensor_trigger node. This PR intends to make sensor_trigger node work properly under the condition that some processes (including previous run of sensor_trigger) exit unexpectedly and the target GPIO port is not closed correctly.

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

…used

Signed-off-by: Manato HIRABAYASHI <manato.hirabayashi@tier4.jp>
@manato manato requested a review from drwnz May 18, 2023 06:37
Copy link
Copy Markdown
Collaborator

@drwnz drwnz left a comment

Choose a reason for hiding this comment

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

LGTM

@drwnz drwnz merged commit ebc4a8d into galactic May 19, 2023
@manato manato deleted the feat/close_exist_port_on_start branch May 19, 2023 08:58
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.

2 participants