Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Apr 4, 2024
2 parents 4138f43 + 1b178c8 commit bab10bc
Show file tree
Hide file tree
Showing 91 changed files with 746 additions and 399 deletions.
4 changes: 3 additions & 1 deletion 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ endif()
# Build RPLIDAR?
# ----------------------------------
if(CMAKE_MRPT_HAS_ROBOPEAK_LIDAR)
set(RPLIDAR_ROOT ${MRPT_SOURCE_DIR}/3rdparty/rplidar_sdk/sdk/sdk/)
set(RPLIDAR_ROOT ${MRPT_SOURCE_DIR}/3rdparty/rplidar_sdk/sdk/)
set(SRCS_LIST
${RPLIDAR_ROOT}/src/*.cpp
${RPLIDAR_ROOT}/src/hal/*.cpp
${RPLIDAR_ROOT}/src/dataunpacker/*.cpp
${RPLIDAR_ROOT}/src/dataunpacker/unpacker/*.cpp
${RPLIDAR_ROOT}/include/*.h
)
if (WIN32)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/rplidar_sdk
Submodule rplidar_sdk updated 173 files
3 changes: 3 additions & 0 deletions 3rdparty/xspublic/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DisableFormat: true
SortIncludes: Never

14 changes: 7 additions & 7 deletions 3rdparty/xspublic/xscontroller/broadcastdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class BroadcastForwardFunc {
class ForwardConstFunc : public BroadcastForwardFunc {
public:
typedef bool (XsDevice::*FuncType)() const;
inline ForwardConstFunc (BroadcastDevice* bc, FuncType func)
: BroadcastForwardFunc(bc), m_func(func) {}
inline ForwardConstFunc (const BroadcastDevice* bc, FuncType func)
: BroadcastForwardFunc(const_cast<BroadcastDevice*>(bc)), m_func(func) {}
virtual bool call(XsDevice* device) { return (device->*m_func)(); }
private:
FuncType m_func;
Expand All @@ -95,8 +95,8 @@ template <typename Arg1>
class ForwardConstFunc1Arg : public BroadcastForwardFunc {
public:
typedef bool (XsDevice::*FuncType)(Arg1) const;
inline ForwardConstFunc1Arg (BroadcastDevice* bc, FuncType func, Arg1 arg1)
: BroadcastForwardFunc(bc), m_func(func), m_arg1(arg1) {}
inline ForwardConstFunc1Arg (const BroadcastDevice* bc, FuncType func, Arg1 arg1)
: BroadcastForwardFunc(const_cast<BroadcastDevice*>(bc)), m_func(func), m_arg1(arg1) {}
virtual bool call(XsDevice* device) { return (device->*m_func)(m_arg1); }
private:
FuncType m_func;
Expand Down Expand Up @@ -321,17 +321,17 @@ bool BroadcastDevice::abortFlushing()

bool BroadcastDevice::isMeasuring() const
{
return ForwardConstFunc(const_cast<BroadcastDevice* const>(this), &XsDevice::isMeasuring)();
return ForwardConstFunc(const_cast<const BroadcastDevice*>(this), &XsDevice::isMeasuring)();
}

bool BroadcastDevice::isRecording() const
{
return ForwardConstFunc(const_cast<BroadcastDevice* const>(this), &XsDevice::isRecording)();
return ForwardConstFunc(const_cast<const BroadcastDevice*>(this), &XsDevice::isRecording)();
}

bool BroadcastDevice::isReadingFromFile() const
{
return ForwardConstFunc(const_cast<BroadcastDevice* const>(this), &XsDevice::isReadingFromFile)();
return ForwardConstFunc(const_cast<const BroadcastDevice*>(this), &XsDevice::isReadingFromFile)();
}

bool BroadcastDevice::gotoConfig()
Expand Down
6 changes: 5 additions & 1 deletion 3rdparty/xspublic/xscontroller/enumexpanders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ JLENUMEXPANDER(XsConnectivityState,
JLENUMCASE(XCS_Unknown)
)

static void forceEnumExpanderInclusion()
namespace
{
[[maybe_unused]] void forceEnumExpanderInclusion()
{
volatile bool blah = false;
(void)blah;
JLWRITEG("blah" << XDS_Initial << blah);
JLWRITEG("blah" << XOP_Unknown << blah);
JLWRITEG("blah" << XCS_File << blah);
}
}
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/mti6x0device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ MtiBaseDevice::BaseFrequencyResult Mti6X0Device::getBaseFrequencyInternal(XsData
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 400;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/xspublic/xscontroller/mti7device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ MtiBaseDevice::BaseFrequencyResult Mti7Device::getBaseFrequencyInternal(XsDataId
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 100;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand All @@ -93,7 +93,7 @@ MtiBaseDevice::BaseFrequencyResult Mti7Device::getBaseFrequencyInternal(XsDataId
case XDI_PressureGroup: return 50;
case XDI_GnssGroup:
{
if ((dataType & XDI_FullTypeMask) == XDI_GnssPvtData)
if ((data_type & XDI_FullTypeMask) == XDI_GnssPvtData)
return 4;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/mtigdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ MtiBaseDevice::BaseFrequencyResult MtigDevice::getBaseFrequencyInternal(XsDataId
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
XsVersion const legacyFwVersion(MTMK4_700_LEGACY_FW_VERSION_MAJOR, MTMK4_700_LEGACY_FW_VERSION_MINOR, MTMK4_700_LEGACY_FW_VERSION_REVISION);
bool const isLegacyFirmware = (firmwareVersion() <= legacyFwVersion);

switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 2000;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/mtix00device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ MtiBaseDevice::BaseFrequencyResult MtiX00Device::getBaseFrequencyInternal(XsData
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 2000;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/mtix0device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ MtiBaseDevice::BaseFrequencyResult MtiX0Device::getBaseFrequencyInternal(XsDataI
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 2000;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/mtixdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ MtiBaseDevice::BaseFrequencyResult MtiXDevice::getBaseFrequencyInternal(XsDataId
return result;
}

auto baseFreq = [&](XsDataIdentifier dataType)
auto baseFreq = [&](XsDataIdentifier data_type)
{
switch (dataType & XDI_TypeMask)
switch (data_type & XDI_TypeMask)
{
case XDI_None: return 100;
case XDI_TimestampGroup: return XDI_MAX_FREQUENCY_VAL;
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/serialcommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ XsResultValue SerialCommunicator::gotoConfig(bool detectRs485)
while (true)
{
std::shared_ptr<ReplyObject> reply2 = addReplyObject(XMID_GotoConfigAck);
XsMessage rcv = reply2->message(100);
if (rcv.getMessageId() != XMID_GotoConfigAck)
XsMessage rcv2 = reply2->message(100);
if (rcv2.getMessageId() != XMID_GotoConfigAck)
break;
}

Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/serialinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ XsResultValue SerialInterface::readData(XsFilePos maxLength, XsByteArray& data)
}
else
{
int err = errno;
int err2 = errno;

data.clear();
switch (err)
switch (err2)
{
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/xspublic/xscontroller/xsdevice_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ XsOutputConfiguration XsDevice::findConfiguration(XsDataIdentifier dataType) con

XsOutputConfigurationArray cfg = outputConfiguration();
auto item = std::find_if(cfg.begin(), cfg.end(),
[&](const XsOutputConfiguration &cfg)
[&](const XsOutputConfiguration &cfg2)
{
return (cfg.m_dataIdentifier & mask) == dataType;
return (cfg2.m_dataIdentifier & mask) == dataType;
}

);
Expand Down
8 changes: 4 additions & 4 deletions 3rdparty/xspublic/xscontroller/xsdeviceconfiguration.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ void XsDeviceConfiguration_readFromMessage(XsDeviceConfiguration* thisPtr, const
for (i = 0; i < nDevs; ++i)
{
thisPtr->m_deviceInfo[i].m_deviceId = XsMessage_getDataLong(msg, 98+i*20);
XsDeviceId deviceId = {thisPtr->m_deviceInfo[i].m_deviceId, XSDEVICEID_PRODUCT_CODE_INIT, 0, 0};
if (XsDeviceId_isLegacyDeviceId(&deviceId))
XsDeviceId deviceId2 = {thisPtr->m_deviceInfo[i].m_deviceId, XSDEVICEID_PRODUCT_CODE_INIT, 0, 0};
if (XsDeviceId_isLegacyDeviceId(&deviceId2))
{
thisPtr->m_deviceInfo[i].m_deviceId = (uint32_t)XsMessage_getDataLong(msg, 98+i*20);
memcpy(thisPtr->m_deviceInfo[i].m_reserved, XsMessage_getDataBuffer(msg, 102 + i * 20), 8);
Expand Down Expand Up @@ -214,8 +214,8 @@ void XsDeviceConfiguration_writeToMessage(const XsDeviceConfiguration* thisPtr,

for (i = 0; i < thisPtr->m_numberOfDevices; ++i)
{
XsDeviceId deviceId = {thisPtr->m_deviceInfo[i].m_deviceId, XSDEVICEID_PRODUCT_CODE_INIT, 0, 0};
if (XsDeviceId_isLegacyDeviceId(&deviceId))
XsDeviceId deviceId2 = {thisPtr->m_deviceInfo[i].m_deviceId, XSDEVICEID_PRODUCT_CODE_INIT, 0, 0};
if (XsDeviceId_isLegacyDeviceId(&deviceId2))
{
XsMessage_setDataLong (msg, (uint32_t)thisPtr->m_deviceInfo[i].m_deviceId, 98+i*20);
XsMessage_setDataBuffer(msg, thisPtr->m_masterInfo.m_reserved1, 8, 102+i*20);
Expand Down
8 changes: 5 additions & 3 deletions 3rdparty/xspublic/xstypes/xstime.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# include <windows.h>
# define snprintf _snprintf
#else
# include <errno.h>
//# include <errno.h>
# include <unistd.h>
# include <sys/time.h>
# include <pthread.h>
Expand Down Expand Up @@ -201,7 +201,8 @@ void XsTime_getDateAsString(char* dest, const struct tm* date)

year = dt.tm_year + 1900;
month = dt.tm_mon + 1;
snprintf(dest, 9, "%04d%02d%02d", year, month, dt.tm_mday);
volatile int dst_size = 9; // JLBC: just to supress truncation warning
snprintf(dest, dst_size, "%04d%02d%02d", year, month, dt.tm_mday);
}

/*! \brief Retrieves the time as binary
Expand All @@ -220,7 +221,8 @@ void XsTime_getTimeAsString(char* dest, const struct tm* date)
else
XsTime_getDateTime(&dt);

snprintf(dest, 8, "%02d%02d%02d%02d", dt.tm_hour, dt.tm_min, dt.tm_sec, 0);
volatile int dst_size = 8; // JLBC: just to supress truncation warning
snprintf(dest, dst_size, "%02d%02d%02d%02d", dt.tm_hour, dt.tm_min, dt.tm_sec, 0);
}

/*! \brief Retrieves the date as wstring representation
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endif()


if ((NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/nanogui/include")
OR (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rplidar_sdk/sdk/sdk")
OR (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rplidar_sdk/sdk/src")
)
message(FATAL_ERROR "git submodules missing! "
"You probably did not clone the project with --recursive. It is possible to recover "
Expand Down
4 changes: 3 additions & 1 deletion apps/DifOdometry-Camera/DifOdometry_Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ void CDifodoCamera::initializeScene()

// User-interface information
img::CImage img_legend;
img_legend.loadFromXPM(legend_xpm);
bool loadOk = img_legend.loadFromXPM(legend_xpm);
ASSERT_(loadOk);

Viewport::Ptr legend = scene->createViewport("legend");
legend->setViewportPosition(20, 20, 350, 201);
legend->setImageView(img_legend);
Expand Down
4 changes: 3 additions & 1 deletion apps/DifOdometry-Datasets/DifOdometry_Datasets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ void CDifodoDatasets::initializeScene()

// User-interface information
CImage img_legend;
img_legend.loadFromXPM(legend_xpm);
bool loadOk = img_legend.loadFromXPM(legend_xpm);
ASSERT_(loadOk);

Viewport::Ptr legend = scene->createViewport("legend");
legend->setViewportPosition(20, 20, 332, 164);
legend->setImageView(img_legend);
Expand Down
6 changes: 4 additions & 2 deletions apps/RawLogViewer/CFormPlayVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,8 @@ void CFormPlayVideo::saveCamImage(int n)

string fil = string(dialog.GetPath().mb_str());

o->image.saveToFile(fil);
bool savedOk = o->image.saveToFile(fil);
ASSERT_(savedOk);
}
else if (IS_CLASS(*displayedImgs[n], CObservationStereoImages))
{
Expand Down Expand Up @@ -1124,7 +1125,8 @@ void CFormPlayVideo::saveCamImage(int n)
CImage& im =
(n == 2 ? o->imageDisparity
: (n == 1 ? o->imageRight : o->imageLeft));
im.saveToFile(fil);
bool savedOk = im.saveToFile(fil);
ASSERT_(savedOk);
}

WX_END_TRY
Expand Down
12 changes: 9 additions & 3 deletions apps/RawLogViewer/main_convert_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ void xRawLogViewerFrame::OnMenuConvertExternallyStored(wxCommandEvent& event)
string fileName = format(
"img_stereo_%u_left_%05u.%s", k, imgSaved,
imgFileExtension.c_str());
obsSt->imageLeft.saveToFile(outDir + fileName);
bool savedOk =
obsSt->imageLeft.saveToFile(outDir + fileName);
ASSERT_(savedOk);
obsSt->imageLeft.setExternalStorage(fileName);

imgSaved++;
Expand All @@ -607,7 +609,9 @@ void xRawLogViewerFrame::OnMenuConvertExternallyStored(wxCommandEvent& event)
fileName = format(
"img_stereo_%u_right_%05u.%s", k, imgSaved,
imgFileExtension.c_str());
obsSt->imageRight.saveToFile(outDir + fileName);
savedOk =
obsSt->imageRight.saveToFile(outDir + fileName);
ASSERT_(savedOk);
obsSt->imageRight.setExternalStorage(fileName);

imgSaved++;
Expand All @@ -623,7 +627,9 @@ void xRawLogViewerFrame::OnMenuConvertExternallyStored(wxCommandEvent& event)
string fileName = format(
"img_monocular_%u_%05u.%s", k, imgSaved,
imgFileExtension.c_str());
obsIm->image.saveToFile(outDir + fileName);
bool savedOk =
obsIm->image.saveToFile(outDir + fileName);
ASSERT_(savedOk);
obsIm->image.setExternalStorage(fileName);

imgSaved++;
Expand Down
Loading

0 comments on commit bab10bc

Please sign in to comment.