-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix ros2 parameter descriptions and range values #2600
Fix ros2 parameter descriptions and range values #2600
Conversation
Don't merge yet. |
You can convert a PR into a draft (see |
option_value = static_cast<T>(sensor.get_option(option)); | ||
op_range = sensor.get_option_range(option); | ||
float current_val = sensor.get_option(option); | ||
if(std::is_same<T, double>::value && current_val > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!= 0?
} | ||
else | ||
{ | ||
rcl_interfaces::msg::FloatingPointRange range; | ||
range.from_value = double(op_range.min); | ||
range.to_value = double(op_range.max); | ||
range.from_value = static_cast<double>(op_range.min); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe needs conversion too?
float range = option_range.max - option_range.min; | ||
int steps = range / option_range.step; | ||
double step = static_cast<double>(range) / steps; | ||
double rounded_div = std::round((val - option_range.min) / step); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please protect div_by_zero. for both devision operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamerKhshiboun we forgot about it before merging please add protection
I wonder why cppcheck didn't shout on it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Tracked by [DSO-18759]