ros-perception / vision_msgs

Algorithm-agnostic computer vision message types for ROS.
Apache License 2.0
155 stars 74 forks source link

Port vision_msgs to ROS 2 Dashing #31

Closed sloretz closed 4 years ago

sloretz commented 4 years ago

This is close to the minimum required to port vision_msgs to ROS 2 Dashing. I also added a linter for CMake. There are other commonly used linters on message packages, but I didn't add them because they would require more code changes to pass. I put the output from those linters below.

Output from linters not added to this PR ``` 37: Test command: /usr/bin/python3 "-u" "/opt/ros/dashing/share/ament_cmake_test/cmake/run_test.py" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cppcheck.xunit.xml" "--package-name" "vision_msgs" "--output-file" "/home/sloretz/ws/darknet/build/vision_msgs/ament_cppcheck/cppcheck.txt" "--command" "/opt/ros/dashing/bin/ament_cppcheck" "--xunit-file" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cppcheck.xunit.xml" "--include_dirs" "/home/sloretz/ws/darknet/src/vision_msgs/include" 37: Test timeout computed to be: 120 37: -- run_test.py: invoking following command in '/home/sloretz/ws/darknet/src/vision_msgs': 37: - /opt/ros/dashing/bin/ament_cppcheck --xunit-file /home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cppcheck.xunit.xml --include_dirs /home/sloretz/ws/darknet/src/vision_msgs/include 37: [include/vision_msgs/create_aabb.h:21]: (error: syntaxError) Code 'namespacevision_msgs{' is invalid C code. Use --std or --language to configure the language. 37: 1 errors 37: -- run_test.py: return code 1 37: -- run_test.py: verify result file '/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cppcheck.xunit.xml' 37/42 Test #37: cppcheck ..........................................***Failed 0.29 sec test 38 Start 38: cpplint 38: Test command: /usr/bin/python3 "-u" "/opt/ros/dashing/share/ament_cmake_test/cmake/run_test.py" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cpplint.xunit.xml" "--package-name" "vision_msgs" "--output-file" "/home/sloretz/ws/darknet/build/vision_msgs/ament_cpplint/cpplint.txt" "--command" "/opt/ros/dashing/bin/ament_cpplint" "--xunit-file" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cpplint.xunit.xml" 38: Test timeout computed to be: 120 38: -- run_test.py: invoking following command in '/home/sloretz/ws/darknet/src/vision_msgs': 38: - /opt/ros/dashing/bin/ament_cpplint --xunit-file /home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cpplint.xunit.xml 38: /home/sloretz/ws/darknet/src/vision_msgs/include/vision_msgs/create_aabb.h:15: #ifndef header guard has wrong style, please use: VISION_MSGS__CREATE_AABB_H_ [build/header_guard] [5] 38: /home/sloretz/ws/darknet/src/vision_msgs/include/vision_msgs/create_aabb.h:69: #endif line should be "#endif // VISION_MSGS__CREATE_AABB_H_" [build/header_guard] [5] 38: /home/sloretz/ws/darknet/src/vision_msgs/include/vision_msgs/create_aabb.h:67: Namespace should be terminated with "// namespace vision_msgs" [readability/namespace] [5] 38: /home/sloretz/ws/darknet/src/vision_msgs/test/main.cpp:21: Missing space after , [whitespace/comma] [3] 38: /home/sloretz/ws/darknet/src/vision_msgs/test/main.cpp:31: Missing space after , [whitespace/comma] [3] 38: /home/sloretz/ws/darknet/src/vision_msgs/test/main.cpp:33: At least two spaces is best between code and comments [whitespace/comments] [2] 38: Category 'build/header_guard' errors found: 2 38: Category 'readability/namespace' errors found: 1 38: Category 'whitespace/comma' errors found: 2 38: Category 'whitespace/comments' errors found: 1 38: Total errors found: 6 38: Using '--root=/home/sloretz/ws/darknet/src/vision_msgs/include' argument 38: 38: Done processing /home/sloretz/ws/darknet/src/vision_msgs/include/vision_msgs/create_aabb.h 38: 38: Using '--root=/home/sloretz/ws/darknet/src/vision_msgs/test' argument 38: 38: Done processing /home/sloretz/ws/darknet/src/vision_msgs/test/main.cpp 38: 38: -- run_test.py: return code 1 38: -- run_test.py: verify result file '/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/cpplint.xunit.xml' 38/42 Test #38: cpplint ...........................................***Failed 0.33 sec test 39 Start 39: uncrustify 39: Test command: /usr/bin/python3 "-u" "/opt/ros/dashing/share/ament_cmake_test/cmake/run_test.py" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/uncrustify.xunit.xml" "--package-name" "vision_msgs" "--output-file" "/home/sloretz/ws/darknet/build/vision_msgs/ament_uncrustify/uncrustify.txt" "--command" "/opt/ros/dashing/bin/ament_uncrustify" "--xunit-file" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/uncrustify.xunit.xml" 39: Test timeout computed to be: 60 39: -- run_test.py: invoking following command in '/home/sloretz/ws/darknet/src/vision_msgs': 39: - /opt/ros/dashing/bin/ament_uncrustify --xunit-file /home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/uncrustify.xunit.xml 39: Code style divergence in file 'include/vision_msgs/create_aabb.h': 39: 39: --- include/vision_msgs/create_aabb.h 39: +++ include/vision_msgs/create_aabb.h.uncrustify 39: @@ -23,11 +23,12 @@ 39: - /** 39: - * Create an axis-aligned bounding box (AABB) given the upper-left corner, 39: - * width, and height. This allows easy conversion from the OpenCV rectangle 39: - * representation. 39: - */ 39: - static inline msg::BoundingBox2D createAABB2D(uint32_t left, 39: - uint32_t top, 39: - uint32_t width, 39: - uint32_t height) 39: - { 39: - msg::BoundingBox2D bbox; 39: +/** 39: + * Create an axis-aligned bounding box (AABB) given the upper-left corner, 39: + * width, and height. This allows easy conversion from the OpenCV rectangle 39: + * representation. 39: + */ 39: +static inline msg::BoundingBox2D createAABB2D( 39: + uint32_t left, 39: + uint32_t top, 39: + uint32_t width, 39: + uint32_t height) 39: +{ 39: + msg::BoundingBox2D bbox; 39: @@ -35,4 +36,4 @@ 39: - bbox.center.x = left + width/2.0; 39: - bbox.center.y = top + height/2.0; 39: - bbox.size_x = width; 39: - bbox.size_y = height; 39: + bbox.center.x = left + width / 2.0; 39: + bbox.center.y = top + height / 2.0; 39: + bbox.size_x = width; 39: + bbox.size_y = height; 39: @@ -40,2 +41,2 @@ 39: - return bbox; 39: - } 39: + return bbox; 39: +} 39: @@ -43,13 +44,14 @@ 39: - /** 39: - * Create an axis-aligned bounding box (AABB) given the upper-left-front 39: - * corner, width, height, and depth. This allows easy conversion from the 39: - * OpenCV rectangle representation. 39: - */ 39: - static inline msg::BoundingBox3D createAABB3D(uint32_t min_x, 39: - uint32_t min_y, 39: - uint32_t min_z, 39: - uint32_t size_x, 39: - uint32_t size_y, 39: - uint32_t size_z) 39: - { 39: - msg::BoundingBox3D bbox; 39: +/** 39: + * Create an axis-aligned bounding box (AABB) given the upper-left-front 39: + * corner, width, height, and depth. This allows easy conversion from the 39: + * OpenCV rectangle representation. 39: + */ 39: +static inline msg::BoundingBox3D createAABB3D( 39: + uint32_t min_x, 39: + uint32_t min_y, 39: + uint32_t min_z, 39: + uint32_t size_x, 39: + uint32_t size_y, 39: + uint32_t size_z) 39: +{ 39: + msg::BoundingBox3D bbox; 39: @@ -57,7 +59,7 @@ 39: - bbox.center.position.x = min_x + size_x/2.0; 39: - bbox.center.position.y = min_y + size_y/2.0; 39: - bbox.center.position.z = min_z + size_z/2.0; 39: - bbox.center.orientation.w = 1; 39: - bbox.size.x = size_x; 39: - bbox.size.y = size_y; 39: - bbox.size.z = size_z; 39: + bbox.center.position.x = min_x + size_x / 2.0; 39: + bbox.center.position.y = min_y + size_y / 2.0; 39: + bbox.center.position.z = min_z + size_z / 2.0; 39: + bbox.center.orientation.w = 1; 39: + bbox.size.x = size_x; 39: + bbox.size.y = size_y; 39: + bbox.size.z = size_z; 39: @@ -65,2 +67,2 @@ 39: - return bbox; 39: - } 39: + return bbox; 39: +} 39: 39: Code style divergence in file 'test/main.cpp': 39: 39: --- test/main.cpp 39: +++ test/main.cpp.uncrustify 39: @@ -21 +21 @@ 39: - vision_msgs::msg::BoundingBox2D bbox = vision_msgs::createAABB2D(1,2,3,4); 39: + vision_msgs::msg::BoundingBox2D bbox = vision_msgs::createAABB2D(1, 2, 3, 4); 39: @@ -31 +31 @@ 39: - vision_msgs::msg::BoundingBox3D bbox = vision_msgs::createAABB3D(1,2,3,4,5,6); 39: + vision_msgs::msg::BoundingBox3D bbox = vision_msgs::createAABB3D(1, 2, 3, 4, 5, 6); 39: @@ -44 +44 @@ 39: -int main(int argc, char** argv) 39: +int main(int argc, char ** argv) 39: 39: 2 files with code style divergence 39: -- run_test.py: return code 1 39: -- run_test.py: verify result file '/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/uncrustify.xunit.xml' 39/42 Test #39: uncrustify ........................................***Failed 0.28 sec test 40 Start 40: copyright 40: Test command: /usr/bin/python3 "-u" "/opt/ros/dashing/share/ament_cmake_test/cmake/run_test.py" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/copyright.xunit.xml" "--package-name" "vision_msgs" "--output-file" "/home/sloretz/ws/darknet/build/vision_msgs/ament_copyright/copyright.txt" "--command" "/opt/ros/dashing/bin/ament_copyright" "--xunit-file" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/copyright.xunit.xml" 40: Test timeout computed to be: 60 40: -- run_test.py: invoking following command in '/home/sloretz/ws/darknet/src/vision_msgs': 40: - /opt/ros/dashing/bin/ament_copyright --xunit-file /home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/copyright.xunit.xml 40: CONTRIBUTING.md: file not found 40: 1 errors, checked 4 files 40: -- run_test.py: return code 1 40: -- run_test.py: verify result file '/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/copyright.xunit.xml' 40/42 Test #40: copyright .........................................***Failed 0.28 sec test 42 Start 42: xmllint 42: Test command: /usr/bin/python3 "-u" "/opt/ros/dashing/share/ament_cmake_test/cmake/run_test.py" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/xmllint.xunit.xml" "--package-name" "vision_msgs" "--output-file" "/home/sloretz/ws/darknet/build/vision_msgs/ament_xmllint/xmllint.txt" "--command" "/opt/ros/dashing/bin/ament_xmllint" "--xunit-file" "/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/xmllint.xunit.xml" 42: Test timeout computed to be: 60 42: -- run_test.py: invoking following command in '/home/sloretz/ws/darknet/src/vision_msgs': 42: - /opt/ros/dashing/bin/ament_xmllint --xunit-file /home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/xmllint.xunit.xml 42: File 'package.xml' is invalid: 42: /home/sloretz/ws/darknet/src/vision_msgs/package.xml:11: element author: Schemas validity error : Element 'author': This element is not expected. Expected is ( maintainer ). 42: /home/sloretz/ws/darknet/src/vision_msgs/package.xml fails to validate 42: 42: 1 files are invalid 42: -- run_test.py: return code 1 42: -- run_test.py: verify result file '/home/sloretz/ws/darknet/build/vision_msgs/test_results/vision_msgs/xmllint.xunit.xml' 42/42 Test #42: xmllint ...........................................***Failed 0.41 sec ```
sloretz commented 4 years ago

Somehow I completely missed that there was a ROS 2 branch. Closing.