|
| 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 | +#ifndef UR_CLIENT_LIBRARY_ROBOT_MODE_DATA_H_INCLUDED |
| 32 | +#define UR_CLIENT_LIBRARY_ROBOT_MODE_DATA_H_INCLUDED |
| 33 | + |
| 34 | +#include <stdexcept> |
| 35 | +#include "ur_client_library/types.h" |
| 36 | +#include "ur_client_library/primary/robot_state.h" |
| 37 | +namespace urcl |
| 38 | +{ |
| 39 | +namespace primary_interface |
| 40 | +{ |
| 41 | + |
| 42 | +/*! |
| 43 | + * \brief This messages contains data about the mode of the robot. |
| 44 | + */ |
| 45 | +class RobotModeData : public RobotState |
| 46 | +{ |
| 47 | +public: |
| 48 | + RobotModeData() = delete; |
| 49 | + /*! |
| 50 | + * \brief Creates a new RobotModeData object. |
| 51 | + * |
| 52 | + * \param type The type of RobotState message received |
| 53 | + */ |
| 54 | + RobotModeData(const RobotStateType type) : RobotState(type) |
| 55 | + { |
| 56 | + } |
| 57 | + |
| 58 | + /*! |
| 59 | + * \brief Creates a copy of a RobotModeData object. |
| 60 | + * |
| 61 | + * \param pkg The RobotModeData object to be copied |
| 62 | + */ |
| 63 | + RobotModeData(const RobotModeData& pkg); |
| 64 | + |
| 65 | + virtual ~RobotModeData() = default; |
| 66 | + |
| 67 | + /*! |
| 68 | + * \brief Sets the attributes of the package by parsing a serialized representation of the |
| 69 | + * package. |
| 70 | + * |
| 71 | + * \param bp A parser containing a serialized version of the package |
| 72 | + * |
| 73 | + * \returns True, if the package was parsed successfully, false otherwise |
| 74 | + */ |
| 75 | + virtual bool parseWith(comm::BinParser& bp); |
| 76 | + |
| 77 | + /*! |
| 78 | + * \brief Consume this specific package with a specific consumer. |
| 79 | + * |
| 80 | + * \param consumer Placeholder for the consumer calling this |
| 81 | + * |
| 82 | + * \returns true on success |
| 83 | + */ |
| 84 | + virtual bool consumeWith(AbstractPrimaryConsumer& consumer); |
| 85 | + |
| 86 | + /*! |
| 87 | + * \brief Produces a human readable representation of the package object. |
| 88 | + * |
| 89 | + * \returns A string representing the object |
| 90 | + */ |
| 91 | + virtual std::string toString() const; |
| 92 | + |
| 93 | + uint64_t timestamp_; |
| 94 | + bool is_real_robot_connected_; |
| 95 | + bool is_real_robot_enabled_; |
| 96 | + bool is_robot_power_on_; |
| 97 | + bool is_emergency_stopped_; |
| 98 | + bool is_protective_stopped_; |
| 99 | + bool is_program_running_; |
| 100 | + bool is_program_paused_; |
| 101 | + int8_t robot_mode_; |
| 102 | + uint8_t control_mode_; |
| 103 | + double target_speed_fraction_; |
| 104 | + double speed_scaling_; |
| 105 | + double target_speed_fraction_limit_; |
| 106 | + std::string reserved_; |
| 107 | +}; |
| 108 | + |
| 109 | +} // namespace primary_interface |
| 110 | +} // namespace urcl |
| 111 | + |
| 112 | +#endif // ifndef UR_CLIENT_LIBRARY_ROBOT_MODE_DATA_H_INCLUDED |
0 commit comments