##

SimbodyJoint.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 _SIMBODY_JOINT_HH_
#define _SIMBODY_JOINT_HH_
#include <boost/any.hpp>
#include <string>
#include "gazebo/physics/simbody/SimbodyPhysics.hh"
#include "gazebo/physics/Joint.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE SimbodyJoint : public Joint
{
public: explicit SimbodyJoint(BasePtr _parent);
public: virtual ~SimbodyJoint();
// Documentation inherited.
public: virtual void Load(sdf::ElementPtr _sdf) override;
// Documentation inherited.
public: virtual void Reset() override;
// Documentation inherited.
public: virtual LinkPtr GetJointLink(unsigned int _index) const override;
// Documentation inherited.
public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const
override;
// Documentation inherited.
public: virtual void Detach() override;
// Documentation inherited.
public: virtual void SetAnchor(const unsigned int _index,
const ignition::math::Vector3d &_anchor) override;
// Documentation inherited.
public: virtual void SetDamping(unsigned int _index,
const double _damping) override;
// Documentation inherited.
public: virtual void SetStiffness(unsigned int _index,
const double _stiffness) override;
// Documentation inherited.
public: virtual void SetStiffnessDamping(unsigned int _index,
double _stiffness, double _damping, double _reference = 0) override;
// Documentation inherited.
public: virtual ignition::math::Vector3d Anchor(
const unsigned int _index) const override;
// Documentation inherited.
public: virtual bool SetPosition(
const unsigned int _index,
const double _position,
const bool _preserveWorldVelocity = false)
override;
// Documentation inherited.
public: virtual ignition::math::Vector3d LinkForce(
const unsigned int _index) const override;
// Documentation inherited.
public: virtual ignition::math::Vector3d LinkTorque(
const unsigned int _index) const override;
// Documentation inherited.
public: virtual bool SetParam(const std::string &_key,
unsigned int _index,
const boost::any &_value)
override;
// Documentation inherited.
public: virtual double GetParam(const std::string &_key,
unsigned int _index) override;
// Save current Simbody State
public: virtual void SaveSimbodyState(const SimTK::State &_state);
// Restore saved Simbody State
public: virtual void RestoreSimbodyState(SimTK::State &_state);
// Documentation inherited.
public: virtual void SetForce(unsigned int _index, double _force)
override;
// Documentation inherited.
public: virtual double GetForce(unsigned int _index) override;
// Documentation inherited.
public: virtual void SetAxis(const unsigned int _index,
const ignition::math::Vector3d &_axis)
override;
// Documentation inherited.
public: virtual JointWrench GetForceTorque(unsigned int _index) override;
protected: virtual void SetForceImpl(unsigned int _index,
double _force) = 0;
private: void SaveForce(unsigned int _index, double _force);
// Documentation inherited.
public: virtual void CacheForceTorque() override;
public: bool mustBreakLoopHere;
public: SimTK::Transform xPA;
public: SimTK::Transform xCB;
public: SimTK::Transform defxAB;
public: SimTK::Force::MobilityLinearSpring spring[MAX_JOINT_AXIS];
public: SimTK::Force::MobilityLinearDamper damper[MAX_JOINT_AXIS];
public: SimTK::Force::MobilityLinearStop limitForce[MAX_JOINT_AXIS];
public: SimTK::MobilizedBody mobod;
public: bool isReversed;
public: SimTK::Constraint constraint;
// Keeps track if simbody physics has been initialized
public: bool physicsInitialized;
// Documentation inherited.
public: virtual void SetUpperLimit(const unsigned int _index,
const double _limit) override;
// Documentation inherited.
public: virtual void SetLowerLimit(const unsigned int _index,
const double _limit) override;
// Documentation inherited.
public: virtual double UpperLimit(const unsigned int _index) const
override;
// Documentation inherited.
public: virtual double LowerLimit(const unsigned int _index) const
override;
protected: SimTK::MultibodySystem *world;
protected: SimbodyPhysicsPtr simbodyPhysics;
private: double forceApplied[MAX_JOINT_AXIS];
private: common::Time forceAppliedTime;
};
}
}
#endif
gazebo::physics::SimbodyJoint::xCB
SimTK::Transform xCB
child body frame to mobilizer frame
Definition: SimbodyJoint.hh:158
MAX_JOINT_AXIS
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition: Joint.hh:39
gazebo::physics::SimbodyJoint::isReversed
bool isReversed
: if mobilizer, did it reverse parent&child? Set when we build the Simbody model.
Definition: SimbodyJoint.hh:192
gazebo::physics::SimbodyJoint::physicsInitialized
bool physicsInitialized
Definition: SimbodyJoint.hh:202
gazebo::physics::SimbodyJoint::SetForceImpl
virtual void SetForceImpl(unsigned int _index, double _force)=0
Set the force applied to this physics::Joint.
gazebo::physics::SimbodyJoint::CacheForceTorque
virtual void CacheForceTorque() override
Cache Joint Force Torque Values if necessary for physics engine.
gazebo::physics::SimbodyJoint::mustBreakLoopHere
bool mustBreakLoopHere
Force Simbody to break a loop by using a weld constraint.
Definition: SimbodyJoint.hh:151
gazebo::physics::SimbodyJoint::mobod
SimTK::MobilizedBody mobod
Use isValid() if we used a mobilizer Set when we build the Simbody model.
Definition: SimbodyJoint.hh:188
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::SimbodyJoint::GetForceTorque
virtual JointWrench GetForceTorque(unsigned int _index) override
get internal force and torque values at a joint.
gazebo::physics::SimbodyJoint::SetForce
virtual void SetForce(unsigned int _index, double _force) override
Set the force applied to this physics::Joint.
gazebo::physics::SimbodyJoint::AreConnected
virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const override
Determines of the two bodies are connected by a joint.
gazebo::physics::SimbodyJoint::LinkTorque
virtual ignition::math::Vector3d LinkTorque(const unsigned int _index) const override
Get the torque applied to the center of mass of a physics::Link due to the existence of this Joint.
gazebo::physics::SimbodyJoint::Anchor
virtual ignition::math::Vector3d Anchor(const unsigned int _index) const override
Get the anchor point.
gazebo::physics::SimbodyJoint::SetDamping
virtual void SetDamping(unsigned int _index, const double _damping) override
Set the joint damping.
system.hh
gazebo::physics::SimbodyJoint::SetStiffnessDamping
virtual void SetStiffnessDamping(unsigned int _index, double _stiffness, double _damping, double _reference=0) override
Set the joint spring stiffness.
gazebo::physics::SimbodyJoint::constraint
SimTK::Constraint constraint
: isValid() if we used a constraint to model this joint.
Definition: SimbodyJoint.hh:199
gazebo::physics::SimbodyJoint
Base class for all joints.
Definition: SimbodyJoint.hh:37
gazebo::physics::SimbodyJoint::SetParam
virtual bool SetParam(const std::string &_key, unsigned int _index, const boost::any &_value) override
Set a non-generic parameter for the joint.
gazebo::physics::SimbodyJoint::GetForce
virtual double GetForce(unsigned int _index) override
gazebo::physics::SimbodyJoint::SaveSimbodyState
virtual void SaveSimbodyState(const SimTK::State &_state)
gazebo::physics::SimbodyJoint::~SimbodyJoint
virtual ~SimbodyJoint()
Destructor.
gazebo::physics::SimbodyJoint::SimbodyJoint
SimbodyJoint(BasePtr _parent)
Constructor.
gazebo::physics::Joint
Base class for all joints.
Definition: Joint.hh:50
gazebo::physics::SimbodyJoint::Detach
virtual void Detach() override
Detach this joint from all links.
gazebo::physics::SimbodyJoint::xPA
SimTK::Transform xPA
Normally A=F, B=M.
Definition: SimbodyJoint.hh:155
gazebo::physics::SimbodyJoint::SetAnchor
virtual void SetAnchor(const unsigned int _index, const ignition::math::Vector3d &_anchor) override
Set the anchor point.
Joint.hh
gazebo::physics::SimbodyJoint::LinkForce
virtual ignition::math::Vector3d LinkForce(const unsigned int _index) const override
Get the forces applied to the center of mass of a physics::Link due to the existence of this Joint.
gazebo::physics::SimbodyJoint::simbodyPhysics
SimbodyPhysicsPtr simbodyPhysics
keep a pointer to the simbody physics engine for convenience
Definition: SimbodyJoint.hh:224
gazebo::physics::SimbodyJoint::spring
SimTK::Force::MobilityLinearSpring spring[MAX_JOINT_AXIS]
: Spring force element for enforcing joint stiffness.
Definition: SimbodyJoint.hh:168
gazebo::physics::SimbodyJoint::UpperLimit
virtual double UpperLimit(const unsigned int _index) const override
Get the joint's upper limit.
gazebo::physics::BasePtr
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
gazebo::physics::SimbodyJoint::RestoreSimbodyState
virtual void RestoreSimbodyState(SimTK::State &_state)
gazebo::physics::LinkPtr
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
gazebo::physics::SimbodyJoint::damper
SimTK::Force::MobilityLinearDamper damper[MAX_JOINT_AXIS]
: for enforcing joint damping forces.
Definition: SimbodyJoint.hh:174
gazebo::physics::SimbodyJoint::SetLowerLimit
virtual void SetLowerLimit(const unsigned int _index, const double _limit) override
Set the joint's lower limit.
gazebo::physics::SimbodyJoint::GetJointLink
virtual LinkPtr GetJointLink(unsigned int _index) const override
Get the link to which the joint is attached according the _index.
gazebo::physics::SimbodyJoint::GetParam
virtual double GetParam(const std::string &_key, unsigned int _index) override
Get a non-generic parameter for the joint.
gazebo::physics::SimbodyJoint::LowerLimit
virtual double LowerLimit(const unsigned int _index) const override
Get the joint's lower limit.
gazebo::physics::SimbodyPhysicsPtr
boost::shared_ptr< SimbodyPhysics > SimbodyPhysicsPtr
Definition: SimbodyTypes.hh:40
gazebo::physics::SimbodyJoint::Reset
virtual void Reset() override
Reset the joint.
gazebo::physics::SimbodyJoint::Load
virtual void Load(sdf::ElementPtr _sdf) override
Load physics::Joint from a SDF sdf::Element.
gazebo::physics::JointWrench
Wrench information from a joint. These are forces and torques on parent and child Links,...
Definition: JointWrench.hh:40
gazebo::physics::SimbodyJoint::SetUpperLimit
virtual void SetUpperLimit(const unsigned int _index, const double _limit) override
Set the joint's upper limit.
gazebo::physics::SimbodyJoint::SetStiffness
virtual void SetStiffness(unsigned int _index, const double _stiffness) override
Set the joint spring stiffness.
gazebo::physics::SimbodyJoint::world
SimTK::MultibodySystem * world
Simbody Multibody System.
Definition: SimbodyJoint.hh:221
gazebo::physics::SimbodyJoint::defxAB
SimTK::Transform defxAB
default mobilizer pose
Definition: SimbodyJoint.hh:161
gazebo::physics::SimbodyJoint::limitForce
SimTK::Force::MobilityLinearStop limitForce[MAX_JOINT_AXIS]
: for enforcing joint stops Set when we build the Simbody model.
Definition: SimbodyJoint.hh:181
SimbodyPhysics.hh
gazebo::physics::SimbodyJoint::SetPosition
virtual bool SetPosition(const unsigned int _index, const double _position, const bool _preserveWorldVelocity=false) override
The child links of this joint are updated based on desired position.
gazebo::physics::SimbodyJoint::SetAxis
virtual void SetAxis(const unsigned int _index, const ignition::math::Vector3d &_axis) override
Set the axis of rotation where axis is specified in local joint frame.