From 2e14cee3868a369aa175bfc645e406d3338b2911 Mon Sep 17 00:00:00 2001 From: Hoop77 <p.badenhoop@gmx.de> Date: Thu, 10 May 2018 13:07:22 +0200 Subject: [PATCH] - --- .../VeloxProtocolLib/test/SpeedMeasure.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp b/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp index a0e89053..719757d5 100644 --- a/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp +++ b/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp @@ -2,12 +2,24 @@ // Created by philipp on 10.05.18. // +#include <iostream> #include "../include/VeloxProtocolLib/Connection.h" int main(int argc, char ** argv) { using namespace veloxProtocol; using namespace std::chrono_literals; + + if (argc < 4) + { + std::cerr << "Usage: speed angle time[s]\n"; + return -1; + } + + float speed = atof(argv[1]); + float angle = atof(argv[2]); + int time = atoi(argv[3]); + networking::Networking net; std::atomic<bool> running{true}; auto conn = Connection::create(net); @@ -18,11 +30,12 @@ int main(int argc, char ** argv) [] {}); + conn->setSpeed(speed); + conn->setSteeringAngle(angle); + auto timer = networking::time::Timer::create(net); - conn->setSteeringAngle(-4.0f); - conn->setSpeed(1.0f); timer->startTimeout( - 10s, + std::chrono::seconds{time}, [&] { conn->setSpeed(0.0f); -- GitLab