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

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

Petros ADLATUS gravatar image

Hello,

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)));
}

main:

double offset;
ros::param::get("offset_lidar",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 http://wiki.ros.org/Support for more details. by Petros ADLATUS
close date 2022-05-18 06:43:12.243315