##

Inertial.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PHYSICS_INERTIAL_HH_
#define GAZEBO_PHYSICS_INERTIAL_HH_
#include <string>
#include <memory>
#include <ignition/math/Inertial.hh>
#include <sdf/sdf.hh>
#include <ignition/math/Vector3.hh>
#include <ignition/math/Quaternion.hh>
#include <ignition/math/Matrix3.hh>
#include "gazebo/msgs/msgs.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
// Forward declare private data
class InertialPrivate;
class GZ_PHYSICS_VISIBLE Inertial
{
public: Inertial();
public: explicit Inertial(const double _mass);
// cppcheck-suppress noExplicitConstructor
public: Inertial(const ignition::math::Inertiald &_inertial);
public: Inertial(const Inertial &_inertial);
public: virtual ~Inertial();
public: void Load(sdf::ElementPtr _sdf);
public: void UpdateParameters(sdf::ElementPtr _sdf);
public: void Reset();
public: ignition::math::Inertiald Ign() const;
public: void SetMass(const double _m);
public: double Mass() const;
public: void SetInertiaMatrix(
const double _ixx, const double _iyy, const double _izz,
const double _ixy, const double _ixz, const double iyz);
public: void SetCoG(const double _cx, const double _cy, const double _cz);
public: void SetCoG(const ignition::math::Vector3d &_center);
public: void SetCoG(const double _cx, const double _cy, const double _cz,
const double _rx, const double _ry, const double _rz);
public: void SetCoG(const ignition::math::Pose3d &_c);
public: const ignition::math::Vector3d &CoG() const;
public: ignition::math::Pose3d Pose() const;
public: const ignition::math::Vector3d &PrincipalMoments() const;
public: const ignition::math::Vector3d &ProductsOfInertia() const;
public: double IXX() const;
public: double IYY() const;
public: double IZZ() const;
public: double IXY() const;
public: double IXZ() const;
public: double IYZ() const;
public: void SetIXX(const double _v);
public: void SetIYY(const double _v);
public: void SetIZZ(const double _v);
public: void SetIXY(const double _v);
public: void SetIXZ(const double _v);
public: void SetIYZ(const double _v);
public: void Rotate(const ignition::math::Quaterniond &_rot);
public: Inertial &operator=(const Inertial &_inertial);
public: Inertial &operator=(const ignition::math::Inertiald &_inertial);
public: Inertial operator+(const Inertial &_inertial) const;
public: const Inertial &operator+=(const Inertial &_inertial);
public: void ProcessMsg(const msgs::Inertial &_msg);
public: ignition::math::Matrix3d MOI(
const ignition::math::Pose3d &_pose) const;
public: Inertial operator()(
const ignition::math::Pose3d &_frameOffset) const;
public: Inertial operator()(
const ignition::math::Vector3d &_frameOffset) const;
public: friend std::ostream &operator<<(std::ostream &_out,
const gazebo::physics::Inertial &_inertial)
{
_out << "Mass[" << _inertial.Mass() << "] CoG["
<< _inertial.CoG() << "]\n";
_out << "IXX[" << _inertial.PrincipalMoments().X() << "] "
<< "IYY[" << _inertial.PrincipalMoments().Y() << "] "
<< "IZZ[" << _inertial.PrincipalMoments().Z() << "]\n";
_out << "IXY[" << _inertial.ProductsOfInertia().X() << "] "
<< "IXZ[" << _inertial.ProductsOfInertia().Y() << "] "
<< "IYZ[" << _inertial.ProductsOfInertia().Z() << "]\n";
return _out;
}
public: ignition::math::Matrix3d MOI() const;
public: void SetMOI(const ignition::math::Matrix3d &_moi);
private: std::unique_ptr<InertialPrivate> dataPtr;
};
}
}
#endif
gazebo::physics::Inertial::IXX
double IXX() const
Get IXX.
gazebo::physics::Inertial::IXZ
double IXZ() const
Get IXZ.
gazebo::physics::Inertial::IZZ
double IZZ() const
Get IZZ.
gazebo::physics::Inertial::operator=
Inertial & operator=(const Inertial &_inertial)
Equal operator.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::Inertial::SetIYY
void SetIYY(const double _v)
Set IYY.
gazebo::physics::Inertial::PrincipalMoments
const ignition::math::Vector3d & PrincipalMoments() const
Get the principal moments of inertia (Ixx, Iyy, Izz).
gazebo::physics::Inertial::SetCoG
void SetCoG(const double _cx, const double _cy, const double _cz)
Set the center of gravity.
gazebo::physics::Inertial::Pose
ignition::math::Pose3d Pose() const
Get the pose about which the mass and inertia matrix is specified in the Link frame.
system.hh
gazebo::physics::Inertial::ProcessMsg
void ProcessMsg(const msgs::Inertial &_msg)
Update parameters from a message.
msgs.hh
gazebo::physics::Inertial::SetInertiaMatrix
void SetInertiaMatrix(const double _ixx, const double _iyy, const double _izz, const double _ixy, const double _ixz, const double iyz)
Set the mass matrix.
gazebo::physics::Inertial::UpdateParameters
void UpdateParameters(sdf::ElementPtr _sdf)
update the parameters using new sdf values.
gazebo::physics::Inertial::Ign
ignition::math::Inertiald Ign() const
Return copy of Inertial in ignition format.
gazebo::physics::Inertial::MOI
ignition::math::Matrix3d MOI() const
returns Moments of Inertia as a Matrix3
gazebo::physics::Inertial::IYZ
double IYZ() const
Get IYZ.
gazebo::physics::Inertial::operator+=
const Inertial & operator+=(const Inertial &_inertial)
Addition equal operator.
gazebo::physics::Inertial::SetMOI
void SetMOI(const ignition::math::Matrix3d &_moi)
Sets Moments of Inertia (MOI) from a Matrix3.
gazebo::physics::Inertial::Rotate
void Rotate(const ignition::math::Quaterniond &_rot)
Rotate this mass.
gazebo::physics::Inertial::CoG
const ignition::math::Vector3d & CoG() const
Get the center of gravity.
gazebo::physics::Inertial::Inertial
Inertial()
Default Constructor.
gazebo::physics::Inertial
A class for inertial information about a link.
Definition: Inertial.hh:45
gazebo::physics::Inertial::IYY
double IYY() const
Get IYY.
gazebo::physics::Inertial::SetMass
void SetMass(const double _m)
Set the mass.
gazebo::physics::Inertial::IXY
double IXY() const
Get IXY.
gazebo::physics::Inertial::Mass
double Mass() const
Get the mass.
gazebo::physics::Inertial::operator()
Inertial operator()(const ignition::math::Pose3d &_frameOffset) const
Get equivalent Inertia values with the Link frame offset, while holding the Pose of CoG constant in t...
gazebo::physics::Inertial::operator+
Inertial operator+(const Inertial &_inertial) const
Addition operator.
gazebo::physics::Inertial::SetIXY
void SetIXY(const double _v)
Set IXY.
gazebo::physics::Inertial::SetIXX
void SetIXX(const double _v)
Set IXX.
gazebo::physics::Inertial::operator<<
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::Inertial &_inertial)
Output operator.
Definition: Inertial.hh:251
gazebo::physics::Inertial::SetIXZ
void SetIXZ(const double _v)
Set IXZ.
gazebo::physics::Inertial::Reset
void Reset()
Reset all the mass properties.
gazebo::physics::Inertial::SetIZZ
void SetIZZ(const double _v)
Set IZZ.
gazebo::physics::Inertial::Load
void Load(sdf::ElementPtr _sdf)
Load from SDF values.
gazebo::physics::Inertial::~Inertial
virtual ~Inertial()
Destructor.
gazebo::physics::Inertial::ProductsOfInertia
const ignition::math::Vector3d & ProductsOfInertia() const
Get the products of inertia (Ixy, Ixz, Iyz).
gazebo::physics::Inertial::SetIYZ
void SetIYZ(const double _v)
Set IYZ.