Various QoL (refactored RTABMAP_VERSION_COMPARE) (#1695)

This commit is contained in:
matlabbe
2026-05-04 20:12:31 -07:00
committed by GitHub
parent 37f8fa63c5
commit c1ef13a8d6
6 changed files with 18 additions and 7 deletions
+8
View File
@@ -25,6 +25,14 @@ SET(RTABMAP_MINOR_VERSION 23)
SET(RTABMAP_PATCH_VERSION 5)
SET(RTABMAP_VERSION
${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_VERSION})
# Make sure we have valid version so that RTABMAP_VERSION_COMPARE logic in Version.h works
IF(RTABMAP_MINOR_VERSION GREATER 99)
MESSAGE(FATAL_ERROR "RTABMAP_MINOR_VERSION must be < 100, bump major version and restart minor to 0!")
ENDIF()
IF(RTABMAP_PATCH_VERSION GREATER 99)
MESSAGE(FATAL_ERROR "RTABMAP_PATCH_VERSION must be < 100, bump minor version and restart patch to 0!")
ENDIF()
SET(PROJECT_VERSION "${RTABMAP_VERSION}")
+1 -1
View File
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define RTABMAP_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define RTABMAP_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define RTABMAP_VERSION_COMPARE(major, minor, patch) (major>=@PROJECT_VERSION_MAJOR@ || (major==@PROJECT_VERSION_MAJOR@ && minor>=@PROJECT_VERSION_MINOR@) || (major==@PROJECT_VERSION_MAJOR@ && minor==@PROJECT_VERSION_MINOR@ && patch >=@PROJECT_VERSION_PATCH@))
#define RTABMAP_VERSION_COMPARE(OP, MAJOR, MINOR, PATCH) (RTABMAP_VERSION_MAJOR*10000+RTABMAP_VERSION_MINOR*100+RTABMAP_VERSION_PATCH OP MAJOR*10000+MINOR*100+PATCH)
@NONFREE@#define RTABMAP_NONFREE
@TORO@#define RTABMAP_TORO
+3 -3
View File
@@ -1233,13 +1233,13 @@ void readINIImpl(const CSimpleIniA & ini, const std::string & configFilePath, Pa
std::vector<std::string> version = uListToVector(uSplit((*iter).second, '.'));
if(version.size() == 3)
{
if(!RTABMAP_VERSION_COMPARE(std::atoi(version[0].c_str()), std::atoi(version[1].c_str()), std::atoi(version[2].c_str())))
if(RTABMAP_VERSION_COMPARE(<, std::atoi(version[0].c_str()), std::atoi(version[1].c_str()), std::atoi(version[2].c_str())))
{
if(configFilePath.find(".rtabmap") != std::string::npos)
{
UWARN("Version in the config file \"%s\" is more recent (\"%s\") than "
"current RTAB-Map version used (\"%s\"). The config file will be upgraded "
"to new version.",
"current RTAB-Map version used (\"%s\"). The config file will be downgraded "
"to current RTAB-Map version if saved.",
configFilePath.c_str(),
(*iter).second,
RTABMAP_VERSION);
+2 -1
View File
@@ -231,7 +231,8 @@ public:
const Transform & to,
const QColor & color,
bool arrow = false,
bool foreground = false);
bool foreground = false,
double width = 1.0);
void removeLine(const std::string & id);
void removeAllLines();
const std::set<std::string> & getAddedLines() const {return _lines;}
+3 -1
View File
@@ -1732,7 +1732,8 @@ void CloudViewer::addOrUpdateLine(
const Transform & to,
const QColor & color,
bool arrow,
bool foreground)
bool foreground,
double width)
{
if(id.empty())
{
@@ -1764,6 +1765,7 @@ void CloudViewer::addOrUpdateLine(
_visualizer->addLine(pt2, pt1, c.redF(), c.greenF(), c.blueF(), id, foreground?3:2);
}
_visualizer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, c.alphaF(), id);
_visualizer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, width, id);
}
}
+1 -1
View File
@@ -591,7 +591,7 @@ inline std::list<std::string> uSplit(const std::string & str, char separator = '
* std::list<std::string> v;
* v.push_back("Hello");
* v.push_back("world!");
* std::string joined = split(v, " ");
* std::string joined = uJoin(v, " ");
* @endcode
* The output string is "Hello world!"
* @param strings a list of strings