test_utils.h
Go to the documentation of this file.
1 // -- BEGIN LICENSE BLOCK ----------------------------------------------
2 // Copyright © 2025 Universal Robots A/S
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 //
14 // * Neither the name of the {copyright_holder} nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 // POSSIBILITY OF SUCH DAMAGE.
29 // -- END LICENSE BLOCK ------------------------------------------------
30 
31 #pragma once
32 
34 
35 bool robotVersionLessThan(const std::string& robot_ip, const std::string& robot_version)
36 {
37  urcl::comm::INotifier notifier;
38  urcl::primary_interface::PrimaryClient primary_client(robot_ip, notifier);
39  primary_client.start();
40  auto version_information = primary_client.getRobotVersion();
41  return *version_information < urcl::VersionInformation::fromString(robot_version);
42 }
robotVersionLessThan
bool robotVersionLessThan(const std::string &robot_ip, const std::string &robot_version)
Definition: test_utils.h:35
urcl::VersionInformation::fromString
static VersionInformation fromString(const std::string &str)
Parses a version string into a VersionInformation object.
Definition: version_information.cpp:59
urcl::comm::INotifier
Parent class for notifiers.
Definition: pipeline.h:253
urcl::primary_interface::PrimaryClient
Definition: primary_client.h:50
urcl::primary_interface::PrimaryClient::getRobotVersion
std::shared_ptr< VersionInformation > getRobotVersion(bool wait_for_message=true, const std::chrono::milliseconds timeout=std::chrono::seconds(2))
Get the robot's software version as Major.Minor.Bugfix.
Definition: primary_client.cpp:271
urcl::primary_interface::PrimaryClient::start
void start(const size_t max_connection_attempts=0, const std::chrono::milliseconds reconnection_timeout=urcl::comm::TCPSocket::DEFAULT_RECONNECTION_TIME)
Definition: primary_client.cpp:65
primary_client.h


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58