diff --git a/modules/catkin_ws/src/VeloxProtocolLib/CMakeLists.txt b/modules/catkin_ws/src/VeloxProtocolLib/CMakeLists.txt index 7fae0258436d90ccdcf4b6f77a48b5f9664d533c..cde5ee083bc073ba8e3abb0e7cbfb63296c89f73 100644 --- a/modules/catkin_ws/src/VeloxProtocolLib/CMakeLists.txt +++ b/modules/catkin_ws/src/VeloxProtocolLib/CMakeLists.txt @@ -149,7 +149,11 @@ endif() # Test ####### add_executable(TerminalControl ${SOURCE_FILES} test/TerminalControl.cpp) +add_executable(SpeedMeasure ${SOURCE_FILES} test/SpeedMeasure.cpp) # NetworkingLib target_include_directories(TerminalControl PUBLIC ${NetworkingLib_INCLUDE_DIRS}) target_link_libraries(TerminalControl NetworkingLib) + +target_include_directories(SpeedMeasure PUBLIC ${NetworkingLib_INCLUDE_DIRS}) +target_link_libraries(SpeedMeasure NetworkingLib) \ No newline at end of file diff --git a/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp b/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a0e890538e167012a4ae8bea995b3f32bb624d5d --- /dev/null +++ b/modules/catkin_ws/src/VeloxProtocolLib/test/SpeedMeasure.cpp @@ -0,0 +1,35 @@ +// +// Created by philipp on 10.05.18. +// + +#include "../include/VeloxProtocolLib/Connection.h" + +int main(int argc, char ** argv) +{ + using namespace veloxProtocol; + using namespace std::chrono_literals; + networking::Networking net; + std::atomic<bool> running{true}; + auto conn = Connection::create(net); + conn->open( + "/dev/ttySAC0", + [] + {}, + [] + {}); + + auto timer = networking::time::Timer::create(net); + conn->setSteeringAngle(-4.0f); + conn->setSpeed(1.0f); + timer->startTimeout( + 10s, + [&] + { + conn->setSpeed(0.0f); + running = false; + }); + + while (running); + sleep(1); + return 0; +} \ No newline at end of file