test_rtde_client.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // Copyright 2020 FZI Forschungszentrum Informatik
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // -- END LICENSE BLOCK ------------------------------------------------
18 
19 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 
28 #include <gtest/gtest.h>
29 
31 
32 using namespace urcl;
33 
34 const std::string ROBOT_IP = "192.168.56.101";
35 
36 TEST(UrRobotDriver, rtde_handshake)
37 {
38  comm::INotifier notifier;
39  std::string output_recipe = "resources/rtde_output_recipe.txt";
40  std::string input_recipe = "resources/rtde_input_recipe.txt";
41  rtde_interface::RTDEClient client(ROBOT_IP, notifier, output_recipe, input_recipe);
42 
43  EXPECT_TRUE(client.init());
44 }
45 
46 TEST(UrRobotDriver, rtde_handshake_wrong_ip)
47 {
48  comm::INotifier notifier;
49  std::string output_recipe = "resources/rtde_output_recipe.txt";
50  std::string input_recipe = "resources/rtde_input_recipe.txt";
51  rtde_interface::RTDEClient client("192.168.56.123", notifier, output_recipe, input_recipe);
52 
53  EXPECT_THROW(client.init(), UrException);
54 }
55 
56 TEST(UrRobotDriver, rtde_handshake_illegal_ip)
57 {
58  comm::INotifier notifier;
59  std::string output_recipe = "resources/rtde_output_recipe.txt";
60  std::string input_recipe = "resources/rtde_input_recipe.txt";
61  rtde_interface::RTDEClient client("abcd", notifier, output_recipe, input_recipe);
62 
63  EXPECT_THROW(client.init(), UrException);
64 }
65 
66 TEST(UrRobotDriver, no_recipe)
67 {
68  comm::INotifier notifier;
69  std::string output_recipe = "";
70  std::string input_recipe = "";
71  EXPECT_THROW(rtde_interface::RTDEClient client(ROBOT_IP, notifier, output_recipe, input_recipe), UrException);
72 }
73 
74 TEST(UrRobotDriver, empty_recipe)
75 {
76  comm::INotifier notifier;
77  std::string output_recipe = "resources/empty.txt";
78  std::string input_recipe = "resources/empty.txt";
79  rtde_interface::RTDEClient client(ROBOT_IP, notifier, output_recipe, input_recipe);
80 
81  EXPECT_THROW(client.init(), UrException);
82 }
83 
84 int main(int argc, char* argv[])
85 {
86  ::testing::InitGoogleTest(&argc, argv);
87 
88  return RUN_ALL_TESTS();
89 }
TEST(UrRobotDriver, rtde_handshake)
Parent class for notifiers.
Definition: pipeline.h:209
int main(int argc, char *argv[])
The RTDEClient class manages communication over the RTDE interface. It contains the RTDE handshake an...
Definition: rtde_client.h:81
const std::string ROBOT_IP
bool init()
Sets up RTDE communication with the robot. The handshake includes negotiation of the used protocol ve...
Our base class for exceptions. Specialized exceptions should inherit from those.
Definition: exceptions.h:40


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26