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 //
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 "ur_client_library/log.h"
31 
32 #include <iomanip>
33 
34 namespace urcl
35 {
36 namespace primary_interface
37 {
39 {
40  bp.parse(checksum_);
41  bp.parse(dh_theta_);
42  bp.parse(dh_a_);
43  bp.parse(dh_d_);
44  bp.parse(dh_alpha_);
46 
47  return true;
48 }
49 
51 {
52  return consumer.consume(*this);
53 }
54 
55 std::string KinematicsInfo::toString() const
56 {
57  std::stringstream os;
58  os << "checksum: [";
59  for (size_t i = 0; i < checksum_.size(); ++i)
60  {
61  os << checksum_[i] << " ";
62  }
63  os << "]" << std::endl;
64  os << "dh_theta: [";
65  for (size_t i = 0; i < dh_theta_.size(); ++i)
66  {
67  os << std::setprecision(15) << dh_theta_[i] << " ";
68  }
69  os << "]" << std::endl;
70 
71  os << "dh_a: [";
72  for (size_t i = 0; i < dh_a_.size(); ++i)
73  {
74  os << std::setprecision(15) << dh_a_[i] << " ";
75  }
76  os << "]" << std::endl;
77 
78  os << "dh_d: [";
79  for (size_t i = 0; i < dh_d_.size(); ++i)
80  {
81  os << std::setprecision(15) << dh_d_[i] << " ";
82  }
83  os << "]" << std::endl;
84 
85  os << "dh_alpha: [";
86  for (size_t i = 0; i < dh_alpha_.size(); ++i)
87  {
88  os << std::setprecision(15) << dh_alpha_[i] << " ";
89  }
90  os << "]" << std::endl;
91 
92  os << "calibration_status: " << calibration_status_ << std::endl;
93 
94  return os.str();
95 }
96 
97 std::string KinematicsInfo::toHash() const
98 {
99  std::stringstream ss;
100  for (size_t i = 0; i < 6; ++i)
101  {
102  ss << dh_theta_[i];
103  ss << dh_d_[i];
104  ss << dh_a_[i];
105  ss << dh_alpha_[i];
106  }
107  std::hash<std::string> hash_fn;
108  return "calib_" + std::to_string(hash_fn(ss.str()));
109 }
110 } // namespace primary_interface
111 } // namespace urcl
void parse(T &val)
Parses the next bytes as given type.
Definition: bin_parser.h:139
The BinParser class handles a byte buffer and functionality to iteratively parse the content...
Definition: bin_parser.h:44
virtual bool consume(std::shared_ptr< PrimaryPackage > product) final
This consume method is usally being called by the Pipeline structure. We don&#39;t necessarily need to kn...
virtual bool parseWith(comm::BinParser &bp)
Sets the attributes of the package by parsing a serialized representation of the package.
std::string toHash() const
Calculates a hash value of the parameters to allow for identification of a calibration.
virtual std::string toString() const
Produces a human readable representation of the package object.
virtual bool consumeWith(AbstractPrimaryConsumer &consumer)
Consume this specific package with a specific consumer.


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