iMSTK
Interactive Medical Simulation Toolkit
|
Two-jawed laparoscopic tool controlled by external device The tool is composed of three scene objects: pivot, lower jaw and upper jaw The jaws open-close based on the buttons at present. This has to be replaced by potentiometer tracking in future. More...
#include <imstkLaparoscopicToolController.h>
Public Types | |
enum | JawState { Closed, Opened } |
![]() | |
enum | InvertFlag { transX = 0x01, transY = 0x02, transZ = 0x04, rotX = 0x08, rotY = 0x10, rotZ = 0x20 } |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
Public Member Functions | |
LaparoscopicToolController (const std::string &name="LaparoscopicToolController") | |
void | setParts (std::shared_ptr< CollidingObject > shaft, std::shared_ptr< CollidingObject > upperJaw, std::shared_ptr< CollidingObject > lowerJaw, std::shared_ptr< Geometry > pickGeom) |
void | setDevice (std::shared_ptr< DeviceClient > device) override |
SIGNAL (LaparoscopicToolController, JawClosed) | |
Fired once when the jaw transitions to closed state. | |
SIGNAL (LaparoscopicToolController, JawOpened) | |
Fired once when the jaw transitions to open state. | |
void | update (const double &dt) override |
Update controlled laparoscopic tool using latest tracking information. | |
void | setMaxJawAngle (const double maxAngle) |
Set the maximum jaw angle. | |
void | setJawAngleChange (const double dAngle) |
Set the increment. | |
void | setJawRotationAxis (const Vec3d &axis) |
Set the jaw rotation axis. | |
double | getJawAngle () const |
Get the current jaw angle. | |
double | getMaxJawAngle () const |
Get the max jaw angle. | |
JawState | getJawState () const |
Get the state of the jaw whether it is open or closed. | |
![]() | |
virtual void | applyForces () |
Apply forces to the haptic device. | |
const Quatd & | getEffectorRotationOffset () |
Get/Set the roation applied to the end effector, this can be used to register the device in virtual space with regard to the users point of view. | |
void | setEffectorRotationOffset (const Quatd &r) |
virtual bool | updateTrackingData (const double dt) |
Update tracking data. | |
const Vec3d & | getPosition () const |
Set/Get the position of the tracker. | |
void | setPosition (const Vec3d &pos) |
const Quatd & | getOrientation () const |
Set/Get the orientation of the tracker. | |
void | setOrientation (const Quatd &orientation) |
void | setComputeVelocity (const bool computeVelocity) |
Set/Get whether to compute the velocity from previous and current samples Useful if a device does not provide the quantity. | |
bool | getComputeVelocity () const |
void | setComputeAngularVelocity (const bool computeAngularVelocity) |
Set/Get whether to compute the anular velocity from previous and current samples Useful if the device does not provide the quantity. | |
bool | getComputeAngularVelocity () const |
const Vec3d & | getAngularVelocity () const |
Get/Set the angular velocity. | |
void | setAngularVelocity (const Vec3d &angularVelocity) |
const Vec3d & | getVelocity () const |
Get/Set the linear velocity. | |
void | setVelocity (const Vec3d &velocity) |
double | getTranslationScaling () const |
Get/Set the current scaling factor. | |
void | setTranslationScaling (const double scaling) |
const Vec3d & | getTranslationOffset () const |
Get/Set the translation offset. | |
void | setTranslationOffset (const Vec3d &t) |
const Quatd & | getRotationOffset () |
Get/Set the rotation offset, this rotation is applied to the overall device coordinate system. | |
void | setRotationOffset (const Quatd &r) |
unsigned char | getInversionFlags () |
Get/Set the inversion flags, when set the corresponding axis coordinates or rotation angle will be negated. | |
void | setInversionFlags (const unsigned char f) |
![]() | |
SIGNAL (DeviceControl, modified) | |
virtual void | printControls () |
Prints the controls. | |
std::shared_ptr< DeviceClient > | getDevice () const |
Set/Get the device client used in the control. | |
![]() | |
virtual void | update (const UpdateInfo &imstkNotUsed(updateData)) |
virtual void | visualUpdate (const UpdateInfo &imstkNotUsed(updateData)) |
void | initTaskGraphEdges () |
Setup the edges/connections of the TaskGraph. | |
std::shared_ptr< TaskGraph > | getTaskGraph () const |
![]() | |
const std::string & | getName () const |
void | setName (const std::string &name) |
std::weak_ptr< Entity > | getEntity () const |
Get parent entity. | |
void | initialize () |
Initialize the component, called at a later time after all component construction is complete. | |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Attributes | |
std::shared_ptr< CollidingObject > | m_shaft |
Tool shaft. | |
std::shared_ptr< CollidingObject > | m_upperJaw |
Tool upper jaw. | |
std::shared_ptr< CollidingObject > | m_lowerJaw |
Tool lower jaw. | |
std::shared_ptr< Geometry > | m_pickGeom |
double | m_jawAngle = PI / 6.0 |
Angle of the jaws. | |
double | m_change = 6.0e-5 |
Amount of change in jaw angle per frame. | |
double | m_maxJawAngle = PI / 6.0 |
Maximum angle of the jaws. | |
JawState | m_jawState = JawState::Opened |
Vec3d | m_jawRotationAxis = Vec3d(1.0, 0.0, 0.0) |
Angle of the jaws. | |
Mat4d | m_controllerWorldTransform = Mat4d::Identity() |
Mat4d | m_pickGeomTransform = Mat4d::Identity() |
Mat4d | m_shaftVisualTransform = Mat4d::Identity() |
Mat4d | m_upperJawVisualTransform = Mat4d::Identity() |
Mat4d | m_lowerJawVisualTransform = Mat4d::Identity() |
Mat4d | m_shaftCollidingTransform = Mat4d::Identity() |
Mat4d | m_upperJawCollidingTransform = Mat4d::Identity() |
Mat4d | m_lowerJawCollidingTransform = Mat4d::Identity() |
Mat4d | m_upperJawLocalTransform = Mat4d::Identity() |
Mat4d | m_lowerJawLocalTransform = Mat4d::Identity() |
![]() | |
double | m_scaling = 1.0 |
Scaling factor for physical to virtual translations. | |
Vec3d | m_translationOffset = Vec3d::Zero() |
Translation concatenated to the device translation. | |
Quatd | m_rotationOffset = Quatd::Identity() |
Rotation concatenated to the device rotation. | |
Quatd | m_effectorRotationOffset = Quatd::Identity() |
Rotation prefixed to the device rotation. | |
unsigned char | m_invertFlags = 0x00 |
Invert flags to be masked with DeviceTracker::InvertFlag. | |
Vec3d | m_currentPos = Vec3d::Zero() |
Quatd | m_currentOrientation = Quatd::Identity() |
Vec3d | m_currentVelocity = Vec3d::Zero() |
Vec3d | m_currentAngularVelocity = Vec3d::Zero() |
Vec3d | m_currentDisplacement = Vec3d::Zero() |
Quatd | m_currentRotation = Quatd::Identity() |
bool | m_computeVelocity = false |
If true, will use current and previous positions to produce velocity, if off, will ask device for velocity. | |
bool | m_computeAngularVelocity = false |
If true, will use current and previous rotations to produce angular velocity, if off, will ask device for angular velocity. | |
![]() | |
std::shared_ptr< DeviceClient > | m_deviceClient |
![]() | |
std::shared_ptr< TaskGraph > | m_taskGraph = nullptr |
![]() | |
std::string | m_name |
std::weak_ptr< Entity > | m_entity |
Parent entity this component exists on. | |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Additional Inherited Members | |
![]() | |
TrackingDeviceControl (const std::string &name="TrackingDeviceControl") | |
![]() | |
DeviceControl (const std::string &name="DeviceControl") | |
![]() | |
Behaviour (const std::string &name="Behaviour") | |
Behaviour (const bool useTaskGraph, const std::string &name="Behaviour") | |
virtual void | initGraphEdges (std::shared_ptr< TaskNode > imstkNotUsed(source), std::shared_ptr< TaskNode > imstkNotUsed(sink)) |
Setup the edges/connections of the TaskGraph. More... | |
![]() | |
Component (const std::string &name="Component") | |
virtual void | init () |
Initialize the component, called at a later time after all component construction is complete. | |
Two-jawed laparoscopic tool controlled by external device The tool is composed of three scene objects: pivot, lower jaw and upper jaw The jaws open-close based on the buttons at present. This has to be replaced by potentiometer tracking in future.
Definition at line 24 of file imstkLaparoscopicToolController.h.