How to use parameter for expand function of C++ function [closed]
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.