|
| 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 | + |
| 31 | +#pragma once |
| 32 | + |
| 33 | +#include "ur_client_library/types.h" |
| 34 | +#include "ur_client_library/primary/robot_state.h" |
| 35 | +#include <iostream> |
| 36 | + |
| 37 | +namespace urcl |
| 38 | +{ |
| 39 | +namespace primary_interface |
| 40 | +{ |
| 41 | +/*! |
| 42 | + * \brief The ConfigurationData class handles the configuration data sent via the primary UR interface. |
| 43 | + */ |
| 44 | +class ConfigurationData : public RobotState |
| 45 | +{ |
| 46 | +public: |
| 47 | + struct JointPositionLimits |
| 48 | + { |
| 49 | + double joint_min_limit; |
| 50 | + double joint_max_limit; |
| 51 | + }; |
| 52 | + |
| 53 | + struct JointMotionLimits |
| 54 | + { |
| 55 | + double joint_max_speed; |
| 56 | + double joint_max_acceleration; |
| 57 | + }; |
| 58 | + |
| 59 | + ConfigurationData() = delete; |
| 60 | + |
| 61 | + /*! |
| 62 | + * \brief Creates a new ConfigurationData object. |
| 63 | + * |
| 64 | + * \param type The type of RobotState message received |
| 65 | + */ |
| 66 | + ConfigurationData(const RobotStateType type) : RobotState(type) |
| 67 | + { |
| 68 | + } |
| 69 | + |
| 70 | + /*! |
| 71 | + * \brief Creates a copy of a ConfigurationData object. |
| 72 | + * |
| 73 | + * \param pkg The ConfigurationData object to be copied |
| 74 | + */ |
| 75 | + ConfigurationData(const ConfigurationData& pkg); |
| 76 | + |
| 77 | + virtual ~ConfigurationData() = default; |
| 78 | + |
| 79 | + /*! |
| 80 | + * \brief Sets the attributes of the package by parsing a serialized representation of the |
| 81 | + * package. |
| 82 | + * |
| 83 | + * \param bp A parser containing a serialized version of the package |
| 84 | + * |
| 85 | + * \returns True, if the package was parsed successfully, false otherwise |
| 86 | + */ |
| 87 | + virtual bool parseWith(comm::BinParser& bp); |
| 88 | + |
| 89 | + /*! |
| 90 | + * \brief Consume this package with a specific consumer. |
| 91 | + * |
| 92 | + * \param consumer Placeholder for the consumer calling this |
| 93 | + * |
| 94 | + * \returns true on success |
| 95 | + */ |
| 96 | + virtual bool consumeWith(AbstractPrimaryConsumer& consumer); |
| 97 | + |
| 98 | + /*! |
| 99 | + * \brief Produces a human readable representation of the package object. |
| 100 | + * |
| 101 | + * \returns A string representing the object |
| 102 | + */ |
| 103 | + virtual std::string toString() const; |
| 104 | + |
| 105 | + std::array<JointPositionLimits, 6> joint_position_limits_; |
| 106 | + std::array<JointMotionLimits, 6> joint_motion_limits_; |
| 107 | + double v_joint_default_; |
| 108 | + double a_joint_default_; |
| 109 | + double v_tool_default_; |
| 110 | + double a_tool_default_; |
| 111 | + double eq_radius_; |
| 112 | + urcl::vector6d_t dh_a_; |
| 113 | + urcl::vector6d_t dh_d_; |
| 114 | + urcl::vector6d_t dh_alpha_; |
| 115 | + urcl::vector6d_t dh_theta_; |
| 116 | + int32_t masterboard_version_; |
| 117 | + int32_t controller_box_type_; |
| 118 | + int32_t robot_type_; |
| 119 | + int32_t robot_sub_type_; |
| 120 | +}; |
| 121 | + |
| 122 | +} // namespace primary_interface |
| 123 | +} // namespace urcl |
0 commit comments