diff --git a/include/create/create.h b/include/create/create.h index 4e03b61..14ede01 100644 --- a/include/create/create.h +++ b/include/create/create.h @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include @@ -79,7 +80,7 @@ namespace create { float totalLeftDist; float totalRightDist; bool firstOnData; - util::timestamp_t prevOnDataTime; + std::chrono::time_point prevOnDataTime; Matrix poseCovar; diff --git a/include/create/util.h b/include/create/util.h index 6a28f06..3d4d8c5 100644 --- a/include/create/util.h +++ b/include/create/util.h @@ -32,8 +32,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef CREATE_UTIL_H #define CREATE_UTIL_H -#include - #define COUT(prefix,msg) (std::cout< std::numeric_limits::max() - std::abs(a) ); } diff --git a/src/create.cpp b/src/create.cpp index c023c8a..10846e5 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -94,13 +94,13 @@ namespace create { prevTicksLeft = GET_DATA(ID_LEFT_ENC); prevTicksRight = GET_DATA(ID_RIGHT_ENC); } - prevOnDataTime = util::getTimestamp(); + prevOnDataTime = std::chrono::system_clock::now(); firstOnData = false; } // Get current time - util::timestamp_t curTime = util::getTimestamp(); - float dt = (curTime - prevOnDataTime) / 1000000.0; + auto curTime = std::chrono::system_clock::now(); + float dt = static_cast>(curTime - prevOnDataTime).count(); float deltaDist, deltaX, deltaY, deltaYaw, leftWheelDist, rightWheelDist, wheelDistDiff; // Protocol versions 1 and 2 use distance and angle fields for odometry