unittest_stream_detection.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <string>
18 
19 #include <cv_bridge/cv_bridge.h>
20 #include <gtest/gtest.h>
23 #include <ros/ros.h>
24 
25 #include <object_msgs/ObjectInBox.h>
26 #include <object_msgs/ObjectsInBoxes.h>
27 
28 static bool test_pass = false;
29 
30 void syncCb(const sensor_msgs::ImageConstPtr& img,
31  const object_msgs::ObjectsInBoxes::ConstPtr& objs_in_boxes)
32 {
33  test_pass = true;
34  EXPECT_TRUE(true);
35  ros::shutdown();
36 }
37 
38 TEST(UnitTestStreamClassification, testClassification)
39 {
40  ros::NodeHandle nh("~");
41  std::string camera, camera_topic;
42  nh.getParam("camera", camera);
43  if (camera == "usb")
44  {
45  camera_topic = "/usb_cam/image_raw";
46  }
47  else if (camera == "realsense")
48  {
49  camera_topic = "/camera/color/image_raw";
50  }
52  camera_topic,
53  1);
55  "/movidius_ncs_nodelet/detected_objects",
56  1);
58  objSub,
59  60);
60  sync.registerCallback(boost::bind(&syncCb, _1, _2));
61  ros::spin();
62  EXPECT_TRUE(test_pass);
63 }
64 
65 int main(int argc, char** argv)
66 {
67  testing::InitGoogleTest(&argc, argv);
68  ros::init(argc, argv, "movidius_ncs_stream_tests");
69  return RUN_ALL_TESTS();
70 }
static bool test_pass
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
ROSCPP_DECL void spin(Spinner &spinner)
void syncCb(const sensor_msgs::ImageConstPtr &img, const object_msgs::ObjectsInBoxes::ConstPtr &objs_in_boxes)
bool getParam(const std::string &key, std::string &s) const
TEST(UnitTestStreamClassification, testClassification)
ROSCPP_DECL void shutdown()


movidius_ncs_stream
Author(s): Xiaojun Huang
autogenerated on Mon Jun 10 2019 14:11:28