![]() |
The VirtualToolCoupler couples a rigid object to an input/output device through a spring and damper. More...
#include <SurgSim/Physics/VirtualToolCoupler.h>
Public Member Functions | |
VirtualToolCoupler (const std::string &name) | |
Constructor. More... | |
~VirtualToolCoupler () | |
SURGSIM_CLASSNAME (SurgSim::Physics::VirtualToolCoupler) | |
const std::shared_ptr< SurgSim::Framework::Component > | getInput () |
void | setInput (const std::shared_ptr< SurgSim::Framework::Component > input) |
Set the Input Component. More... | |
const std::shared_ptr< SurgSim::Framework::Component > | getOutput () |
void | setOutput (const std::shared_ptr< SurgSim::Framework::Component > output) |
Set the Output Component (if any) More... | |
const std::shared_ptr< SurgSim::Framework::Component > | getRepresentation () |
void | setRepresentation (const std::shared_ptr< SurgSim::Framework::Component > rigid) |
Set the Physics Representation which follows the input. More... | |
const std::string & | getPoseName () |
void | setPoseName (const std::string &poseName=SurgSim::DataStructures::Names::POSE) |
Set the name of the pose entry in the input DataGroup. More... | |
virtual void | update (double dt) override |
Update the behavior. More... | |
void | overrideLinearStiffness (double linearStiffness) |
Override the linear stiffness connecting the input device and the physics representation If this value is not provided, the stiffness will be automatically tuned using the properties of the Representation. More... | |
double | getLinearStiffness () |
void | overrideLinearDamping (double linearDamping) |
Override the linear damping connecting the input device and the physics representation If this value is not provided, the damping will be automatically tuned using the properties of the Representation. More... | |
double | getLinearDamping () |
void | overrideAngularStiffness (double angularStiffness) |
Override the angular stiffness connecting the input device and the physics representation If this value is not provided, the stiffness will be automatically tuned using the properties of the Representation. More... | |
double | getAngularStiffness () |
void | overrideAngularDamping (double angularDamping) |
Override the angular damping connecting the input device and the physics representation If this value is not provided, the damping will be automatically tuned using the properties of the Representation. More... | |
double | getAngularDamping () |
void | overrideAttachmentPoint (const SurgSim::Math::Vector3d &attachment) |
Override the point of attachment to the Representation If this value is not provided, the point of attachment will be automatically set to the Representation's center of mass. More... | |
const SurgSim::Math::Vector3d & | getAttachmentPoint () |
Get the point of attachment on the Representation. More... | |
void | setCalculateInertialTorques (bool calculateInertialTorques) |
Enable/disable torques that simulate inertia. More... | |
bool | getCalculateInertialTorques () const |
Get whether the calculated torques will simulate inertia. More... | |
![]() | |
Behavior (const std::string &name) | |
virtual | ~Behavior () |
![]() | |
Component (const std::string &name) | |
Constructor. More... | |
virtual | ~Component () |
Destructor. More... | |
std::string | getName () const |
Gets component name. More... | |
void | setName (const std::string &name) |
Sets the name of component. More... | |
boost::uuids::uuid | getUuid () const |
Gets the id of the component. More... | |
bool | isInitialized () const |
bool | initialize (const std::weak_ptr< Runtime > &runtime) |
Initialize this component, this needs to be called before wakeUp() can be called. More... | |
bool | isAwake () const |
bool | wakeUp () |
Wakeup this component, this will be called when the component is inserted into the ComponentManager that is responsible for handling this component. More... | |
void | setScene (std::weak_ptr< Scene > scene) |
Sets the scene. More... | |
std::shared_ptr< Scene > | getScene () |
Gets the scene. More... | |
void | setSceneElement (std::weak_ptr< SceneElement > sceneElement) |
Sets the scene element. More... | |
std::shared_ptr< SceneElement > | getSceneElement () |
Gets the scene element. More... | |
std::shared_ptr< const SceneElement > | getSceneElement () const |
Gets the scene element, constant version. More... | |
std::shared_ptr< Runtime > | getRuntime () const |
Get the runtime which contains this component. More... | |
virtual std::string | getClassName () const |
The class name for this class, this being the base class it should return SurgSim::Framework::Component but this would make missing implemenentations of this hard to catch, therefore this calls SURGSIM_FAILURE. More... | |
std::shared_ptr< Component > | getSharedPtr () |
Gets a shared pointer to this component. More... | |
bool | isActive () const |
virtual void | setLocalActive (bool val) |
Set the component's active state. More... | |
bool | isLocalActive () const |
![]() | |
Accessible () | |
Default Constructor. More... | |
~Accessible () | |
Destructor. More... | |
template<class T > | |
T | getValue (const std::string &name) const |
Retrieves the value with the name by executing the getter if it is found and tries to convert it to the given type. More... | |
boost::any | getValue (const std::string &name) const |
Retrieves the value with the name by executing the getter if it is found. More... | |
template<class T > | |
bool | getValue (const std::string &name, T *value) const |
Retrieves the value with the name by executing the getter if it is found, and converts it to the type of the output parameter. More... | |
void | setValue (const std::string &name, const boost::any &value) |
Sets a value of a property that has setter. More... | |
bool | isReadable (const std::string &name) const |
Check whether a property is readable. More... | |
bool | isWriteable (const std::string &name) const |
Check whether a property is writable. More... | |
void | setGetter (const std::string &name, GetterType func) |
Sets a getter for a given property. More... | |
void | setSetter (const std::string &name, SetterType func) |
Sets a setter for a given property. More... | |
void | setAccessors (const std::string &name, GetterType getter, SetterType setter) |
Sets the accessors getter and setter in one function. More... | |
void | removeAccessors (const std::string &name) |
Removes all the accessors (getter and setter) for a given property. More... | |
void | forwardProperty (const std::string &name, const Accessible &target, const std::string &targetProperty) |
Adds a property with the given name that uses the targets accessors, in effect forwarding the value to the target. More... | |
void | setSerializable (const std::string &name, EncoderType encoder, DecoderType decoder) |
Sets the functions used to convert data from and to a YAML::Node. More... | |
YAML::Node | encode () const |
Encode this Accessible to a YAML::Node. More... | |
void | decode (const YAML::Node &node, const std::vector< std::string > &ignoredProperties=std::vector< std::string >()) |
Decode this Accessible from a YAML::Node, will throw an exception if the data type cannot be converted. More... | |
template<> | |
boost::any | getValue (const std::string &name) const |
Protected Member Functions | |
virtual bool | doInitialize () override |
Interface to be implemented by derived classes. More... | |
virtual bool | doWakeUp () override |
Interface to be implemented by derived classes. More... | |
virtual int | getTargetManagerType () const override |
Specifies which manger will handle this behavior. More... | |
virtual SurgSim::DataStructures::DataGroup | buildOutputData () |
void | setOptionalLinearStiffness (const SurgSim::DataStructures::OptionalValue< double > &linearStiffness) |
Used for Serialization. More... | |
const SurgSim::DataStructures::OptionalValue< double > & | getOptionalLinearStiffness () const |
Used for Serialization. More... | |
void | setOptionalLinearDamping (const SurgSim::DataStructures::OptionalValue< double > &linearDamping) |
Used for Serialization. More... | |
const SurgSim::DataStructures::OptionalValue< double > & | getOptionalLinearDamping () const |
Used for Serialization. More... | |
void | setOptionalAngularStiffness (const SurgSim::DataStructures::OptionalValue< double > &angularStiffness) |
Used for Serialization. More... | |
const SurgSim::DataStructures::OptionalValue< double > & | getOptionalAngularStiffness () const |
Used for Serialization. More... | |
void | setOptionalAngularDamping (const SurgSim::DataStructures::OptionalValue< double > &angularDamping) |
Used for Serialization. More... | |
const SurgSim::DataStructures::OptionalValue< double > & | getOptionalAngularDamping () const |
Used for Serialization. More... | |
void | setOptionalAttachmentPoint (const SurgSim::DataStructures::OptionalValue< SurgSim::Math::Vector3d > &attachmentPoint) |
Used for Serialization. More... | |
const SurgSim::DataStructures::OptionalValue< SurgSim::Math::Vector3d > & | getOptionalAttachmentPoint () const |
Used for Serialization. More... | |
![]() | |
virtual std::shared_ptr< PoseComponent > | getPoseComponent () |
Get the PoseComponent for this component. More... | |
virtual std::shared_ptr< const PoseComponent > | getPoseComponent () const |
Get the PoseComponent for this component, constant access. More... | |
Private Attributes | |
std::shared_ptr< SurgSim::Physics::RigidRepresentation > | m_rigid |
std::string | m_poseName |
double | m_linearStiffness |
Used Vtc stiffness parameter in linear mode (in N·m-1) More... | |
double | m_linearDamping |
Used Vtc damping parameter in linear mode (in N·s·m-1 or Kg·s-1) More... | |
double | m_angularStiffness |
Used Vtc stiffness parameter in angular mode (in N·m rad-1) More... | |
double | m_angularDamping |
Used Vtc damping parameter in angular mode (in N·m·s·rad-1) More... | |
double | m_outputForceScaling |
Scaling factor for the forces sent to the OutputComponent. More... | |
double | m_outputTorqueScaling |
Scaling factor for the torques sent to the OutputComponent. More... | |
SurgSim::Math::Vector3d | m_localAttachmentPoint |
The input's point of attachment in the local frame, i.e., the same frame in which the mass center is defined. More... | |
bool | m_calculateInertialTorques |
Whether or not the calculated torques will simulate inertia. More... | |
int | m_poseIndex |
int | m_linearVelocityIndex |
int | m_angularVelocityIndex |
int | m_forceIndex |
int | m_torqueIndex |
int | m_inputLinearVelocityIndex |
int | m_inputAngularVelocityIndex |
int | m_inputPoseIndex |
int | m_springJacobianIndex |
int | m_damperJacobianIndex |
Additional Inherited Members | |
![]() | |
typedef SurgSim::Framework::ObjectFactory1< SurgSim::Framework::Component, std::string > | FactoryType |
![]() | |
typedef std::function< boost::any(void)> | GetterType |
typedef std::function< void(boost::any)> | SetterType |
typedef std::function< YAML::Node(void)> | EncoderType |
typedef std::function< void(const YAML::Node *)> | DecoderType |
![]() | |
static FactoryType & | getFactory () |
The VirtualToolCoupler couples a rigid object to an input/output device through a spring and damper.
If the device will output forces and/or torques, we pass it a force (and/or torque) as well as the derivatives (Jacobians) of the force with respect to position and velocity, so that the device can recalculate its forces at its update rate.
|
explicit |
Constructor.
name | Name of the behavior |
SurgSim::Physics::VirtualToolCoupler::~VirtualToolCoupler | ( | ) |
|
protectedvirtual |
|
overrideprotectedvirtual |
Interface to be implemented by derived classes.
Implements SurgSim::Framework::Component.
|
overrideprotectedvirtual |
Interface to be implemented by derived classes.
Implements SurgSim::Framework::Component.
double SurgSim::Physics::VirtualToolCoupler::getAngularDamping | ( | ) |
double SurgSim::Physics::VirtualToolCoupler::getAngularStiffness | ( | ) |
const SurgSim::Math::Vector3d & SurgSim::Physics::VirtualToolCoupler::getAttachmentPoint | ( | ) |
Get the point of attachment on the Representation.
bool SurgSim::Physics::VirtualToolCoupler::getCalculateInertialTorques | ( | ) | const |
Get whether the calculated torques will simulate inertia.
This setting only has an effect if the attachment point is not the mass center.
const std::shared_ptr< SurgSim::Framework::Component > SurgSim::Physics::VirtualToolCoupler::getInput | ( | ) |
double SurgSim::Physics::VirtualToolCoupler::getLinearDamping | ( | ) |
double SurgSim::Physics::VirtualToolCoupler::getLinearStiffness | ( | ) |
|
protected |
Used for Serialization.
|
protected |
Used for Serialization.
|
protected |
Used for Serialization.
|
protected |
Used for Serialization.
|
protected |
Used for Serialization.
const std::shared_ptr< SurgSim::Framework::Component > SurgSim::Physics::VirtualToolCoupler::getOutput | ( | ) |
const std::string & SurgSim::Physics::VirtualToolCoupler::getPoseName | ( | ) |
const std::shared_ptr< SurgSim::Framework::Component > SurgSim::Physics::VirtualToolCoupler::getRepresentation | ( | ) |
|
overrideprotectedvirtual |
Specifies which manger will handle this behavior.
Reimplemented from SurgSim::Framework::Behavior.
void SurgSim::Physics::VirtualToolCoupler::overrideAngularDamping | ( | double | angularDamping | ) |
Override the angular damping connecting the input device and the physics representation If this value is not provided, the damping will be automatically tuned using the properties of the Representation.
angularDamping | The damping of the vtc in angular mode (in N·m·s·rad-1) |
void SurgSim::Physics::VirtualToolCoupler::overrideAngularStiffness | ( | double | angularStiffness | ) |
Override the angular stiffness connecting the input device and the physics representation If this value is not provided, the stiffness will be automatically tuned using the properties of the Representation.
angularStiffness | The stiffness of the vtc in angular mode (in N·m rad-1) |
void SurgSim::Physics::VirtualToolCoupler::overrideAttachmentPoint | ( | const SurgSim::Math::Vector3d & | attachment | ) |
Override the point of attachment to the Representation If this value is not provided, the point of attachment will be automatically set to the Representation's center of mass.
attachment | The attachment point in the Representations local coordinate frame |
void SurgSim::Physics::VirtualToolCoupler::overrideLinearDamping | ( | double | linearDamping | ) |
Override the linear damping connecting the input device and the physics representation If this value is not provided, the damping will be automatically tuned using the properties of the Representation.
linearDamping | The damping of the vtc in linear mode (in N·s·m-1 or Kg·s-1) |
void SurgSim::Physics::VirtualToolCoupler::overrideLinearStiffness | ( | double | linearStiffness | ) |
Override the linear stiffness connecting the input device and the physics representation If this value is not provided, the stiffness will be automatically tuned using the properties of the Representation.
linearStiffness | The stiffness of the vtc in linear mode (in N·m-1) |
void SurgSim::Physics::VirtualToolCoupler::setCalculateInertialTorques | ( | bool | calculateInertialTorques | ) |
Enable/disable torques that simulate inertia.
This setting only has an effect if the attachment point is not the mass center.
calculateInertialTorques | true to simulate inertia. |
void SurgSim::Physics::VirtualToolCoupler::setInput | ( | const std::shared_ptr< SurgSim::Framework::Component > | input | ) |
|
protected |
Used for Serialization.
angularDamping | The OptionalValue object containing the damping of the vtc in angular mode (in N·m·s·rad-1) |
|
protected |
Used for Serialization.
angularStiffness | The OptionalValue object containing the stiffness of the vtc in angular mode (in N·m rad-1) |
|
protected |
Used for Serialization.
attachmentPoint | The OptionalValue object containing the attachment point. |
|
protected |
Used for Serialization.
linearDamping | The OptionalValue object containing the damping of the vtc in linear mode (in N·s·m-1 or Kg·s-1) |
|
protected |
Used for Serialization.
linearStiffness | The OptionalValue object containing the stiffness of the vtc in linear mode (in N·m-1) |
void SurgSim::Physics::VirtualToolCoupler::setOutput | ( | const std::shared_ptr< SurgSim::Framework::Component > | output | ) |
Set the Output Component (if any)
output | Output Component to send forces and torques |
void SurgSim::Physics::VirtualToolCoupler::setPoseName | ( | const std::string & | poseName = SurgSim::DataStructures::Names::POSE | ) |
Set the name of the pose entry in the input DataGroup.
poseName | Name of the pose data in the input to transfer |
void SurgSim::Physics::VirtualToolCoupler::setRepresentation | ( | const std::shared_ptr< SurgSim::Framework::Component > | rigid | ) |
Set the Physics Representation which follows the input.
rigid | Rigid Representation that provides state and receives external forces and torques |
SurgSim::Physics::VirtualToolCoupler::SURGSIM_CLASSNAME | ( | SurgSim::Physics::VirtualToolCoupler | ) |
|
overridevirtual |
Update the behavior.
dt | The length of time (seconds) between update calls. |
Implements SurgSim::Framework::Behavior.
|
private |
Used Vtc damping parameter in angular mode (in N·m·s·rad-1)
|
private |
Used Vtc stiffness parameter in angular mode (in N·m rad-1)
|
private |
Cached DataGroup indices.
|
private |
Whether or not the calculated torques will simulate inertia.
This setting only has an effect if the device input point is not the mass center.
|
private |
Cached DataGroup indices.
|
private |
Cached DataGroup indices.
|
protected |
The input component.
|
private |
Cached DataGroup indices.
|
private |
Cached DataGroup indices.
|
private |
Cached DataGroup indices.
|
private |
Used Vtc damping parameter in linear mode (in N·s·m-1 or Kg·s-1)
|
private |
Used Vtc stiffness parameter in linear mode (in N·m-1)
|
private |
Cached DataGroup indices.
|
private |
The input's point of attachment in the local frame, i.e., the same frame in which the mass center is defined.
|
protected |
User supplied Vtc damping parameter in angular mode (in N·m·s·rad-1)
|
protected |
User supplied Vtc stiffness parameter in angular mode (in N·m rad-1)
|
protected |
User supplied attachment point.
|
protected |
User supplied Vtc damping parameter in linear mode (in N·s·m-1 or Kg·s-1)
|
protected |
User supplied Vtc stiffness parameter in linear mode (in N·m-1)
|
protected |
The output component.
|
protected |
The DataGroup to output.
|
private |
Scaling factor for the forces sent to the OutputComponent.
|
private |
Scaling factor for the torques sent to the OutputComponent.
|
private |
Cached DataGroup indices.
|
private |
|
private |
|
private |
Cached DataGroup indices.
|
private |
Cached DataGroup indices.