Skip to content

Commit bd33168

Browse files
chrisbitterpeci1
andauthored
Update joy/src/joy.cpp
Co-authored-by: Martin Pecka <[email protected]>
1 parent 0f4b2a8 commit bd33168

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

joy/src/joy.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,7 @@ Joy::Joy(const rclcpp::NodeOptions & options)
8888

8989
sticky_buttons_ = this->declare_parameter("sticky_buttons", false);
9090

91-
autocenter_ = this->declare_parameter("autocenter", 0);
92-
93-
if (autocenter_ < 0) {
94-
autocenter_ = 0;
95-
} else if (autocenter_ > 100) {
96-
autocenter_ = 100;
97-
}
91+
autocenter_ = std::clamp(this->declare_parameter("autocenter", 0), 0, 100);
9892

9993
coalesce_interval_ms_ = static_cast<int>(this->declare_parameter("coalesce_interval_ms", 1));
10094
if (coalesce_interval_ms_ < 0) {

0 commit comments

Comments
 (0)