kinematics_info.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 // Created on behalf of Universal Robots A/S
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // -- END LICENSE BLOCK ------------------------------------------------
19 
20 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 
29 #include "ur_client_library/log.h"
32 
33 #include <iomanip>
34 
35 namespace urcl
36 {
37 namespace primary_interface
38 {
40 {
41  bp.parse(checksum_);
42  bp.parse(dh_theta_);
43  bp.parse(dh_a_);
44  bp.parse(dh_d_);
45  bp.parse(dh_alpha_);
47 
48  return true;
49 }
50 
52 {
53  return consumer.consume(*this);
54 }
55 
56 std::string KinematicsInfo::toString() const
57 {
58  std::stringstream os;
59  os << "checksum: [";
60  for (size_t i = 0; i < checksum_.size(); ++i)
61  {
62  os << checksum_[i] << " ";
63  }
64  os << "]" << std::endl;
65  os << "dh_theta: [";
66  for (size_t i = 0; i < dh_theta_.size(); ++i)
67  {
68  os << std::setprecision(15) << dh_theta_[i] << " ";
69  }
70  os << "]" << std::endl;
71 
72  os << "dh_a: [";
73  for (size_t i = 0; i < dh_a_.size(); ++i)
74  {
75  os << std::setprecision(15) << dh_a_[i] << " ";
76  }
77  os << "]" << std::endl;
78 
79  os << "dh_d: [";
80  for (size_t i = 0; i < dh_d_.size(); ++i)
81  {
82  os << std::setprecision(15) << dh_d_[i] << " ";
83  }
84  os << "]" << std::endl;
85 
86  os << "dh_alpha: [";
87  for (size_t i = 0; i < dh_alpha_.size(); ++i)
88  {
89  os << std::setprecision(15) << dh_alpha_[i] << " ";
90  }
91  os << "]" << std::endl;
92 
93  os << "calibration_status: " << calibration_status_ << std::endl;
94 
95  return os.str();
96 }
97 
98 std::string KinematicsInfo::toHash() const
99 {
100  std::stringstream ss;
101  for (size_t i = 0; i < 6; ++i)
102  {
103  ss << dh_theta_[i];
104  ss << dh_d_[i];
105  ss << dh_a_[i];
106  ss << dh_alpha_[i];
107  }
108  std::hash<std::string> hash_fn;
109  return "calib_" + std::to_string(hash_fn(ss.str()));
110 }
111 } // namespace primary_interface
112 } // namespace urcl
urcl::primary_interface::KinematicsInfo::dh_theta_
vector6d_t dh_theta_
Definition: kinematics_info.h:103
urcl::primary_interface::AbstractPrimaryConsumer::consume
virtual bool consume(std::shared_ptr< PrimaryPackage > product) final
This consume method is usually being called by the Pipeline structure. We don't necessarily need to k...
Definition: abstract_primary_consumer.h:65
urcl::primary_interface::KinematicsInfo::toHash
std::string toHash() const
Calculates a hash value of the parameters to allow for identification of a calibration.
Definition: kinematics_info.cpp:98
urcl::primary_interface::KinematicsInfo::dh_d_
vector6d_t dh_d_
Definition: kinematics_info.h:105
urcl
Definition: bin_parser.h:36
urcl::primary_interface::KinematicsInfo::consumeWith
virtual bool consumeWith(AbstractPrimaryConsumer &consumer)
Consume this specific package with a specific consumer.
Definition: kinematics_info.cpp:51
urcl::primary_interface::KinematicsInfo::calibration_status_
uint32_t calibration_status_
Definition: kinematics_info.h:107
urcl::primary_interface::KinematicsInfo::parseWith
virtual bool parseWith(comm::BinParser &bp)
Sets the attributes of the package by parsing a serialized representation of the package.
Definition: kinematics_info.cpp:39
urcl::primary_interface::KinematicsInfo::toString
virtual std::string toString() const
Produces a human readable representation of the package object.
Definition: kinematics_info.cpp:56
urcl::primary_interface::KinematicsInfo::dh_alpha_
vector6d_t dh_alpha_
Definition: kinematics_info.h:106
kinematics_info.h
log.h
abstract_primary_consumer.h
urcl::comm::BinParser::parse
void parse(T &val)
Parses the next bytes as given type.
Definition: bin_parser.h:139
urcl::comm::BinParser
The BinParser class handles a byte buffer and functionality to iteratively parse the content.
Definition: bin_parser.h:44
urcl::primary_interface::KinematicsInfo::dh_a_
vector6d_t dh_a_
Definition: kinematics_info.h:104
urcl::primary_interface::KinematicsInfo::checksum_
vector6uint32_t checksum_
Definition: kinematics_info.h:102
urcl::primary_interface::AbstractPrimaryConsumer
Base consumer for primary packages.
Definition: abstract_primary_consumer.h:50


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