I've come across a problem in ARGoS that I am going to make a patch for, however I would like to get some feedback first.
The patch will create a specialised version of the CRange template for types CRadians and CDegrees. Consider the following scenario to understand my motivation for this.
I would like to specify a range that is plus-minus an offset angle from an variable angle as an input. Creating the object using ARGoS libraries would look like this:
Code: Select all
CRange<CRadians> MyRange( InputAngle - OFFSET_ANGLE_CONST, InputAngle + OFFSET_ANGLE_CONST)
I propose that I fix this problem using template specialisation. A well known use of template specialisation is the std::vector specialisation for the type bool. Using template specialisation I can build the intelligence into CRange for the types CRange<CRadians> and CRange<CDegrees> such that we fix this problem.
Cheers,