9 #include "imstkSceneObjectController.h" 33 void setControlledObject(std::shared_ptr<SceneObject> obj)
override;
39 void setLinearKd(
const double kd) {
m_linearKd = kd; }
46 void setAngularKd(
const double kd) {
m_angularKd = kd; }
53 void setLinearKs(
const Vec3d& ks) {
m_linearKs = ks; }
54 void setLinearKs(
const double ks) {
m_linearKs = Vec3d(ks, ks, ks); }
61 void setAngularKs(
const Vec3d& ks) {
m_angularKs = ks; }
62 void setAngularKs(
const double ks) {
m_angularKs = Vec3d(ks, ks, ks); }
69 void setForceScaling(
const double forceScaling) { m_forceScaling = forceScaling; }
76 void setUseSpring(
const bool useSpring) {
m_useSpring = useSpring; }
84 void setUseForceSmoothening(
const bool useForceSmoothening) { m_forceSmoothening = useForceSmoothening; }
101 void setSmoothingKernelSize(
const int kernelSize) { m_smoothingKernelSize = kernelSize; }
110 void setHapticOffset(
const Vec3d& offset) { m_hapticOffset = offset; }
147 void update(
const double& dt)
override;
155 std::shared_ptr<PbdObject> m_pbdObject;
163 Vec3d m_fS = Vec3d::Zero();
164 Vec3d m_fD = Vec3d::Zero();
167 Vec3d m_tS = Vec3d::Zero();
168 Vec3d m_tD = Vec3d::Zero();
170 Vec3d m_hapticOffset = Vec3d::Zero();
171 double m_forceScaling = 0.0000075;
176 bool m_forceSmoothening =
true;
177 int m_smoothingKernelSize = 15;
178 std::deque<Vec3d> m_forces;
179 Vec3d m_forceSum = Vec3d::Zero();
182 bool m_firstRun =
true;
bool m_useSpring
If off, pos & orientation directly set.
int getSmoothingKernelSize() const
Set/Get the kernel size.
void applyForces() override
Apply forces to the haptic device.
Vec3d m_angularKs
Spring coefficient, rotational.
This class uses the provided device to control the provided rigid object via virtual coupling...
Vec3d getDeviceTorque() const
Return the device applied torque (scaled)
double m_angularKd
Damping coefficient, rotational.
double getLinearKd() const
Set/Get the linear damping coefficient. Default 10000.0.
bool getUseCritDamping() const
Set/Get whether to use critical damping (default on) Critical damping automatically computes linear &...
void update(const double &dt) override
Update controlled scene object using latest tracking information.
double getAngularKd() const
Set/Get the angular damping coefficient. Default 10000.0.
Vec3d getDeviceForce() const
Return the device applied force (scaled)
Vec3d getDamperForce() const
Returns damper force.
This class implements once tracking controller controlling one scene object.
bool getUseSpring() const
Set/Get whether to use spring or not.
const Vec3d & getAngularKs() const
Set/Get the rotationl spring coefficient. Default (10000.0, 10000.0, 10000.0)
double m_linearKd
Damping coefficient, linear.
Vec3d getDamperTorque() const
Returns damper torque.
bool m_useCriticalDamping
If on, kd is automatically computed.
bool getUseForceSmoothening() const
Set/Get whether to use force smoothening Force smoothening averages the force used on the device over...
Vec3d m_inversionParams
Inversion parameters for each axis.
double getForceScaling() const
Set/Get the scaling of the force on the device, set to 0 for no force.
Vec3d getSpringForce() const
Returns spring force, without damper.
Vec3d getSpringTorque() const
Returns spring torque, without damper.
Vec3d m_linearKs
Spring coefficient, linear.
const Vec3d & getLinearKs() const
Set/Get the linear spring coefficient. Default (8000000.0, 8000000.0, 8000000.0)
Vec3d getHapticOffset() const
Set/Get the haptic manipuladum offset. This is a local offset on the object for which haptics are fel...