##

SimbodyLink.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_SIMBODY_SIMBODYLINK_HH_
#define GAZEBO_PHYSICS_SIMBODY_SIMBODYLINK_HH_
#include <vector>
#include "gazebo/physics/simbody/SimbodyTypes.hh"
#include "gazebo/physics/Link.hh"
#include "gazebo/physics/simbody/simbody_inc.h"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE SimbodyLink : public Link
{
public: explicit SimbodyLink(EntityPtr _parent);
public: virtual ~SimbodyLink();
// Documentation inherited.
public: virtual void Load(sdf::ElementPtr _ptr);
// Documentation inherited.
public: virtual void Init();
// Documentation inherited.
public: virtual void Fini();
// Documentation inherited.
public: virtual void OnPoseChange();
// Documentation inherited.
public: virtual void SetEnabled(bool enable) const;
// Documentation inherited.
public: virtual bool GetEnabled() const;
// Documentation inherited.
public: virtual void SetLinearVel(const ignition::math::Vector3d &_vel);
// Documentation inherited.
public: virtual void SetAngularVel(const ignition::math::Vector3d &_vel);
// Documentation inherited.
public: virtual void SetForce(const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void SetTorque(const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldLinearVel(
const ignition::math::Vector3d &_vector3) const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldLinearVel(
const ignition::math::Vector3d &_offset,
const ignition::math::Quaterniond &_q) const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldCoGLinearVel() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldAngularVel() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldForce() const;
// Documentation inherited.
public: virtual ignition::math::Vector3d WorldTorque() const;
// Documentation inherited.
public: virtual void SetGravityMode(bool _mode);
// Documentation inherited.
public: virtual bool GetGravityMode() const;
// Documentation inherited.
public: virtual void SetSelfCollide(bool _collide);
// Documentation inherited.
public: virtual void SetLinearDamping(double _damping);
// Documentation inherited.
public: virtual void SetAngularDamping(double _damping);
// Documentation inherited.
public: virtual void AddForce(const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void AddRelativeForce(
const ignition::math::Vector3d &_force);
// Documentation inherited.
public: virtual void AddForceAtWorldPosition(
const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_pos);
// Documentation inherited.
public: virtual void AddForceAtRelativePosition(
const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_relpos);
// Documentation inherited
public: virtual void AddLinkForce(const ignition::math::Vector3d &_force,
const ignition::math::Vector3d &_offset =
ignition::math::Vector3d::Zero);
// Documentation inherited.
public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
// Documentation inherited.
public: virtual void AddRelativeTorque(
const ignition::math::Vector3d &_torque);
// Documentation inherited.
public: virtual void SetAutoDisable(bool _disable);
// Documentation inherited.
public: virtual void SaveSimbodyState(const SimTK::State &_state);
// Documentation inherited.
public: virtual void RestoreSimbodyState(SimTK::State &_state);
public: virtual void SetLinkStatic(bool _static);
public: SimTK::MassProperties GetMassProperties() const;
public: SimTK::MassProperties GetEffectiveMassProps(
int _numFragments) const;
public: void SetDirtyPose(const ignition::math::Pose3d &_pose);
// Documentation inherited.
public: virtual void UpdateMass();
private: void ProcessSetGravityMode();
private: void ProcessSetLinkStatic();
public: bool mustBeBaseLink;
// Below to be filled in after everything is loaded
// Which MobilizedBody corresponds to the master instance of this link.
public: SimTK::MobilizedBody masterMobod;
// Keeps track if physics has been initialized
public: bool physicsInitialized;
// If this link got split into a master and slaves, these are the
// MobilizedBodies used to mobilize the slaves.
public: std::vector<SimTK::MobilizedBody> slaveMobods;
// And these are the Weld constraints used to attach slaves to master.
public: std::vector<SimTK::Constraint::Weld> slaveWelds;
private: bool gravityMode;
private: bool staticLinkDirty;
private: bool gravityModeDirty;
private: bool staticLink;
private: event::ConnectionPtr staticLinkConnection;
private: event::ConnectionPtr gravityModeConnection;
private: std::vector<double> simbodyQ;
private: std::vector<double> simbodyU;
private: SimbodyPhysicsPtr simbodyPhysics;
};
}
}
#endif
gazebo::physics::SimbodyLink
Simbody Link class.
Definition: SimbodyLink.hh:38
gazebo::physics::SimbodyLink::SetDirtyPose
void SetDirtyPose(const ignition::math::Pose3d &_pose)
Set the dirty pose.
gazebo::physics::SimbodyLink::UpdateMass
virtual void UpdateMass()
Update the mass matrix.
gazebo::physics::SimbodyLink::SetLinearDamping
virtual void SetLinearDamping(double _damping)
Set the linear damping factor.
gazebo::physics::SimbodyLink::~SimbodyLink
virtual ~SimbodyLink()
Destructor.
gazebo::physics::SimbodyLink::SetGravityMode
virtual void SetGravityMode(bool _mode)
Set whether gravity affects this body.
gazebo::physics::SimbodyLink::AddRelativeTorque
virtual void AddRelativeTorque(const ignition::math::Vector3d &_torque)
Add a torque to the body, components are relative to the body's own frame of reference.
gazebo::physics::SimbodyLink::AddRelativeForce
virtual void AddRelativeForce(const ignition::math::Vector3d &_force)
Add a force to the body, components are relative to the body's own frame of reference.
gazebo::physics::Link::WorldLinearVel
virtual ignition::math::Vector3d WorldLinearVel() const
Get the linear velocity of the origin of the link frame, expressed in the world frame.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::SimbodyLink::GetEffectiveMassProps
SimTK::MassProperties GetEffectiveMassProps(int _numFragments) const
Link.hh
gazebo::physics::SimbodyLink::Load
virtual void Load(sdf::ElementPtr _ptr)
Load the body based on an SDF element.
gazebo::physics::SimbodyLink::SetAutoDisable
virtual void SetAutoDisable(bool _disable)
Allow the link to auto disable.
system.hh
gazebo::sensors::enable
void enable()
Enable sensors.
gazebo::physics::SimbodyLink::SetEnabled
virtual void SetEnabled(bool enable) const
Set whether this body is enabled.
gazebo::physics::SimbodyLink::SetLinkStatic
virtual void SetLinkStatic(bool _static)
If the inboard body of this link is ground, simply lock the inboard joint to freeze it to ground.
gazebo::physics::SimbodyLink::Init
virtual void Init()
Initialize the body.
gazebo::physics::SimbodyLink::GetEnabled
virtual bool GetEnabled() const
Get whether this body is enabled in the physics engine.
gazebo::physics::SimbodyLink::mustBeBaseLink
bool mustBeBaseLink
: Force this link to be a base body, where its inboard body is the world with 6DOF.
Definition: SimbodyLink.hh:182
gazebo::physics::Link
Link class defines a rigid body entity, containing information on inertia, visual and collision prope...
Definition: Link.hh:52
gazebo::physics::SimbodyLink::AddForce
virtual void AddForce(const ignition::math::Vector3d &_force)
Add a force to the body.
gazebo::physics::SimbodyLink::SetSelfCollide
virtual void SetSelfCollide(bool _collide)
Set whether this body will collide with others in the model.
gazebo::physics::SimbodyLink::SetTorque
virtual void SetTorque(const ignition::math::Vector3d &_force)
Set the torque applied to the body.
gazebo::physics::SimbodyLink::physicsInitialized
bool physicsInitialized
Definition: SimbodyLink.hh:189
gazebo::physics::SimbodyLink::WorldTorque
virtual ignition::math::Vector3d WorldTorque() const
Get the torque applied to the body about the center of mass in world frame coordinates.
gazebo::physics::SimbodyLink::GetMassProperties
SimTK::MassProperties GetMassProperties() const
Convert Gazebo Inertia to Simbody MassProperties Where Simbody MassProperties contains mass,...
gazebo::physics::SimbodyLink::slaveWelds
std::vector< SimTK::Constraint::Weld > slaveWelds
Definition: SimbodyLink.hh:196
gazebo::physics::SimbodyLink::slaveMobods
std::vector< SimTK::MobilizedBody > slaveMobods
Definition: SimbodyLink.hh:193
gazebo::physics::SimbodyLink::SimbodyLink
SimbodyLink(EntityPtr _parent)
Constructor.
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::SimbodyLink::Fini
virtual void Fini()
Finalize the body.
gazebo::physics::SimbodyLink::RestoreSimbodyState
virtual void RestoreSimbodyState(SimTK::State &_state)
gazebo::physics::EntityPtr
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
gazebo::physics::SimbodyLink::SetLinearVel
virtual void SetLinearVel(const ignition::math::Vector3d &_vel)
Set the linear velocity of the body.
gazebo::physics::SimbodyLink::WorldCoGLinearVel
virtual ignition::math::Vector3d WorldCoGLinearVel() const
Get the linear velocity at the body's center of gravity in the world frame.
gazebo::physics::SimbodyLink::AddTorque
virtual void AddTorque(const ignition::math::Vector3d &_torque)
Add a torque to the body.
gazebo::physics::SimbodyLink::GetGravityMode
virtual bool GetGravityMode() const
Get the gravity mode.
gazebo::physics::SimbodyPhysicsPtr
boost::shared_ptr< SimbodyPhysics > SimbodyPhysicsPtr
Definition: SimbodyTypes.hh:40
gazebo::physics::SimbodyLink::SetAngularVel
virtual void SetAngularVel(const ignition::math::Vector3d &_vel)
Set the angular velocity of the body.
gazebo::physics::SimbodyLink::OnPoseChange
virtual void OnPoseChange()
This function is called when the entity's (or one of its parents) pose of the parent has changed.
gazebo::physics::SimbodyLink::AddLinkForce
virtual void AddLinkForce(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_offset=ignition::math::Vector3d::Zero)
Add a force expressed in the link frame.
gazebo::physics::SimbodyLink::SaveSimbodyState
virtual void SaveSimbodyState(const SimTK::State &_state)
gazebo::physics::SimbodyLink::AddForceAtWorldPosition
virtual void AddForceAtWorldPosition(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_pos)
Add a force to the body using a global position.
gazebo::physics::SimbodyLink::AddForceAtRelativePosition
virtual void AddForceAtRelativePosition(const ignition::math::Vector3d &_force, const ignition::math::Vector3d &_relpos)
Add a force (in world frame coordinates) to the body at a position relative to the center of mass whi...
gazebo::physics::SimbodyLink::SetForce
virtual void SetForce(const ignition::math::Vector3d &_force)
Set the force applied to the body.
gazebo::physics::SimbodyLink::WorldForce
virtual ignition::math::Vector3d WorldForce() const
Get the force applied to the body in the world frame.
gazebo::physics::SimbodyLink::masterMobod
SimTK::MobilizedBody masterMobod
Definition: SimbodyLink.hh:186
gazebo::physics::SimbodyLink::SetAngularDamping
virtual void SetAngularDamping(double _damping)
Set the angular damping factor.
gazebo::physics::SimbodyLink::WorldAngularVel
virtual ignition::math::Vector3d WorldAngularVel() const
Get the angular velocity of the entity in the world frame.
SimbodyTypes.hh
Simbody wrapper forward declarations and typedefs.
simbody_inc.h