tier4 / sensor_trigger

ROS node for triggering cameras using GPIO on Jetson (targeting ROSCubeX, but easily adaptable to other platforms)
Apache License 2.0
6 stars 3 forks source link

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

Closed manato closed 1 year ago

manato commented 1 year ago

PR Type

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.

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

CI Checks