A question about cvtInt2Double_hue in trafficlight_recognizer
Required information:
- Operating system and version:
- Ubuntu 18.04
- Autoware installation type:
- From source
- Autoware version or commit hash
- ROS distribution and version:
- ROS Melodic
- ROS installation type:
- From binaries
Description of the bug
I could not understand the expected behavior of cvtInt2Double_hue
in trafficlight_recognizer.
This function has two arguments(center
and range
).
But, I could not find the specification in Autoware documentation.
https://gitlab.com/autowarefoundation...
I think these parameters have the following meaning.
Is my understanding of this correct?
center
lower | upper
| | |
|<--- [0.5 * range] -->+<--- [0.5 * range] -->|
I checked current behavior using minimal code.
#include <iostream>
double cvtInt2Double_hue(int center, int range)
{
double converted = (center + range) * 2.0f;
if (converted < 0)
{
converted = 0.0f;
}
else if (360 < converted)
{
converted = converted - 360.0f;
}
return converted;
}
void CHECK_cvtInt2Double_hue(const int center, const int range)
{
double upper = cvtInt2Double_hue(center, range);
double lower = cvtInt2Double_hue(center, -range);
std::cout << "[center = " << center << ", range = " << range << "]" << std::endl;
std::cout << " upper = " << upper << ", lower = " << lower << std::endl;
}
int main(int argc, char* argv[])
{
CHECK_cvtInt2Double_hue(100, 50);
return 0;
}
The result is as follows.
[center = 100, range = 50]
upper = 300, lower = 100
I think that expected behavior is upper = 125, lower = 75
in this case.