Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Friction and ODE classes #955

Merged
merged 5 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions include/sdf/Surface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,103 @@ namespace sdf
IGN_UTILS_IMPL_PTR(dataPtr)
};

/// \brief ODE information for a friction.
class SDFORMAT_VISIBLE ODE
{
/// \brief Default constructor
public: ODE();

/// \brief Load the contact based on a element pointer. This is *not* the
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
/// usual entry point. Typical usage of the SDF DOM is through the Root
/// object.
/// \param[in] _sdf The SDF Element pointer
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Set the Mu
/// \returns ODE mu
public: double Mu() const;

/// \brief Set Mu
/// \param[in] _mu ODE mu
public: void SetMu(double _mu);

/// \brief Get the Mu2
/// \returns ODE mu2
public: double Mu2() const;

/// \brief Set Mu2
/// \param[in] _mu2 ODE mu2
public: void SetMu2(double _mu2);

/// \brief Get the fdir
/// \returns ODE fdir
public: const ignition::math::Vector3d Fdir1() const;
ahcorde marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Set fdir
/// \param[in] _mu2 ODE fdir
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
public: void SetFdir1(ignition::math::Vector3d _fdir);
ahcorde marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Get the Mu2
/// \returns ODE mu2
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
public: double Slip1() const;

/// \brief Set Slip1
/// \param[in] _mu2 ODE Slip1
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
public: void SetSlip1(double _slip1);

/// \brief Get the Slip2
/// \returns ODE Slip2
public: double Slip2() const;

/// \brief Set Slip2
/// \param[in] _mu2 ODE Slip2
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
public: void SetSlip2(double _slip2);

/// \brief Get a pointer to the SDF element that was used during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
};

/// \brief Friction information for a surface.
class SDFORMAT_VISIBLE Friction
{
/// \brief Default constructor
public: Friction();

/// \brief Load the contact based on a element pointer. This is *not* the
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
/// usual entry point. Typical usage of the SDF DOM is through the Root
/// object.
/// \param[in] _sdf The SDF Element pointer
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Get the associated ode object
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
/// \returns Pointer to the associated ode object,
/// nullptr if the Surface doesn't contain a ode element.
public: const sdf::ODE *ODE() const;

/// \brief Set the associated ode object.
/// \param[in] _cont The ode object.
public: void SetODE(const sdf::ODE &_ode);

/// \brief Get a pointer to the SDF element that was used during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
};

/// \brief Surface information for a collision.
class SDFORMAT_VISIBLE Surface
{
Expand Down Expand Up @@ -87,6 +184,15 @@ namespace sdf
/// \param[in] _cont The contact object.
public: void SetContact(const sdf::Contact &_contact);

/// \brief Get the associated friction object
/// \returns Pointer to the associated friction object,
/// nullptr if the Surface doesn't contain a friction element.
public: const sdf::Friction *Friction() const;

/// \brief Set the associated friction object.
/// \param[in] _cont The friction object.
ahcorde marked this conversation as resolved.
Show resolved Hide resolved
public: void SetFriction(const sdf::Friction &_friction);

/// \brief Create and return an SDF element filled with data from this
/// surface.
/// Note that parameter passing functionality is not captured with this
Expand Down
Loading