|
| 1 | +/* |
| 2 | + * Copyright (C) 2021 Open Source Robotics Foundation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + */ |
| 17 | +#ifndef IGNITION_RENDERING_JOINTVISUAL_HH_ |
| 18 | +#define IGNITION_RENDERING_JOINTVISUAL_HH_ |
| 19 | + |
| 20 | +#include <string> |
| 21 | + |
| 22 | +#include <ignition/math/Vector3.hh> |
| 23 | + |
| 24 | +#include "ignition/rendering/config.hh" |
| 25 | +#include "ignition/rendering/Object.hh" |
| 26 | +#include "ignition/rendering/RenderTypes.hh" |
| 27 | +#include "ignition/rendering/Visual.hh" |
| 28 | + |
| 29 | +namespace ignition |
| 30 | +{ |
| 31 | + namespace rendering |
| 32 | + { |
| 33 | + inline namespace IGNITION_RENDERING_VERSION_NAMESPACE { |
| 34 | + // |
| 35 | + /// \brief Enum for JointVisual types |
| 36 | + enum IGNITION_RENDERING_VISIBLE JointVisualType |
| 37 | + { |
| 38 | + /// \brief No type |
| 39 | + JVT_NONE = 0, |
| 40 | + |
| 41 | + /// \brief Revolute joint type |
| 42 | + JVT_REVOLUTE = 1, |
| 43 | + |
| 44 | + /// \brief Revolute2 joint type |
| 45 | + JVT_REVOLUTE2 = 2, |
| 46 | + |
| 47 | + /// \brief Prismatic joint type |
| 48 | + JVT_PRISMATIC = 3, |
| 49 | + |
| 50 | + /// \brief Universal joint type |
| 51 | + JVT_UNIVERSAL = 4, |
| 52 | + |
| 53 | + /// \brief Ball joint type |
| 54 | + JVT_BALL = 5, |
| 55 | + |
| 56 | + /// \brief Screw joint type |
| 57 | + JVT_SCREW = 6, |
| 58 | + |
| 59 | + /// \brief Gearbox joint type |
| 60 | + JVT_GEARBOX = 7, |
| 61 | + |
| 62 | + /// \brief Fixed joint type |
| 63 | + JVT_FIXED = 8 |
| 64 | + }; |
| 65 | + |
| 66 | + /// \class JointVisual JointVisual.hh |
| 67 | + /// ignition/rendering/JointVisual.hh |
| 68 | + /// \brief Represents a joint visual |
| 69 | + class IGNITION_RENDERING_VISIBLE JointVisual : |
| 70 | + public virtual Visual |
| 71 | + { |
| 72 | + /// \brief Destructor |
| 73 | + public: virtual ~JointVisual() {} |
| 74 | + |
| 75 | + /// \brief Create an axis and attach it to the joint visual. |
| 76 | + /// \param[in] _axis Axis vector. |
| 77 | + /// \param[in] _useParentFrame True if axis vector is expressed in |
| 78 | + /// parent frame. |
| 79 | + public: virtual void SetAxis(const ignition::math::Vector3d &_axis, |
| 80 | + bool _useParentFrame = false) = 0; |
| 81 | + |
| 82 | + /// \brief Get axis vector. |
| 83 | + /// \return The axis vector. |
| 84 | + public: virtual ignition::math::Vector3d Axis() const = 0; |
| 85 | + |
| 86 | + /// \brief Create a parent axis for hinge2 and universal joint types |
| 87 | + /// and attach it to the joint visual. |
| 88 | + /// \param[in] _axis Axis vector. |
| 89 | + /// \param[in] _parentName Joint parent name. |
| 90 | + /// \param[in] _useParentFrame True if axis vector is expressed in |
| 91 | + /// parent frame. |
| 92 | + public: virtual void SetParentAxis( |
| 93 | + const ignition::math::Vector3d &_axis, |
| 94 | + const std::string &_parentName, |
| 95 | + bool _useParentFrame = false) = 0; |
| 96 | + |
| 97 | + /// \brief Get parent axis vector. |
| 98 | + /// \return The parent axis vector. |
| 99 | + public: virtual ignition::math::Vector3d ParentAxis() const = 0; |
| 100 | + |
| 101 | + /// \brief Update an axis' arrow visual. |
| 102 | + /// \param[in] _axis Axis vector. |
| 103 | + /// \param[in] _useParentFrame True if axis vector is expressed in |
| 104 | + /// parent frame. |
| 105 | + /// \return True if axis was updated else false. |
| 106 | + public: virtual bool UpdateAxis(const ignition::math::Vector3d &_axis, |
| 107 | + bool _useParentFrame = false) = 0; |
| 108 | + |
| 109 | + /// \brief Update the parent axis' arrow visual if it exists. |
| 110 | + /// \param[in] _axis Axis vector. |
| 111 | + /// \param[in] _useParentFrame True if axis vector is expressed in |
| 112 | + /// parent frame. |
| 113 | + /// \return True if parent axis was updated else false. |
| 114 | + public: virtual bool UpdateParentAxis( |
| 115 | + const ignition::math::Vector3d &_axis, |
| 116 | + bool _useParentFrame = false) = 0; |
| 117 | + |
| 118 | + /// \brief Set type for joint visual. |
| 119 | + /// \param[in] _type The type of visualisation for joint. |
| 120 | + public: virtual void SetType(const JointVisualType _type) = 0; |
| 121 | + |
| 122 | + /// \brief Get joint visual type. |
| 123 | + /// \return The joint visual type. |
| 124 | + public: virtual JointVisualType Type() const = 0; |
| 125 | + |
| 126 | + /// \brief Get the JointVisual which is attached to the parent. |
| 127 | + /// \return Parent axis visual. |
| 128 | + public: virtual JointVisualPtr ParentAxisVisual() const = 0; |
| 129 | + |
| 130 | + /// \brief Get the arrow visual which represents the axis attached to the |
| 131 | + /// child. |
| 132 | + /// \return Arrow visual. |
| 133 | + public: virtual ArrowVisualPtr ArrowVisual() const = 0; |
| 134 | + }; |
| 135 | + } |
| 136 | + } |
| 137 | +} |
| 138 | +#endif |
0 commit comments