unittest_stream_classification.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/Object.h>
26 #include <object_msgs/Objects.h>
27 
28 static bool test_pass = false;
29 
30 void syncCb(const sensor_msgs::ImageConstPtr& img,
31  const object_msgs::Objects::ConstPtr& objs)
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/classified_objects",
56  1);
58  sync.registerCallback(boost::bind(&syncCb, _1, _2));
59  ros::spin();
60  EXPECT_TRUE(test_pass);
61 }
62 
63 int main(int argc, char** argv)
64 {
65  testing::InitGoogleTest(&argc, argv);
66  ros::init(argc, argv, "movidius_ncs_stream_tests");
67  return RUN_ALL_TESTS();
68 }
static bool test_pass
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void syncCb(const sensor_msgs::ImageConstPtr &img, const object_msgs::Objects::ConstPtr &objs)
ROSCPP_DECL void spin(Spinner &spinner)
TEST(UnitTestStreamClassification, testClassification)
bool getParam(const std::string &key, std::string &s) const
ROSCPP_DECL void shutdown()
int main(int argc, char **argv)


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