diff --git a/.gitignore b/.gitignore index cf25ac6..46efdb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ CMakeLists.txt.user* +/ros_lib + diff --git a/README.md b/README.md index 56a0033..fcc4348 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # rosserial_qt Client implementation for rosserial using the multi-platform Qt library. -For the moment it only supports TCP/IP, but it should be easily adapted to UDP (using QUdpSocket) or serial port (using QSerialPort) communications. +For the moment it only supports TCP/IP, but it could be easily adapted for UDP (using QUdpSocket) or serial port (using QSerialPort) communications. ## Usage @@ -9,25 +9,32 @@ For the moment it only supports TCP/IP, but it should be easily adapted to UDP ( 2. Compile your client application using the library. You should add the roslib library to you include path, and add the .cpp files to your source files. Remarks: -* Unlike other clients of rosserial, the *NodeHandle* uses a dynamically sized buffer. -* There is no need to call spinOnce() manually : the *NodeHandle* will call spinOnce() periodically and on reception of new data +* C++11 support is required +* Unlike other client implementations of rosserial, the *NodeHandle* uses a dynamically sized buffer. +* There is no need to call spinOnce() manually : the *NodeHandle* will call spinOnce() periodically and on reception of new data, using the Qt event loopŝ * Unlike rosserial_arduino using C-style arrays, the message generation script will convert arrays to std::vector and std::array ## Examples Some simple examples of applications using the library are in the *test* directory +To use the examples you should first generate the *ros_lib* directory, for example like this : +``` +roscd rosserial_qt +rosrun rosserial_qt make_library.py . +``` ## Performance -CPU usage is quite close to native roscpp nodes : +CPU usage seems to be quite close to native roscpp nodes. +(TODO : add some data) ## Supported platforms -This library should work on all platforms supported by Qt (Linux, Windows, macos, ios, android ...) +This library should work on all platforms supported by Qt (Linux, Windows, Android, ios...) I have succesfully tested this library on : * Linux * Windows ## Server-side configuration -The current implementation needs the message length to be coded on 4 bytes (rosserial's default is 2 bytes). This has been implemented in rosserial-server, but has to be configured with the *msg_length_bytes* parameter. +The current implementation needs the message length to be coded on 4 bytes (rosserial's default is 2 bytes). This has been implemented in rosserial-server (modified version available here : [https://github.com/1r0b1n0/rosserial](https://github.com/1r0b1n0/rosserial) ), but has to be configured with the *msg_length_bytes* parameter. You should also configure the receive buffer size depending of your application. The rosserial-python server implementation will not work, as it doesn't support 4 bytes coding of the message length. diff --git a/launch/rosserial_python_server.launch b/launch/rosserial_python_server.launch index c5ba357..79ff830 100644 --- a/launch/rosserial_python_server.launch +++ b/launch/rosserial_python_server.launch @@ -1,4 +1,6 @@ + + diff --git a/test/.gitignore b/test/.gitignore index e2f7bf4..b4331f2 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,2 +1,3 @@ /ros_lib /build*/ +*pro.user* diff --git a/test/Basic/Basic.pro b/test/Basic/Basic.pro index 683b3ff..1414622 100644 --- a/test/Basic/Basic.pro +++ b/test/Basic/Basic.pro @@ -10,27 +10,26 @@ CONFIG -= app_bundle TEMPLATE = app -INCLUDEPATH += ../../src/ros_lib -INCLUDEPATH += ../ros_lib +INCLUDEPATH += ../../ros_lib SOURCES += main.cpp \ - ../../src/ros_lib/duration.cpp \ - ../../src/ros_lib/time.cpp \ - ../../src/ros_lib/RosQtSocket.cpp \ - ../../src/ros_lib/node_handle.cpp \ + ../../ros_lib/duration.cpp \ + ../../ros_lib/time.cpp \ + ../../ros_lib/RosQtSocket.cpp \ + ../../ros_lib/node_handle.cpp \ node.cpp DEFINES += QT_DEPRECATED_WARNINGS HEADERS += \ - ../../src/ros_lib/ros/duration.h \ - ../../src/ros_lib/ros/msg.h \ - ../../src/ros_lib/ros/node_handle.h \ - ../../src/ros_lib/ros/publisher.h \ - ../../src/ros_lib/ros/ros.h \ - ../../src/ros_lib/ros/service_client.h \ - ../../src/ros_lib/ros/service_server.h \ - ../../src/ros_lib/ros/subscriber.h \ - ../../src/ros_lib/ros/time.h \ - ../../src/ros_lib/ros/RosQtSocket.h \ + ../../ros_lib/ros/duration.h \ + ../../ros_lib/ros/msg.h \ + ../../ros_lib/ros/node_handle.h \ + ../../ros_lib/ros/publisher.h \ + ../../ros_lib/ros/ros.h \ + ../../ros_lib/ros/service_client.h \ + ../../ros_lib/ros/service_server.h \ + ../../ros_lib/ros/subscriber.h \ + ../../ros_lib/ros/time.h \ + ../../ros_lib/ros/RosQtSocket.h \ node.h diff --git a/test/Basic/Basic.pro.user b/test/Basic/Basic.pro.user index 6d71bbc..27040ff 100644 --- a/test/Basic/Basic.pro.user +++ b/test/Basic/Basic.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {b4f30ced-7693-4a4b-b90f-54df2b2dcced} + {879e81b6-cba8-47ee-9e58-98b9c532cb3d} ProjectExplorer.Project.ActiveTarget @@ -61,19 +61,19 @@ Desktop Desktop - {95f7913d-7084-4d5d-9839-c0c5e82f5474} + {4dd4c15a-e3fc-4f28-ad62-08eacb8bfbf3} 0 0 0 - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-Basic-Desktop-Debug + /home/robin/rosserial/ws/src/rosserial_qt/test/build-Basic-Desktop-Debug true qmake QtProjectManager.QMakeBuildStep - true + false false false @@ -126,7 +126,7 @@ true - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-Basic-Desktop-Release + /home/robin/rosserial/ws/src/rosserial_qt/test/build-Basic-Desktop-Release true @@ -244,13 +244,13 @@ Basic - Qt4ProjectManager.Qt4RunConfiguration:/home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/Basic/Basic.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/robin/rosserial/ws/src/rosserial_qt/test/Basic/Basic.pro true Basic.pro false - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-Basic-Desktop-Debug + /home/robin/rosserial/ws/src/rosserial_qt/test/build-Basic-Desktop-Debug 3768 false true diff --git a/test/Basic/Basic.pro_ b/test/Basic/Basic.pro_ new file mode 100644 index 0000000..683b3ff --- /dev/null +++ b/test/Basic/Basic.pro_ @@ -0,0 +1,36 @@ +QT += core +QT -= gui +QT += network + +CONFIG += c++11 + +TARGET = Basic +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +INCLUDEPATH += ../../src/ros_lib +INCLUDEPATH += ../ros_lib + +SOURCES += main.cpp \ + ../../src/ros_lib/duration.cpp \ + ../../src/ros_lib/time.cpp \ + ../../src/ros_lib/RosQtSocket.cpp \ + ../../src/ros_lib/node_handle.cpp \ + node.cpp + +DEFINES += QT_DEPRECATED_WARNINGS + +HEADERS += \ + ../../src/ros_lib/ros/duration.h \ + ../../src/ros_lib/ros/msg.h \ + ../../src/ros_lib/ros/node_handle.h \ + ../../src/ros_lib/ros/publisher.h \ + ../../src/ros_lib/ros/ros.h \ + ../../src/ros_lib/ros/service_client.h \ + ../../src/ros_lib/ros/service_server.h \ + ../../src/ros_lib/ros/subscriber.h \ + ../../src/ros_lib/ros/time.h \ + ../../src/ros_lib/ros/RosQtSocket.h \ + node.h diff --git a/test/LoopbackTest/Basic.pro.user b/test/LoopbackTest/Basic.pro.user deleted file mode 100644 index c0dd247..0000000 --- a/test/LoopbackTest/Basic.pro.user +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - EnvironmentId - {b4f30ced-7693-4a4b-b90f-54df2b2dcced} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop - Desktop - {95f7913d-7084-4d5d-9839-c0c5e82f5474} - 0 - 0 - 0 - - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-Basic-Desktop-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-Basic-Desktop-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 2 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Basic - - Qt4ProjectManager.Qt4RunConfiguration:/home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/Basic/Basic.pro - true - - Basic.pro - false - - - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/test/LoopbackTest/LoopbackTest.pro b/test/LoopbackTest/LoopbackTest.pro index 990bfec..86486ea 100644 --- a/test/LoopbackTest/LoopbackTest.pro +++ b/test/LoopbackTest/LoopbackTest.pro @@ -10,27 +10,26 @@ CONFIG -= app_bundle TEMPLATE = app -INCLUDEPATH += ../../src/ros_lib -INCLUDEPATH += ../ros_lib +INCLUDEPATH += ../../ros_lib SOURCES += main.cpp \ - ../../src/ros_lib/duration.cpp \ - ../../src/ros_lib/time.cpp \ - ../../src/ros_lib/RosQtSocket.cpp \ - ../../src/ros_lib/node_handle.cpp \ + ../../ros_lib/duration.cpp \ + ../../ros_lib/time.cpp \ + ../../ros_lib/RosQtSocket.cpp \ + ../../ros_lib/node_handle.cpp \ node.cpp DEFINES += QT_DEPRECATED_WARNINGS HEADERS += \ - ../../src/ros_lib/ros/duration.h \ - ../../src/ros_lib/ros/msg.h \ - ../../src/ros_lib/ros/node_handle.h \ - ../../src/ros_lib/ros/publisher.h \ - ../../src/ros_lib/ros/ros.h \ - ../../src/ros_lib/ros/service_client.h \ - ../../src/ros_lib/ros/service_server.h \ - ../../src/ros_lib/ros/subscriber.h \ - ../../src/ros_lib/ros/time.h \ - ../../src/ros_lib/ros/RosQtSocket.h \ + ../../ros_lib/ros/duration.h \ + ../../ros_lib/ros/msg.h \ + ../../ros_lib/ros/node_handle.h \ + ../../ros_lib/ros/publisher.h \ + ../../ros_lib/ros/ros.h \ + ../../ros_lib/ros/service_client.h \ + ../../ros_lib/ros/service_server.h \ + ../../ros_lib/ros/subscriber.h \ + ../../ros_lib/ros/time.h \ + ../../ros_lib/ros/RosQtSocket.h \ node.h diff --git a/test/LoopbackTest/LoopbackTest.pro.user b/test/LoopbackTest/LoopbackTest.pro.user index 041c5b4..2f0b63e 100644 --- a/test/LoopbackTest/LoopbackTest.pro.user +++ b/test/LoopbackTest/LoopbackTest.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {b4f30ced-7693-4a4b-b90f-54df2b2dcced} + {879e81b6-cba8-47ee-9e58-98b9c532cb3d} ProjectExplorer.Project.ActiveTarget @@ -61,12 +61,12 @@ Desktop Desktop - {95f7913d-7084-4d5d-9839-c0c5e82f5474} + {4dd4c15a-e3fc-4f28-ad62-08eacb8bfbf3} 0 0 0 - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-LoopbackTest-Desktop-Debug + /home/robin/rosserial/ws/src/rosserial_qt/test/build-LoopbackTest-Desktop-Debug true @@ -126,7 +126,7 @@ true - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-LoopbackTest-Desktop-Release + /home/robin/rosserial/ws/src/rosserial_qt/test/build-LoopbackTest-Desktop-Release true @@ -186,7 +186,7 @@ true - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-LoopbackTest-Desktop-Profile + /home/robin/rosserial/ws/src/rosserial_qt/test/build-LoopbackTest-Desktop-Profile true @@ -304,13 +304,13 @@ LoopbackTest - Qt4ProjectManager.Qt4RunConfiguration:/home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/LoopbackTest/LoopbackTest.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/robin/rosserial/ws/src/rosserial_qt/test/LoopbackTest/LoopbackTest.pro true LoopbackTest.pro false - /home/robopec/Projects/Phenomobile/ws_phenofield/src/rosserial_qt/test/build-LoopbackTest-Desktop-Debug + /home/robin/rosserial/ws/src/rosserial_qt/test/build-LoopbackTest-Desktop-Debug 3768 false true diff --git a/test/LoopbackTest/LoopbackTest.pro_ b/test/LoopbackTest/LoopbackTest.pro_ new file mode 100644 index 0000000..990bfec --- /dev/null +++ b/test/LoopbackTest/LoopbackTest.pro_ @@ -0,0 +1,36 @@ +QT += core +QT -= gui +QT += network + +CONFIG += c++11 + +TARGET = LoopbackTest +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +INCLUDEPATH += ../../src/ros_lib +INCLUDEPATH += ../ros_lib + +SOURCES += main.cpp \ + ../../src/ros_lib/duration.cpp \ + ../../src/ros_lib/time.cpp \ + ../../src/ros_lib/RosQtSocket.cpp \ + ../../src/ros_lib/node_handle.cpp \ + node.cpp + +DEFINES += QT_DEPRECATED_WARNINGS + +HEADERS += \ + ../../src/ros_lib/ros/duration.h \ + ../../src/ros_lib/ros/msg.h \ + ../../src/ros_lib/ros/node_handle.h \ + ../../src/ros_lib/ros/publisher.h \ + ../../src/ros_lib/ros/ros.h \ + ../../src/ros_lib/ros/service_client.h \ + ../../src/ros_lib/ros/service_server.h \ + ../../src/ros_lib/ros/subscriber.h \ + ../../src/ros_lib/ros/time.h \ + ../../src/ros_lib/ros/RosQtSocket.h \ + node.h