Various QoL (refactored RTABMAP_VERSION_COMPARE)

This commit is contained in:
matlabbe
2026-05-03 15:40:12 -07:00
parent 0cf2e45c81
commit b2d5a9d016
6 changed files with 18 additions and 7 deletions
+8
View File
@@ -26,6 +26,14 @@ SET(RTABMAP_PATCH_VERSION 5)
SET(RTABMAP_VERSION SET(RTABMAP_VERSION
${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_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}") SET(PROJECT_VERSION "${RTABMAP_VERSION}")
SET(PROJECT_VERSION_MAJOR ${RTABMAP_MAJOR_VERSION}) SET(PROJECT_VERSION_MAJOR ${RTABMAP_MAJOR_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_MINOR @PROJECT_VERSION_MINOR@
#define RTABMAP_VERSION_PATCH @PROJECT_VERSION_PATCH@ #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 @NONFREE@#define RTABMAP_NONFREE
@TORO@#define RTABMAP_TORO @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, '.')); std::vector<std::string> version = uListToVector(uSplit((*iter).second, '.'));
if(version.size() == 3) 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) if(configFilePath.find(".rtabmap") != std::string::npos)
{ {
UWARN("Version in the config file \"%s\" is more recent (\"%s\") than " UWARN("Version in the config file \"%s\" is more recent (\"%s\") than "
"current RTAB-Map version used (\"%s\"). The config file will be upgraded " "current RTAB-Map version used (\"%s\"). The config file will be downgraded "
"to new version.", "to current RTAB-Map version if saved.",
configFilePath.c_str(), configFilePath.c_str(),
(*iter).second, (*iter).second,
RTABMAP_VERSION); RTABMAP_VERSION);
+2 -1
View File
@@ -231,7 +231,8 @@ public:
const Transform & to, const Transform & to,
const QColor & color, const QColor & color,
bool arrow = false, bool arrow = false,
bool foreground = false); bool foreground = false,
double width = 1.0);
void removeLine(const std::string & id); void removeLine(const std::string & id);
void removeAllLines(); void removeAllLines();
const std::set<std::string> & getAddedLines() const {return _lines;} const std::set<std::string> & getAddedLines() const {return _lines;}
+3 -1
View File
@@ -1732,7 +1732,8 @@ void CloudViewer::addOrUpdateLine(
const Transform & to, const Transform & to,
const QColor & color, const QColor & color,
bool arrow, bool arrow,
bool foreground) bool foreground,
double width)
{ {
if(id.empty()) 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->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_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; * std::list<std::string> v;
* v.push_back("Hello"); * v.push_back("Hello");
* v.push_back("world!"); * v.push_back("world!");
* std::string joined = split(v, " "); * std::string joined = uJoin(v, " ");
* @endcode * @endcode
* The output string is "Hello world!" * The output string is "Hello world!"
* @param strings a list of strings * @param strings a list of strings