How to use parameter for expand function of C++ function [closed]

asked 2022-05-04 02:46:47 -0600

Petros ADLATUS gravatar image


I would like to find an elegant way to pass a parameter (defined in the launch file) to my node. However, without changing the parameters of the function itself. Is this possible or am I wrong?

The function is the following:

int map_m2i(double val)
    return min(255, max(0, (int)round(((val + 1.0)/4.0) * 255)));


double offset;

Possible only way would be?:

  int map_m2i(double val, double offset)
        val += offset;
        return min(255, max(0, (int)round(((val + 1.0)/4.0) * 255)));

Thanks for tips, help and inspiration.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see for more details. by Petros ADLATUS
close date 2022-05-18 06:43:12.243315