From 5219e46cd11d0d2130d5f7d4c3d65638f9527e8a Mon Sep 17 00:00:00 2001 From: Hoop77 <p.badenhoop@gmx.de> Date: Thu, 17 May 2018 14:47:05 +0200 Subject: [PATCH] commandToolUpdate --- .../src/VeloxProtocolLib/test/TerminalControl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/catkin_ws/src/VeloxProtocolLib/test/TerminalControl.cpp b/modules/catkin_ws/src/VeloxProtocolLib/test/TerminalControl.cpp index c8c0ded9..7898ff62 100644 --- a/modules/catkin_ws/src/VeloxProtocolLib/test/TerminalControl.cpp +++ b/modules/catkin_ws/src/VeloxProtocolLib/test/TerminalControl.cpp @@ -15,6 +15,7 @@ int main(int argc, char ** argv) networking::Networking net; std::atomic<bool> monitorSTM{false}; std::atomic<bool> monitorUSS{false}; + std::atomic<bool> speed{0.0f}; std::atomic<bool> running{true}; std::mutex outputMutex; auto conn = Connection::create(net); @@ -40,8 +41,10 @@ int main(int argc, char ** argv) while (running) { int distance = uss.getDistance(); - //if (distance > 20) - //conn->setSpeed(0); + if (distance <= 20) + conn->setSpeed(0); + else + conn->setSpeed(speed); if (!monitorUSS) continue; @@ -96,7 +99,7 @@ int main(int argc, char ** argv) value = value >= 0 ? MAX_SPEED : -MAX_SPEED; std::cout << "WARNING: Speed set to 1.0 due to risk of collision!\n"; } - conn->setSpeed(value); + speed = value; } else std::cout << "Error: Unknown command!\n"; } -- GitLab