Skip to content

Commit 6d634a4

Browse files
committed
readd logging macros
1 parent 6d2fe70 commit 6d634a4

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

cuckoo_time_translator_algorithms/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ find_package(catkin_simple REQUIRED)
55
catkin_simple()
66

77
find_package(Eigen REQUIRED)
8+
89
find_package(console_bridge REQUIRED)
10+
if(console_bridge_VERSION GREATER_EQUAL 0.4.0)
11+
add_definitions(-DDEFINE_LOGGING_MACROS)
12+
endif ()
913

1014
include_directories(
1115
${console_bridge_INCLUDE_DIRS}

cuckoo_time_translator_algorithms/include/cuckoo_time_translator/AbstractAssert.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33

44
#include <console_bridge/console.h>
55

6+
#ifdef DEFINE_LOGGING_MACROS
7+
8+
#define logError(fmt, ...) CONSOLE_BRIDGE_logError(fmt, ##__VA_ARGS__)
9+
#define logWarn(fmt, ...) CONSOLE_BRIDGE_logWarn(fmt, ##__VA_ARGS__)
10+
#define logInform(fmt, ...) CONSOLE_BRIDGE_logInform(fmt, ##__VA_ARGS__)
11+
#define logDebug(fmt, ...) CONSOLE_BRIDGE_logDebug(fmt, ##__VA_ARGS__)
12+
13+
#endif
14+
615
#define AASSERT(x, message) \
716
do { \
817
if (!(x)) { \
9-
CONSOLE_BRIDGE_logError("ASSERTION %s FAILED: %s (%s:%d)", #x, message, __FILE__, __LINE__); \
18+
logError("ASSERTION %s FAILED: %s (%s:%d)", #x, message, __FILE__, __LINE__); \
1019
throw std::runtime_error(message); \
1120
} \
1221
} while (0)

cuckoo_time_translator_algorithms/include/cuckoo_time_translator/TimestampUnwrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <stdint.h>
55

6+
#include "AbstractAssert.h"
67
#include "ClockParameters.h"
78

89
// TODO (c++11) remove this

cuckoo_time_translator_algorithms/src/KalmanOwt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ LocalTime KalmanOwt::updateAndTranslateToLocalTimestamp(const RemoteTime remoteT
7878
const double mahalDistance = sqrt(measurementResidual*measurementResidual*(1.0/S));
7979

8080
if(config.outlierThreshold && mahalDistance > config.outlierThreshold){
81-
CONSOLE_BRIDGE_logWarn("KalmanOwt: local_time=%f, remote_time=%f -> measurement_residual=%g, mahal_distance=%g!", localTimeSecs, remoteTimeTics, measurementResidual, mahalDistance);
81+
logWarn("KalmanOwt: local_time=%f, remote_time=%f -> measurement_residual=%g, mahal_distance=%g!", localTimeSecs, remoteTimeTics, measurementResidual, mahalDistance);
8282
} else {
8383
x_ = x_ + K * measurementResidual;
8484
P_ = (Eigen::Matrix2d::Identity() - K * H_) * P_;

cuckoo_time_translator_algorithms/src/TimestampUnwrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ void WrappingClockParameters::checkNewDeviceStamp(uint64_t wrapsCounter, uint64_
2828
maxStamp_ = std::max(newDeviceStamp, maxStamp_);
2929
if (newDeviceStamp >= wrapAroundNumber_){
3030
const uint64_t newWrapAroundNumber = newDeviceStamp + 1;
31-
CONSOLE_BRIDGE_logError("newDeviceStamp=%u is larger than wrapAroundNumber=%lu -> adapting wrapAroundNumber to %lu!", newDeviceStamp, wrapAroundNumber_, newWrapAroundNumber);
31+
logError("newDeviceStamp=%u is larger than wrapAroundNumber=%lu -> adapting wrapAroundNumber to %lu!", newDeviceStamp, wrapAroundNumber_, newWrapAroundNumber);
3232
wrapAroundNumber_ = newWrapAroundNumber;
3333
}
3434
if(wrapsCounter % 10 == 9 && uint64_t(maxStamp_) < wrapAroundNumber_ * 2u / 3u){
35-
CONSOLE_BRIDGE_logWarn("Last maxStamp=%u, suspiciously small! Maybe it wraps in fact earlier? (wrapAroundNumber=%lu)", maxStamp_, wrapAroundNumber_);
35+
logWarn("Last maxStamp=%u, suspiciously small! Maybe it wraps in fact earlier? (wrapAroundNumber=%lu)", maxStamp_, wrapAroundNumber_);
3636
}
3737
}
3838

0 commit comments

Comments
 (0)