Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Oct 4, 2023
2 parents 27757fb + 013a92d commit aad8f34
Show file tree
Hide file tree
Showing 64 changed files with 443 additions and 200 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/nanogui
Submodule nanogui updated 1 files
+1 −6 CMakeLists.txt
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# For compiling instructions for all compilers and platforms, see
# https://docs.mrpt.org/reference/latest/compiling.html
#
# 2007-2021, Jose Luis Blanco <jlblanco@ual.es>
# 2007-2023, Jose Luis Blanco <jlblanco@ual.es>
# ----------------------------------------------------------------------------

# -------------------------
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ and [much more](https://docs.mrpt.org/reference/latest/applications.html).

## 2. Resources
* Download the latest unstable code with: `git clone https://github.com/MRPT/mrpt.git --recursive`
* Ask questions at: [this Google group](https://www.mrpt.org/forum/) or at [stackoverflow](https://stackoverflow.com/search?q=mrpt) (please, use the tag `mrpt`!)
* Ask questions at [stackoverflow](https://stackoverflow.com/search?q=mrpt) (use the tag `mrpt`)
* [Main project website](https://www.mrpt.org/), including [sources and Windows installer downloads](https://www.mrpt.org/download-mrpt/)
* [C++ API reference](https://docs.mrpt.org/reference/)
* [ROS packages](https://docs.mrpt.org/reference/latest/wrappers.html#mrpt-ros-packages)
Expand Down Expand Up @@ -92,6 +92,13 @@ sudo apt install ros-$ROS_DISTRO-mrpt2
## 4. License
MRPT is released under the [new BSD license](http://www.mrpt.org/License/).


**Contributors**

<a href="https://github.com/MRPT/mrpt/graphs/contributors">
<img src="https://contrib.rocks/image?repo=MRPT/mrpt" />
</a>

## 5. Versions in repositories

![Repology](https://repology.org/badge/vertical-allrepos/mrpt.svg)
6 changes: 3 additions & 3 deletions apps/benchmarking-image-features/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void MainWindow::on_button_generate_clicked()
xData.at<double>(i) = i;
yData.at<double>(i) = distances(i, 0);
}
#if MRPT_OPENCV_VERSION_NUM >= 0x330
#if MRPT_OPENCV_VERSION_NUM >= 0x030300
plot = plot::Plot2d::create(xData, yData);
#else
plot = plot::createPlot2d(xData, yData);
Expand Down Expand Up @@ -384,7 +384,7 @@ void MainWindow::on_button_generate_clicked()
min_y = -1;
}

#if MRPT_OPENCV_VERSION_NUM >= 0x330
#if MRPT_OPENCV_VERSION_NUM >= 0x030300
plot = plot::Plot2d::create(xData, yData);
#else
plot = plot::createPlot2d(xData, yData);
Expand Down Expand Up @@ -439,7 +439,7 @@ void MainWindow::on_button_generate_clicked()
else
yData.at<double>(i) = v2_surf.at(i);
}
#if MRPT_OPENCV_VERSION_NUM >= 0x330
#if MRPT_OPENCV_VERSION_NUM >= 0x030300
plot = plot::Plot2d::create(xData, yData);
#else
plot = plot::createPlot2d(xData, yData);
Expand Down
6 changes: 3 additions & 3 deletions apps/mrpt-performance/perf-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ int main(int argc, char** argv)

const string fil_name = PERF_DATA_DIR +
mrpt::format("/perf-results-%i.%i.%i%s-%s-%ibit.dat",
int((MRPT_VERSION >> 8) & 0x0F),
int((MRPT_VERSION >> 4) & 0x0F),
int((MRPT_VERSION >> 0) & 0x0F), version_postfix,
int((MRPT_VERSION >> 16) & 0xFF),
int((MRPT_VERSION >> 8) & 0xFF),
int((MRPT_VERSION >> 0) & 0xFF), version_postfix,
compiler_name, int(MRPT_WORD_SIZE));
cout << "Saving perf-data to: " << fil_name << endl;
CFileOutputStream f(fil_name);
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# version format
version: 2.10.1-{branch}-build{build}
version: 2.10.2-{branch}-build{build}

os: Visual Studio 2019

Expand Down
49 changes: 14 additions & 35 deletions cmakemodules/UtilsMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,42 +57,21 @@ macro(pkgconfig_parse _FLAGS _OUT_PREFIX)
endforeach(str)
endmacro(pkgconfig_parse )

# Convert a decimal value [0,15] to hexadecimal
# From: http://stackoverflow.com/questions/26182289/convert-from-decimal-to-hexadecimal-in-cmake
macro(DECCHAR2HEX VAR VAL)
if (${VAL} LESS 10)
set(${VAR} ${VAL})
elseif(${VAL} EQUAL 10)
set(${VAR} "A")
elseif(${VAL} EQUAL 11)
set(${VAR} "B")
elseif(${VAL} EQUAL 12)
set(${VAR} "C")
elseif(${VAL} EQUAL 13)
set(${VAR} "D")
elseif(${VAL} EQUAL 14)
set(${VAR} "E")
elseif(${VAL} EQUAL 15)
set(${VAR} "F")
else(${VAL} LESS 10)
message(FATAL_ERROR "Invalid format for hexidecimal character")
endif(${VAL} LESS 10)
endmacro(DECCHAR2HEX)

# Converts a version like "1.2.3" into a string "0x123"
# Converts a version like "1.2.3" into a string "0x10203",
# or "3.4.19" into "0x30413".
# Usage: VERSION_TO_HEXADECIMAL(TARGET_VAR "1.2.3")
macro(VERSION_TO_HEXADECIMAL OUT_VAR IN_VERSION)
string(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${IN_VERSION}")
list(GET VERSION_PARTS 0 VERSION_NUMBER_MAJOR)
list(GET VERSION_PARTS 1 VERSION_NUMBER_MINOR)
list(GET VERSION_PARTS 2 VERSION_NUMBER_PATCH)
# Convert each part to hex:
DECCHAR2HEX(VERSION_NUMBER_MAJOR_HEX ${VERSION_NUMBER_MAJOR})
DECCHAR2HEX(VERSION_NUMBER_MINOR_HEX ${VERSION_NUMBER_MINOR})
DECCHAR2HEX(VERSION_NUMBER_PATCH_HEX ${VERSION_NUMBER_PATCH})
# Concat version string:
set(${OUT_VAR} "0x${VERSION_NUMBER_MAJOR_HEX}${VERSION_NUMBER_MINOR_HEX}${VERSION_NUMBER_PATCH_HEX}")
endmacro(VERSION_TO_HEXADECIMAL)
macro(VERSION_TO_HEXADECIMAL OUT_VAR IN_VERSION)
string(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${IN_VERSION}")
list(GET VERSION_PARTS 0 VERSION_NUMBER_MAJOR)
list(GET VERSION_PARTS 1 VERSION_NUMBER_MINOR)
list(GET VERSION_PARTS 2 VERSION_NUMBER_PATCH)

# Convert each part to hex:
math(EXPR ${OUT_VAR}
"(${VERSION_NUMBER_MAJOR} << 16) + \
(${VERSION_NUMBER_MINOR} << 8) + \
(${VERSION_NUMBER_PATCH})" OUTPUT_FORMAT HEXADECIMAL )
endmacro()


# GOOD & BAD are single strings, INPUT is a list wrapped in string
Expand Down
31 changes: 4 additions & 27 deletions cmakemodules/script_create_version_h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,8 @@
# ----------------------------------------------------------------------------
set(CMAKE_MRPT_COMPLETE_NAME "MRPT ${CMAKE_MRPT_VERSION_NUMBER_MAJOR}.${CMAKE_MRPT_VERSION_NUMBER_MINOR}.${CMAKE_MRPT_VERSION_NUMBER_PATCH}")

# There is no built-in support for dec to hex in cmake, sigh...
function(digit_to_hex DIGIT RET)
if (NOT ${DIGIT} GREATER 9)
set(${RET} ${DIGIT} PARENT_SCOPE)
elseif (${DIGIT} MATCHES "10")
set(${RET} "A" PARENT_SCOPE)
elseif (${DIGIT} MATCHES "11")
set(${RET} "B" PARENT_SCOPE)
elseif (${DIGIT} MATCHES "12")
set(${RET} "C" PARENT_SCOPE)
elseif (${DIGIT} MATCHES "13")
set(${RET} "D" PARENT_SCOPE)
elseif (${DIGIT} MATCHES "14")
set(${RET} "E" PARENT_SCOPE)
elseif (${DIGIT} MATCHES "15")
set(${RET} "F" PARENT_SCOPE)
endif()
endfunction()

digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_MAJOR} CMAKE_MRPT_VERSION_NUMBER_MAJOR_HEX)
digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_MINOR} CMAKE_MRPT_VERSION_NUMBER_MINOR_HEX)
digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_PATCH} CMAKE_MRPT_VERSION_NUMBER_PATCH_HEX)

# Build a three digits version code, eg. 0.5.1 -> 051, 1.2.0 -> 120
set(CMAKE_MRPT_VERSION_CODE "0x${CMAKE_MRPT_VERSION_NUMBER_MAJOR_HEX}${CMAKE_MRPT_VERSION_NUMBER_MINOR_HEX}${CMAKE_MRPT_VERSION_NUMBER_PATCH_HEX}")
# Build a six digits hex version code, eg. 1.2.0 -> 0x010200
VERSION_TO_HEXADECIMAL(CMAKE_MRPT_VERSION_CODE ${CMAKE_MRPT_COMPLETE_NAME})

# SOURCE_DATE_EPOCH: See Specs in https://reproducible-builds.org/specs/source-date-epoch/
# Take its value from:
Expand Down Expand Up @@ -80,6 +57,6 @@ if (WIN32)
${MRPT_BINARY_DIR}/version.rc
@ONLY)
set(MRPT_VERSION_RC_FILE "${MRPT_BINARY_DIR}/version.rc")
else(WIN32)
else()
set(MRPT_VERSION_RC_FILE "")
endif (WIN32)
endif()
1 change: 1 addition & 0 deletions doc/graphslam-engine-guide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ graphslam-engine-guide.ps.gz: graphslam-engine-guide.pdf

clean:
latexmk -CA
rm *.bbl *.nlo

6 changes: 3 additions & 3 deletions doc/man-pages/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ if (PROG_GZIP AND PROG_POD2MAN)
# Macro for declaring man-pages targets:
macro(CREATE_MANPAGE_PROJECT appname)
add_custom_target(man_page_${appname}
COMMAND pod2man --center="Mobile Robot Programming Toolkit - MRPT" ${MRPT_SOURCE_DIR}/doc/man-pages/pod/${appname}.pod |gzip -c > ${MRPT_BINARY_DIR}/man-pages/${appname}.1.gz
WORKING_DIRECTORY ${MRPT_SOURCE_DIR}/
COMMAND pod2man --center="Mobile Robot Programming Toolkit - MRPT" ${MRPT_SOURCE_DIR}/doc/man-pages/pod/${appname}.pod | gzip -c > ${appname}.1.gz
WORKING_DIRECTORY "${MRPT_BINARY_DIR}/man-pages"
COMMENT "Generating MRPT man pages"
)
add_dependencies(man_pages_all man_page_${appname})
if (UNIX)
install(FILES "${MRPT_BINARY_DIR}/man-pages/${appname}.1.gz" DESTINATION ${mrpt_apps_INSTALL_PREFIX}share/man/man1/ )
endif()
endmacro(CREATE_MANPAGE_PROJECT)
endmacro()

# The main (empty) target:
add_custom_target(man_pages_all ALL)
Expand Down
37 changes: 32 additions & 5 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
sphinx_rtd_theme
sphinx_design
sphinxcontrib-bibtex
mistune<2.0.0
m2r2
alabaster==0.7.13
Babel==2.12.1
certifi==2023.7.22
charset-normalizer==3.2.0
docutils==0.17.1
idna==3.4
imagesize==1.4.1
Jinja2==3.1.2
latexcodec==2.0.1
m2r2==0.3.2
MarkupSafe==2.1.3
mistune==0.8.4
packaging==23.1
pybtex==0.24.0
pybtex-docutils==1.0.3
Pygments==2.16.1
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==1.3.0
sphinx_design==0.5.0
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-bibtex==2.6.1
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
urllib3==2.0.6
16 changes: 16 additions & 0 deletions doc/source/doxygen-docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
\page changelog Change Log

# Version 2.10.2: Released Oct 5th, 2023
- Build system:
- ROS: fix missing deps in package.xml needed for build via Nix.
- MRPT and OpenCV versions were until now exposed as macros with 3 hexadecimal digits (e.g. `2.4.0`->`0x240`), with a clear limitation of versions greater than 15. Now, both symbols `MRPT_VERSION` and `MRPT_OPENCV_VERSION_NUM` use TWO hexadecimal digits per version part, like: `2.10.2` -> `0x010A02`, which is much more general and safe for the future. For backwards compatibility, just make sure your user code only uses `MRPT_VERSION>=xxx` or `MRPT_VERSION>xxx` comparisons, instead of less-than comparisons (Fixes [issue #1285](https://github.com/MRPT/mrpt/issues/1285)).
- Changes in apps:
- rawlog-edit: Add `--select-label` optional filter to command `--remap-timestamps`.
- Changes in libraries:
- mrpt-ros1bridge and mrpt-ros2bridge: Remove leftover printf debugging trace printing ``Ok`` to console.
- \ref mrpt_hwdrivers_grp
- New overload mrpt::hwdrivers::CFFMPEG_InputStream::retrieveFrame() returning the frame PTS (presentation timestamp).
- BUG FIXES:
- Fix CSparse "C" linkage build error (OSX Clang). PR [#1280](https://github.com/MRPT/mrpt/pull/1280)
- Fix missing Python wrapping of poses PDF (poses with uncertainty) composition (\oplus and \ominus) operators. (Closes [#1281](https://github.com/MRPT/mrpt/issues/1281)). PR [#1283](https://github.com/MRPT/mrpt/pull/1283)
- Fix wrong Jacobian in mrpt::math::CQuaternion::rpy_and_jacobian() for the case of Gimbal Lock. Thanks @giafranchini for reporting!. PR [#1290](https://github.com/MRPT/mrpt/pull/1290) (Closes [#1289](https://github.com/MRPT/mrpt/issues/1289))
- Fix spurious failures in offscreen render unit tests in RISCV64 (Closes [#1287](https://github.com/MRPT/mrpt/issues/1287)).

# Version 2.10.1: Released August 10th, 2023
- Build system:
- Add cmake flag to disable LTO in pymrpt module.
Expand Down
11 changes: 10 additions & 1 deletion libs/apps/src/RawlogEditApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ TCLAP::SwitchArg arg_overwrite(
"w", "overwrite", "Force overwrite target file without prompting.", cmd,
false);

TCLAP::ValueArg<std::string> arg_select_label(
"", "select-label",
"Select one sensor label on which to apply the operation.\n"
"Several labels can be provided separated by commas.\n"
"Only for those ops that mention --select-label as optional.",
false, "", "label[,label...]", cmd);

TCLAP::SwitchArg arg_quiet("q", "quiet", "Terse output", cmd, false);

void RawlogEditApp::run(int argc, const char** argv)
Expand Down Expand Up @@ -232,8 +239,10 @@ void RawlogEditApp::run(int argc, const char** argv)
"'a*t+b'."
"The parameters 'a' and 'b' must be given separated with a "
"semicolon.\n"
"Optional: --select-label LABEL1[,LABEL2] to limit the operation to "
"those sensors only.\n"
"Requires: -o (or --output)",
false, "", "a;b", cmd));
false, "", "\"a;b\"", cmd));
ops_functors["remap-timestamps"] = &op_remap_timestamps;

arg_ops.push_back(std::make_unique<TCLAP::SwitchArg>(
Expand Down
62 changes: 55 additions & 7 deletions libs/apps/src/rawlog-edit_remap_timestamps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,67 @@ DECLARE_OP_FUNCTION(op_remap_timestamps)
protected:
TOutputRawlogCreator outrawlog;
const double m_a, m_b;
const std::set<std::string> m_labels; //!< empty: all sensors
size_t m_changes = 0;

public:
CRawlogProcessor_RemapTimestamps(
CFileGZInputStream& in_rawlog, TCLAP::CmdLine& cmdline,
bool Verbose, double a, double b)
bool Verbose, double a, double b,
const std::set<std::string>& labels)
: CRawlogProcessorOnEachObservation(in_rawlog, cmdline, Verbose),
m_a(a),
m_b(b)
m_b(b),
m_labels(labels)
{
VERBOSE_COUT << "Applying timestamps remap a*t+b with: a=" << m_a
<< " b=" << m_b << endl;
VERBOSE_COUT
<< mrpt::format(
"Applying timestamps remap a*t+b with: a=%f b=%f", m_a,
m_b)
<< std::endl;

std::string sLog = "Applying to sensor labels: ";
if (m_labels.empty()) { sLog += " (all)\n"; }
else
{
for (const auto& l : m_labels)
{
sLog += "'";
sLog += l;
sLog += "', ";
}
sLog += "\n";
}
VERBOSE_COUT << sLog;
}

~CRawlogProcessor_RemapTimestamps()
{
VERBOSE_COUT << "Changed objects: " << m_changes << "\n";
}

bool checkSensorLabel(const CObservation::Ptr& obs)
{
if (m_labels.empty()) return true;
return m_labels.count(obs->sensorLabel) != 0;
}

bool processOneObservation(CObservation::Ptr& obs) override
{
// does it apply?
if (!checkSensorLabel(obs)) return true;

// T_NEW = a * T_OLD + b
const double t = mrpt::system::timestampToDouble(obs->timestamp);
const double t_new = m_a * t + m_b;
obs->timestamp = mrpt::system::time_tToTimestamp(t_new);

m_changes++;
return true;
}

// This method can be reimplemented to save the modified object to an
// output stream.
// This method can be reimplemented to save the modified object to
// an output stream.
void OnPostProcess(
mrpt::obs::CActionCollection::Ptr& actions,
mrpt::obs::CSensoryFrame::Ptr& SF,
Expand Down Expand Up @@ -85,9 +122,20 @@ DECLARE_OP_FUNCTION(op_remap_timestamps)
const double a = atof(sAB_tokens[0].c_str());
const double b = atof(sAB_tokens[1].c_str());

string filter_labels;
getArgValue<string>(cmdline, "select-label", filter_labels);

std::vector<std::string> lbs;
mrpt::system::tokenize(filter_labels, ",", lbs);

std::set<std::string> applyLabels;
for (const auto& l : lbs)
applyLabels.insert(l);

// Process
// ---------------------------------
CRawlogProcessor_RemapTimestamps proc(in_rawlog, cmdline, verbose, a, b);
CRawlogProcessor_RemapTimestamps proc(
in_rawlog, cmdline, verbose, a, b, applyLabels);
proc.doProcessRawlog();

// Dump statistics:
Expand Down
Loading

0 comments on commit aad8f34

Please sign in to comment.