From e31ffac08d8acc8d8757302304c179218a75010a Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 5 Feb 2019 13:40:27 +0900 Subject: [PATCH 1/3] enable to run on melodic --- include/create/serial.h | 3 ++- src/serial.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/create/serial.h b/include/create/serial.h index 9dd9bc3..28b5f69 100644 --- a/include/create/serial.h +++ b/include/create/serial.h @@ -40,13 +40,14 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "create/data.h" #include "create/types.h" #include "create/util.h" namespace create { - class Serial { + class Serial : public boost::enable_shared_from_this { protected: boost::asio::io_service io; diff --git a/src/serial.cpp b/src/serial.cpp index 3894b9e..12876aa 100644 --- a/src/serial.cpp +++ b/src/serial.cpp @@ -72,7 +72,7 @@ namespace create { // Start continuously reading one byte at a time boost::asio::async_read(port, boost::asio::buffer(&byteRead, 1), - boost::bind(&Serial::onData, this, _1, _2)); + boost::bind(&Serial::onData, shared_from_this(), _1, _2)); ioThread = boost::thread(boost::bind(&boost::asio::io_service::run, &io)); @@ -145,7 +145,7 @@ namespace create { // Read the next byte boost::asio::async_read(port, boost::asio::buffer(&byteRead, 1), - boost::bind(&Serial::onData, this, _1, _2)); + boost::bind(&Serial::onData, shared_from_this(), _1, _2)); } bool Serial::send(const uint8_t* bytes, unsigned int numBytes) { From d2cc4b9552156de2a8d2229e4fe778af9ff8ca86 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Thu, 7 Mar 2019 17:28:55 +0900 Subject: [PATCH 2/3] fix odom velocity --- src/create.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/create.cpp b/src/create.cpp index 2e00cf1..947f62d 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -186,14 +186,10 @@ namespace create { totalLeftDist += leftWheelDist; totalRightDist += rightWheelDist; - if (fabs(dt) > util::EPS) { + if (dt > 0.1) { vel.x = deltaDist / dt; vel.y = 0.0; vel.yaw = deltaYaw / dt; - } else { - vel.x = 0.0; - vel.y = 0.0; - vel.yaw = 0.0; } // Update covariances From 24bb9ebe7a40bd1e06307cd5bd723599371848d6 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Sat, 9 Mar 2019 11:21:10 +0900 Subject: [PATCH 3/3] Revert "fix odom velocity" This reverts commit d2cc4b9552156de2a8d2229e4fe778af9ff8ca86. --- src/create.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/create.cpp b/src/create.cpp index 947f62d..2e00cf1 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -186,10 +186,14 @@ namespace create { totalLeftDist += leftWheelDist; totalRightDist += rightWheelDist; - if (dt > 0.1) { + if (fabs(dt) > util::EPS) { vel.x = deltaDist / dt; vel.y = 0.0; vel.yaw = deltaYaw / dt; + } else { + vel.x = 0.0; + vel.y = 0.0; + vel.yaw = 0.0; } // Update covariances