Skip to content
Snippets Groups Projects
Commit 5219e46c authored by Hoop77's avatar Hoop77 Committed by lenoelda
Browse files

commandToolUpdate

parent c99c923e
No related merge requests found
...@@ -15,6 +15,7 @@ int main(int argc, char ** argv) ...@@ -15,6 +15,7 @@ int main(int argc, char ** argv)
networking::Networking net; networking::Networking net;
std::atomic<bool> monitorSTM{false}; std::atomic<bool> monitorSTM{false};
std::atomic<bool> monitorUSS{false}; std::atomic<bool> monitorUSS{false};
std::atomic<bool> speed{0.0f};
std::atomic<bool> running{true}; std::atomic<bool> running{true};
std::mutex outputMutex; std::mutex outputMutex;
auto conn = Connection::create(net); auto conn = Connection::create(net);
...@@ -40,8 +41,10 @@ int main(int argc, char ** argv) ...@@ -40,8 +41,10 @@ int main(int argc, char ** argv)
while (running) while (running)
{ {
int distance = uss.getDistance(); int distance = uss.getDistance();
//if (distance > 20) if (distance <= 20)
//conn->setSpeed(0); conn->setSpeed(0);
else
conn->setSpeed(speed);
if (!monitorUSS) if (!monitorUSS)
continue; continue;
...@@ -96,7 +99,7 @@ int main(int argc, char ** argv) ...@@ -96,7 +99,7 @@ int main(int argc, char ** argv)
value = value >= 0 ? MAX_SPEED : -MAX_SPEED; value = value >= 0 ? MAX_SPEED : -MAX_SPEED;
std::cout << "WARNING: Speed set to 1.0 due to risk of collision!\n"; 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"; else std::cout << "Error: Unknown command!\n";
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment