9 #include "imstkSceneObjectController.h" 31 void setControlledObject(std::shared_ptr<SceneObject> obj)
override;
37 void setLinearKd(
const double kd) {
m_linearKd = kd; }
44 void setAngularKd(
const double kd) {
m_angularKd = kd; }
51 void setLinearKs(
const Vec3d& ks) {
m_linearKs = ks; }
52 void setLinearKs(
const double ks) {
m_linearKs = Vec3d(ks, ks, ks); }
59 void setAngularKs(
const Vec3d& ks) {
m_angularKs = ks; }
60 void setAngularKs(
const double ks) {
m_angularKs = Vec3d(ks, ks, ks); }
67 void setForceScaling(
const double forceScaling) { m_forceScaling = forceScaling; }
74 void setUseSpring(
const bool useSpring) {
m_useSpring = useSpring; }
82 void setUseForceSmoothening(
const bool useForceSmoothening) { m_forceSmoothening = useForceSmoothening; }
99 void setSmoothingKernelSize(
const int kernelSize) { m_smoothingKernelSize = kernelSize; }
136 void update(
const double& dt)
override;
144 std::shared_ptr<RigidObject2> m_rigidObject;
152 Vec3d m_fS = Vec3d::Zero();
153 Vec3d m_fD = Vec3d::Zero();
156 Vec3d m_tS = Vec3d::Zero();
157 Vec3d m_tD = Vec3d::Zero();
159 double m_forceScaling = 0.0000075;
163 bool m_forceSmoothening =
true;
164 int m_smoothingKernelSize = 15;
165 std::deque<Vec3d> m_forces;
166 Vec3d m_forceSum = Vec3d::Zero();
double m_angularKd
Damping coefficient, rotational.
Vec3d getDamperForce() const
Returns damper force.
bool m_useCriticalDamping
If on, kd is automatically computed.
bool m_useSpring
If off, pos & orientation directly set.
double getForceScaling() const
Set/Get the scaling of the force on the device, set to 0 for no force.
bool getUseCritDamping() const
Set/Get whether to use critical damping (default on) Critical damping automatically computes linear &...
Vec3d getSpringTorque() const
Returns spring torque, without damper.
double m_linearKd
Damping coefficient, linear.
const Vec3d & getAngularKs() const
Set/Get the rotationl spring coefficient. Default (10000.0, 10000.0, 10000.0)
Vec3d getSpringForce() const
Returns spring force, without damper.
double getAngularKd() const
Set/Get the angular damping coefficient. Default 10000.0.
This class implements once tracking controller controlling one scene object.
const Vec3d & getLinearKs() const
Set/Get the linear spring coefficient. Default (8000000.0, 8000000.0, 8000000.0)
double getLinearKd() const
Set/Get the linear damping coefficient. Default 10000.0.
This class uses the provided device to control the provided rigid object via virtual coupling...
bool getUseSpring() const
Set/Get whether to use spring or not.
void applyForces() override
Apply forces to the haptic device.
int getSmoothingKernelSize() const
Set/Get the kernel size.
Vec3d m_angularKs
Spring coefficient, rotational.
void update(const double &dt) override
Update controlled scene object using latest tracking information.
Vec3d getDeviceTorque() const
Return the device applied torque (scaled)
Vec3d getDamperTorque() const
Returns damper torque.
Vec3d getDeviceForce() const
Return the device applied force (scaled)
bool getUseForceSmoothening() const
Set/Get whether to use force smoothening Force smoothening averages the force used on the device over...
Vec3d m_linearKs
Spring coefficient, linear.