diff --git a/README.md b/README.md index 5014857c..26f481e0 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ROS2 Version supported: * [x] ROS2 Dashing * [x] ROS2 Eloquent * [x] ROS2 Foxy +* [x] ROS2 Galactic Inference Features supported: @@ -26,10 +27,10 @@ See more from [here](https://github.com/openvinotoolkit/openvino) for Intel Open ## Prerequisite -* Processor: A platform with Intel processors assembled. (see [here](https://software.intel.com/content/www/us/en/develop/articles/openvino-2020-3-lts-relnotes.html) for the full list of Intel processors supported.) +* Processor: A platform with Intel processors assembled. (see [here](https://software.intel.com/content/www/us/en/develop/articles/openvino-2021-4-lts-relnotes.html) for the full list of Intel processors supported.) * OS: Ubuntu 20.04 -* ROS2: Foxy Fitzroy -* OpenVINO: V2021.3, see [the release notes](https://software.intel.com/content/www/us/en/develop/articles/openvino-relnotes.html) for more info. +* ROS2: Galactic Geochelone +* OpenVINO: V2021.4, see [the release notes](https://software.intel.com/content/www/us/en/develop/articles/openvino-relnotes.html) for more info. * [Optional] RealSense D400 Series Camera * [Optional] Intel NCS2 Stick ## Tables of contents @@ -40,10 +41,9 @@ See more from [here](https://github.com/openvinotoolkit/openvino) for Intel Open - [How to create multiple pipelines in a process?](./doc/tables_of_contents/tutorials/Multiple_Pipelines.md) ## Installation & Launching -See Getting Start Pages for [ROS2 Dashing](./doc/getting_started_with_Dashing.md) or [ROS2 Foxy](./doc/getting_started_with_Foxy_Ubuntu20.04.md) for detailed installation & lauching instructions. +See Getting Start Pages for [ROS2 Dashing](./doc/getting_started_with_Dashing.md) or [ROS2 Foxy](./doc/getting_started_with_Foxy_Ubuntu20.04.md) or [ROS2 Galactic](./doc/getting_started_with_Galactic_Ubuntu20.04.md) for detailed installation & lauching instructions. # More Information -* ROS2 OpenVINO discription writen in Chinese: https://mp.weixin.qq.com/s/BgG3RGauv5pmHzV_hkVAdw +* ROS2 OpenVINO discription writen in Chinese: https://mp.weixin.qq.com/s/BgG3RGauv5pmHzV_hkVAdw ###### *Any security issue should be reported using process at https://01.org/security* - diff --git a/doc/getting_started_with_Galactic_Ubuntu20.04.md b/doc/getting_started_with_Galactic_Ubuntu20.04.md new file mode 100644 index 00000000..587eeccb --- /dev/null +++ b/doc/getting_started_with_Galactic_Ubuntu20.04.md @@ -0,0 +1,117 @@ +# ROS2_GALACTIC_OpenVINO_Toolkit + +**NOTE:** +Below steps have been tested on **Ubuntu 20.04**. + +## 1. Environment Setup +* Install ROS2 Galactic ([guide](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html)) +* Install Intel® OpenVINO™ Toolkit Version: 2021.4 ([guide](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_apt.html)) or building by source code ([guide](https://github.com/openvinotoolkit/openvino/wiki/BuildingForLinux)) +* Install Intel® RealSense ™ SDK ([guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md)) + +## 2. Building and Installation +* Build demo code in OpenVINO toolkit +``` + # root is required instead of sudo + source /opt/intel//bin/setupvars.sh + cd /opt/intel//deployment_tools/open_model_zoo/demos + source build_demos.sh +``` +* Install ROS2_OpenVINO packages +``` +mkdir -p ~/my_ros2_ws/src +cd ~/my_ros2_ws/src +git clone https://github.com/intel/ros2_openvino_toolkit -b dev-ov.2021.4 +git clone https://github.com/intel/ros2_object_msgs +git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2 +``` +* Build package +``` +source /opt/ros/galactic/setup.bash +source /opt/intel//bin/setupvars.sh +cd ~/my_ros2_ws/src +colcon build --symlink-install +source ./install/local_setup.bash +``` + +## 3. Running the Demo +* Preparation + * Configure the Neural Compute Stick USB Driver (if needed) +``` + cd ~/Downloads + cat < 97-usbboot.rules + SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" + SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" + SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" + EOF + sudo cp 97-usbboot.rules /etc/udev/rules.d/ + sudo udevadm control --reload-rules + sudo udevadm trigger + sudo ldconfig + rm 97-usbboot.rules +``` + +* See all available models +``` +cd /opt/intel//deployment_tools/open_model_zoo/tools/downloader +sudo python3 downloader.py --print_all +``` + +* Download the optimized Intermediate Representation (IR) of model (execute once), for example: +``` +cd /opt/intel//deployment_tools/open_model_zoo/tools/downloader +sudo python3 downloader.py --name face-detection-adas-0001 --output_dir /opt/openvino_toolkit/models/face_detection/output +``` + +* copy label files (execute once) +``` + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/openvino_toolkit/models/emotions-recognition/output/intel/emotions-recognition-retail-0003/FP32/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP32/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP16/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/semantic-segmentation/output/FP32/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/semantic-segmentation/output/FP16/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/object_detection/vehicle-license-plate-detection-barrier-0106.labels /opt/openvino_toolkit/models/vehicle-license-plate-detection/output/intel/vehicle-license-plate-detection-barrier-0106/FP32 + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP32/ + sudo cp ~/my_ros2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP16/ +``` + +* If the model (tensorflow, caffe, MXNet, ONNX, Kaldi)need to be converted to intermediate representation (For example the model for object detection) +``` + sudo python3 downloader.py --name mobilenet-ssd --output_dir /opt/openvino_toolkit/models/object_detection/mobilenet_ssd/caffe/output + cd /opt/intel//deployment_tools/model_optimizer + sudo python3 mo.py --input_model /opt/openvino_toolkit/models/object_detection/mobilenet_ssd/caffe/output/public/mobilenet-ssd/mobilenet-ssd.caffemodel --output_dir /opt/openvino_toolkit/models/object_detection/mobilenet_ssd/caffe/output +``` + +* Before launch, check the parameter configuration in ros2_openvino_toolkit/sample/param/xxxx.yaml, make sure the paramter like model path, label path, inputs are right. +* run face detection sample code input from StandardCamera. +``` +ros2 launch dynamic_vino_sample pipeline_people.launch.py +``` +* run face detection sample code input from Image. +``` +ros2 launch dynamic_vino_sample pipeline_image.launch.py +``` +* run object segmentation sample code input from RealSenseCameraTopic. +``` +ros2 launch dynamic_vino_sample pipeline_segmentation.launch.py +``` +* run object segmentation sample code input from Image. +``` +ros2 launch dynamic_vino_sample pipeline_segmentation_image.launch.py +``` +* run vehicle detection sample code input from StandardCamera. +``` +ros2 launch dynamic_vino_sample pipeline_vehicle_detection.launch.py +``` +* run person attributes sample code input from StandardCamera. +``` +ros2 launch dynamic_vino_sample pipeline_person_attributes.launch.py +``` +* run person reidentification sample code input from StandardCamera. +``` +ros2 launch dynamic_vino_sample pipeline_reidentification.launch.py +``` + +# More Information +* ROS2 OpenVINO discription writen in Chinese: https://mp.weixin.qq.com/s/BgG3RGauv5pmHzV_hkVAdw + +###### *Any security issue should be reported using process at https://01.org/security* diff --git a/sample/src/image_object_client.cpp b/sample/src/image_object_client.cpp index 3c507b3d..4d58ef72 100644 --- a/sample/src/image_object_client.cpp +++ b/sample/src/image_object_client.cpp @@ -48,7 +48,7 @@ int main(int argc, char ** argv) auto result = client->async_send_request(request); if (rclcpp::spin_until_future_complete(node, result) == - rclcpp::executor::FutureReturnCode::SUCCESS) + rclcpp::FutureReturnCode::SUCCESS) { auto srv = result.get(); diff --git a/sample/src/image_people_client.cpp b/sample/src/image_people_client.cpp index eba31b91..21adda4f 100644 --- a/sample/src/image_people_client.cpp +++ b/sample/src/image_people_client.cpp @@ -52,7 +52,7 @@ int main(int argc, char ** argv) auto result = client->async_send_request(request); if (rclcpp::spin_until_future_complete(node, result) == - rclcpp::executor::FutureReturnCode::SUCCESS) + rclcpp::FutureReturnCode::SUCCESS) { auto people = result.get(); if (people->persons.emotions.size() == 0 && people->persons.agegenders.size() == 0 && diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4d3b2648..59509625 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,7 +26,7 @@ set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}") #################################### message(STATUS "Looking for inference engine configuration file at: ${CMAKE_PREFIX_PATH}") -find_package(InferenceEngine 1.1) +find_package(InferenceEngine) if(NOT InferenceEngine_FOUND) message(FATAL_ERROR "") endif() diff --git a/tests/src/service/unittest_objectService.cpp b/tests/src/service/unittest_objectService.cpp index 6cddbb3c..90b66a12 100644 --- a/tests/src/service/unittest_objectService.cpp +++ b/tests/src/service/unittest_objectService.cpp @@ -49,7 +49,7 @@ TEST(UnitTestObject, testObject) auto result = client->async_send_request(request); ASSERT_EQ( - rclcpp::executor::FutureReturnCode::SUCCESS, + rclcpp::FutureReturnCode::SUCCESS, rclcpp::spin_until_future_complete(node, result)); auto srv = result.get(); diff --git a/tests/src/service/unittest_peopleService.cpp b/tests/src/service/unittest_peopleService.cpp index 7b6bbd2f..7e944ecc 100644 --- a/tests/src/service/unittest_peopleService.cpp +++ b/tests/src/service/unittest_peopleService.cpp @@ -51,7 +51,7 @@ TEST(UnitTestPeople, testPeople) auto result = client->async_send_request(request); ASSERT_EQ( - rclcpp::executor::FutureReturnCode::SUCCESS, + rclcpp::FutureReturnCode::SUCCESS, rclcpp::spin_until_future_complete(node, result)); auto srv = result.get(); diff --git a/tests/src/topic/unittest_faceDetectionCheck.cpp b/tests/src/topic/unittest_faceDetectionCheck.cpp index 0b5eb8ad..95fc2118 100644 --- a/tests/src/topic/unittest_faceDetectionCheck.cpp +++ b/tests/src/topic/unittest_faceDetectionCheck.cpp @@ -51,11 +51,11 @@ static bool headPose_test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_face_reidentification.cpp b/tests/src/topic/unittest_face_reidentification.cpp index 6fb61c70..395e1bb4 100644 --- a/tests/src/topic/unittest_face_reidentification.cpp +++ b/tests/src/topic/unittest_face_reidentification.cpp @@ -50,11 +50,11 @@ static bool test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_imageCheck.cpp b/tests/src/topic/unittest_imageCheck.cpp index c4af8e74..7f4a333a 100644 --- a/tests/src/topic/unittest_imageCheck.cpp +++ b/tests/src/topic/unittest_imageCheck.cpp @@ -51,11 +51,11 @@ static bool headPose_test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_objectDetectionCheck.cpp b/tests/src/topic/unittest_objectDetectionCheck.cpp index 569c8557..ad5facf2 100644 --- a/tests/src/topic/unittest_objectDetectionCheck.cpp +++ b/tests/src/topic/unittest_objectDetectionCheck.cpp @@ -43,11 +43,11 @@ static bool test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_reidentification.cpp b/tests/src/topic/unittest_reidentification.cpp index b3393fa6..05c10b11 100644 --- a/tests/src/topic/unittest_reidentification.cpp +++ b/tests/src/topic/unittest_reidentification.cpp @@ -46,11 +46,11 @@ static bool test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_segmentationCheck.cpp b/tests/src/topic/unittest_segmentationCheck.cpp index 28fdc8fd..52d6e278 100644 --- a/tests/src/topic/unittest_segmentationCheck.cpp +++ b/tests/src/topic/unittest_segmentationCheck.cpp @@ -44,11 +44,11 @@ static bool test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time; diff --git a/tests/src/topic/unittest_vehicleDetectionCheck.cpp b/tests/src/topic/unittest_vehicleDetectionCheck.cpp index 777b3242..e325ba31 100644 --- a/tests/src/topic/unittest_vehicleDetectionCheck.cpp +++ b/tests/src/topic/unittest_vehicleDetectionCheck.cpp @@ -48,11 +48,11 @@ static bool test_pass = false; template void wait_for_future( - rclcpp::executor::Executor & executor, std::shared_future & future, + rclcpp::Executor & executor, std::shared_future & future, const DurationT & timeout) { - using rclcpp::executor::FutureReturnCode; - rclcpp::executor::FutureReturnCode future_ret; + using rclcpp::FutureReturnCode; + rclcpp::FutureReturnCode future_ret; auto start_time = std::chrono::steady_clock::now(); future_ret = executor.spin_until_future_complete(future, timeout); auto elapsed_time = std::chrono::steady_clock::now() - start_time;