jog_cpp_interface_test.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2020, PickNik LLC
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of PickNik LLC nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman
36  Desc: Stub test for the C++ interface to JogArm
37 */
38 
39 // C++
40 #include <string>
41 
42 // ROS
43 #include <ros/ros.h>
44 
45 // Testing
46 #include <gtest/gtest.h>
47 
48 // Main class
50 
51 static const std::string LOGNAME = "jog_cpp_interface_test";
52 
53 namespace moveit_jog_arm
54 {
55 class TestJogCppInterface : public ::testing::Test
56 {
57 public:
58  void SetUp() override
59  {
60  nh_.reset(new ros::NodeHandle("~"));
61 
62  // Load the planning scene monitor
63  planning_scene_monitor_ = std::make_shared<planning_scene_monitor::PlanningSceneMonitor>("robot_description");
64  planning_scene_monitor_->startSceneMonitor();
65  planning_scene_monitor_->startStateMonitor();
66  }
67  void TearDown() override
68  {
69  }
70 
71 protected:
72  std::unique_ptr<ros::NodeHandle> nh_;
73  planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_;
74 }; // class TestJogCppInterface
75 
77 {
79  ros::Duration(1).sleep(); // Give the started thread some time to run
80 }
81 
82 // TODO(davetcoleman): due to many blocking checks for ROS messages, and
83 // an abundance of threads, unit tests are not currently feasible for the
84 // cpp interface. This should be addressed in future re-factors
85 
86 } // namespace moveit_jog_arm
87 
88 int main(int argc, char** argv)
89 {
90  testing::InitGoogleTest(&argc, argv);
91  ros::init(argc, argv, "jog_cpp_interface_test_test");
92 
94  spinner.start();
95 
96  int result = RUN_ALL_TESTS();
97 
98  spinner.stop();
99  ros::shutdown();
100  return result;
101 }
planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void spinner()
TEST_F(TestJogCppInterface, InitTest)
std::unique_ptr< ros::NodeHandle > nh_
int main(int argc, char **argv)
static const std::string LOGNAME
ROSCPP_DECL void shutdown()
bool sleep() const


moveit_jog_arm
Author(s): Brian O'Neil, Andy Zelenak , Blake Anderson, Alexander Rössler
autogenerated on Fri Jun 5 2020 03:53:46