calibration_checker.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 2019 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 
29 
30 namespace urcl
31 {
32 CalibrationChecker::CalibrationChecker(const std::string& expected_hash)
33  : expected_hash_(expected_hash), checked_(false)
34 {
35 }
36 bool CalibrationChecker::consume(std::shared_ptr<primary_interface::PrimaryPackage> product)
37 {
38  auto kin_info = std::dynamic_pointer_cast<primary_interface::KinematicsInfo>(product);
39  if (kin_info != nullptr)
40  {
41  // URCL_LOG_INFO("%s", product->toString().c_str());
42  //
43  if (kin_info->toHash() != expected_hash_)
44  {
45  URCL_LOG_ERROR("The calibration parameters of the connected robot don't match the ones from the given kinematics "
46  "config file. Please be aware that this can lead to critical inaccuracies of tcp positions. Use "
47  "the ur_calibration tool to extract the correct calibration from the robot and pass that into the "
48  "description. See "
49  "[https://github.com/UniversalRobots/Universal_Robots_ROS_Driver#extract-calibration-information] "
50  "for details.");
51  }
52  else
53  {
54  URCL_LOG_INFO("Calibration checked successfully.");
55  }
56 
57  checked_ = true;
58  }
59 
60  return true;
61 }
62 } // namespace urcl
#define URCL_LOG_ERROR(...)
Definition: log.h:37
virtual bool consume(std::shared_ptr< primary_interface::PrimaryPackage > product)
Consumes a package, checking its hash if it is a KinematicsInfo package. If the hash does not match t...
This messages contains information about the robot&#39;s calibration. The DH parameters are a combination...
CalibrationChecker(const std::string &expected_hash)
Creates a new CalibrationChecker object with an expected hash calculated from the used kinematics...
#define URCL_LOG_INFO(...)
Definition: log.h:36


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