set_tool_offset.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * FSRobo-R Package BSDL
3 * ---------
4 * Copyright (C) 2019 FUJISOFT. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors
14 * may be used to endorse or promote products derived from this software without
15 * specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *********************************************************************/
28 
32 
34 
35 namespace fsrobo_r_driver
36 {
37 namespace simple_message
38 {
39 namespace set_tool_offset
40 {
41 
43 {
44  this->init();
45 }
46 
48 {
49 }
50 
52 {
53  this->init(0, 0, 0, 0, 0, 0);
54 }
55 
57 {
58  this->setX(x);
59  this->setY(y);
60  this->setZ(z);
61  this->setRz(rz);
62  this->setRy(ry);
63  this->setRx(rx);
64 }
65 
67 {
68  this->setX(src.getX());
69  this->setY(src.getY());
70  this->setZ(src.getZ());
71  this->setRz(src.getRz());
72  this->setRy(src.getRy());
73  this->setRx(src.getRx());
74 }
75 
77 {
78  bool rslt = this->x_ == rhs.x_ &&
79  this->y_ == rhs.y_ &&
80  this->z_ == rhs.z_ &&
81  this->rz_ == rhs.rz_ &&
82  this->ry_ == rhs.ry_ &&
83  this->rx_ == rhs.rx_;
84 
85  return rslt;
86 }
87 
89 {
90  LOG_COMM("Executing SetToolOffset command load");
91 
92  if (!buffer->load(this->x_))
93  {
94  LOG_ERROR("Failed to load SetToolOffset x");
95  return false;
96  }
97 
98  if (!buffer->load(this->y_))
99  {
100  LOG_ERROR("Failed to load SetToolOffset y");
101  return false;
102  }
103 
104  if (!buffer->load(this->z_))
105  {
106  LOG_ERROR("Failed to load SetToolOffset z");
107  return false;
108  }
109 
110  if (!buffer->load(this->rz_))
111  {
112  LOG_ERROR("Failed to load SetToolOffset rz");
113  return false;
114  }
115 
116  if (!buffer->load(this->ry_))
117  {
118  LOG_ERROR("Failed to load SetToolOffset ry");
119  return false;
120  }
121 
122  if (!buffer->load(this->rx_))
123  {
124  LOG_ERROR("Failed to load SetToolOffset rx");
125  return false;
126  }
127 
128  LOG_COMM("SetToolOffset data successfully loaded");
129  return true;
130 }
131 
133 {
134  LOG_COMM("Executing SetToolOffset command unload");
135 
136  if (!buffer->unload(this->x_)) {
137  LOG_ERROR("Failed to unload SetToolOffset x");
138  return false;
139  }
140 
141  if (!buffer->unload(this->y_)) {
142  LOG_ERROR("Failed to unload SetToolOffset y");
143  return false;
144  }
145 
146  if (!buffer->unload(this->z_)) {
147  LOG_ERROR("Failed to unload SetToolOffset z");
148  return false;
149  }
150 
151  if (!buffer->unload(this->rz_)) {
152  LOG_ERROR("Failed to unload SetToolOffset rz");
153  return false;
154  }
155 
156  if (!buffer->unload(this->ry_)) {
157  LOG_ERROR("Failed to unload SetToolOffset ry");
158  return false;
159  }
160 
161  if (!buffer->unload(this->rx_)) {
162  LOG_ERROR("Failed to unload SetToolOffset rx");
163  return false;
164  }
165 
166  LOG_COMM("SetToolOffset data successfully unloaded");
167  return true;
168 }
169 
170 }
171 }
172 }
void setRx(industrial::shared_types::shared_real rx)
Sets offset.
industrial::shared_types::shared_real x_
Values of tool origin.
industrial::shared_types::shared_real getX()
Returns offset.
industrial::shared_types::shared_real getZ()
Returns offset.
industrial::shared_types::shared_real getRx()
Returns offset.
#define LOG_COMM(format,...)
Class encapsulated tool offset data. FSRobo-R specific interface to set tool offset on the controller...
bool load(industrial::shared_types::shared_bool value)
#define LOG_ERROR(format,...)
void setRy(industrial::shared_types::shared_real ry)
Sets offset.
void setY(industrial::shared_types::shared_real y)
Sets offset.
bool unload(industrial::byte_array::ByteArray *buffer)
void setX(industrial::shared_types::shared_real x)
Sets offset.
void init()
Initializes a empty set tool offset command.
void copyFrom(SetToolOffset &src)
Copies the passed in value.
industrial::shared_types::shared_real getRz()
Returns offset.
void setZ(industrial::shared_types::shared_real z)
Sets offset.
industrial::shared_types::shared_real getY()
Returns offset.
void setRz(industrial::shared_types::shared_real rz)
Sets offset.
bool load(industrial::byte_array::ByteArray *buffer)
bool unload(industrial::shared_types::shared_bool &value)
bool operator==(SetToolOffset &rhs)
== operator implementation
industrial::shared_types::shared_real getRy()
Returns offset.


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29