configuration_data.cpp
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 
33 
34 namespace urcl
35 {
36 namespace primary_interface
37 {
38 
40 {
47  eq_radius_ = pkg.eq_radius_;
48  dh_a_ = pkg.dh_a_;
49  dh_d_ = pkg.dh_d_;
50  dh_alpha_ = pkg.dh_alpha_;
51  dh_theta_ = pkg.dh_theta_;
56 }
57 
59 {
60  for (auto& joint_limits : joint_position_limits_)
61  {
62  bp.parse(joint_limits.joint_min_limit);
63  bp.parse(joint_limits.joint_max_limit);
64  }
65  for (auto& motion_limits : joint_motion_limits_)
66  {
67  bp.parse(motion_limits.joint_max_speed);
68  bp.parse(motion_limits.joint_max_acceleration);
69  }
74  bp.parse(eq_radius_);
75  bp.parse(dh_a_);
76  bp.parse(dh_d_);
77  bp.parse(dh_alpha_);
78  bp.parse(dh_theta_);
81  bp.parse(robot_type_);
83 
84  return true;
85 }
86 
88 {
89  return consumer.consume(*this);
90 }
91 
92 std::string ConfigurationData::toString() const
93 {
94  std::stringstream os;
95  os << "ConfigurationData:" << std::endl;
96  os << "Joint position limits: [" << std::endl;
97  for (auto& limits : joint_position_limits_)
98  {
99  os << " {min: " << limits.joint_min_limit << ", max " << limits.joint_max_limit << "} " << std::endl;
100  }
101  os << "]" << std::endl;
102  os << "Joint motion limits: [" << std::endl;
103  for (auto& limits : joint_motion_limits_)
104  {
105  os << " {max joint speed: " << limits.joint_max_speed
106  << ", max joint acceleration: " << limits.joint_max_acceleration << "} " << std::endl;
107  }
108  os << "]" << std::endl;
109  os << "Velocity joint default: " << v_joint_default_ << std::endl;
110  os << "Acceleration joint default: " << a_joint_default_ << std::endl;
111  os << "Velocity tool default: " << v_tool_default_ << std::endl;
112  os << "Acceleration tool default: " << a_tool_default_ << std::endl;
113  os << "Equivalent radius: " << eq_radius_ << std::endl;
114  os << "dh_a: [";
115  for (size_t i = 0; i < dh_a_.size(); ++i)
116  {
117  os << dh_a_[i] << " ";
118  }
119  os << "]" << std::endl;
120 
121  os << "dh_d: [";
122  for (size_t i = 0; i < dh_d_.size(); ++i)
123  {
124  os << dh_d_[i] << " ";
125  }
126  os << "]" << std::endl;
127 
128  os << "dh_alpha: [";
129  for (size_t i = 0; i < dh_alpha_.size(); ++i)
130  {
131  os << dh_alpha_[i] << " ";
132  }
133  os << "]" << std::endl;
134  os << "dh_theta: [";
135  for (size_t i = 0; i < dh_theta_.size(); ++i)
136  {
137  os << dh_theta_[i] << " ";
138  }
139  os << "]" << std::endl;
140 
141  os << "Masterboard version: " << masterboard_version_ << std::endl;
142  os << "Controller box type: " << controller_box_type_ << std::endl;
143  os << "Robot type: " << robot_type_ << std::endl;
144  os << "Robot sub type: " << robot_sub_type_ << std::endl;
145 
146  return os.str();
147 }
148 
149 } // namespace primary_interface
150 } // namespace urcl
urcl::primary_interface::ConfigurationData::toString
virtual std::string toString() const
Produces a human readable representation of the package object.
Definition: configuration_data.cpp:92
urcl::primary_interface::ConfigurationData::joint_motion_limits_
std::array< JointMotionLimits, 6 > joint_motion_limits_
Definition: configuration_data.h:106
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::ConfigurationData::dh_d_
urcl::vector6d_t dh_d_
Definition: configuration_data.h:113
urcl::primary_interface::ConfigurationData::robot_sub_type_
int32_t robot_sub_type_
Definition: configuration_data.h:119
urcl::primary_interface::ConfigurationData::v_tool_default_
double v_tool_default_
Definition: configuration_data.h:109
urcl::primary_interface::ConfigurationData::robot_type_
int32_t robot_type_
Definition: configuration_data.h:118
urcl::primary_interface::ConfigurationData::dh_theta_
urcl::vector6d_t dh_theta_
Definition: configuration_data.h:115
urcl
Definition: bin_parser.h:36
urcl::primary_interface::ConfigurationData::a_joint_default_
double a_joint_default_
Definition: configuration_data.h:108
urcl::primary_interface::ConfigurationData::controller_box_type_
int32_t controller_box_type_
Definition: configuration_data.h:117
urcl::primary_interface::ConfigurationData::a_tool_default_
double a_tool_default_
Definition: configuration_data.h:110
urcl::primary_interface::ConfigurationData::parseWith
virtual bool parseWith(comm::BinParser &bp)
Sets the attributes of the package by parsing a serialized representation of the package.
Definition: configuration_data.cpp:58
urcl::primary_interface::ConfigurationData
The ConfigurationData class handles the configuration data sent via the primary UR interface.
Definition: configuration_data.h:44
urcl::primary_interface::ConfigurationData::dh_a_
urcl::vector6d_t dh_a_
Definition: configuration_data.h:112
configuration_data.h
urcl::primary_interface::RobotStateType::CONFIGURATION_DATA
@ CONFIGURATION_DATA
urcl::primary_interface::ConfigurationData::consumeWith
virtual bool consumeWith(AbstractPrimaryConsumer &consumer)
Consume this package with a specific consumer.
Definition: configuration_data.cpp:87
abstract_primary_consumer.h
urcl::primary_interface::RobotStateType
RobotStateType
Possible RobotState types.
Definition: robot_state.h:42
urcl::primary_interface::ConfigurationData::dh_alpha_
urcl::vector6d_t dh_alpha_
Definition: configuration_data.h:114
urcl::primary_interface::ConfigurationData::joint_position_limits_
std::array< JointPositionLimits, 6 > joint_position_limits_
Definition: configuration_data.h:105
urcl::primary_interface::ConfigurationData::eq_radius_
double eq_radius_
Definition: configuration_data.h:111
urcl::primary_interface::RobotState
Base class for a RobotState data packages will be used directly.
Definition: robot_state.h:59
urcl::primary_interface::ConfigurationData::masterboard_version_
int32_t masterboard_version_
Definition: configuration_data.h:116
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::ConfigurationData::v_joint_default_
double v_joint_default_
Definition: configuration_data.h:107
urcl::primary_interface::ConfigurationData::ConfigurationData
ConfigurationData()=delete
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