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

Manuall merge of ros2-prealpha to ros2-dev #218

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Conversation

KmakD
Copy link
Contributor

@KmakD KmakD commented Jan 16, 2024

Manual merge of prealpha branch. Changes regarding ros2_control and panther_hardware_interfaces were omitted.

panther_gpiod/include/panther_gpiod/gpio_driver.hpp Outdated Show resolved Hide resolved
panther_gpiod/src/gpio_driver.cpp Outdated Show resolved Hide resolved
panther_gpiod/src/gpio_driver.cpp Outdated Show resolved Hide resolved
panther_gpiod/src/gpio_driver.cpp Show resolved Hide resolved
Comment on lines +17 to +19
import textwrap

import click
Copy link
Contributor

Choose a reason for hiding this comment

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

is it pre-commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Comment on lines 112 to 118
gpiod::line::value new_output_value;
if (!line_request_) {
new_output_value = gpio_info.init_value;
} else {
new_output_value = gpio_info.value;
}
settings.set_output_value(new_output_value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gpiod::line::value new_output_value;
if (!line_request_) {
new_output_value = gpio_info.init_value;
} else {
new_output_value = gpio_info.value;
}
settings.set_output_value(new_output_value);
gpiod::line::value new_output_value = line_request_ ? gpio_info.value : gpio_info.init_value;
settings.set_output_value(new_output_value);

just a suggestion

Comment on lines 150 to 159
bool GPIODriver::IsPinAvaible(const GPIOPin pin) const
{
for (auto & info : gpio_info_storage_) {
if (info.pin == pin) {
return true;
}
}
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool GPIODriver::IsPinAvaible(const GPIOPin pin) const
{
for (auto & info : gpio_info_storage_) {
if (info.pin == pin) {
return true;
}
}
return false;
}
bool GPIODriver::IsPinAvaible(const GPIOPin pin) const
{
return std::any_of(gpio_info_storage_.begin(), gpio_info_storage_.end(),
[&](const auto &info) { return info.pin == pin; });
}

It is considered more idiomatic in modern C++. Just another suggestion :p

With such changes, we still need to include .

Copy link
Contributor

@pkowalsk1 pkowalsk1 Jan 19, 2024

Choose a reason for hiding this comment

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

I'm sorry @KmakD. There is a typo in my comment caused by parsing <>. With such changes, we still need to include <algorithm>.

@KmakD KmakD requested review from pkowalsk1 and macstepien January 19, 2024 10:51
@KmakD KmakD merged commit 1bbdd38 into ros2-devel Jan 19, 2024
@KmakD KmakD deleted the ros2-merge-prealpha branch January 19, 2024 12:59
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