![]() |
A device filter that integrates the pose, turning a relative device into an absolute one. More...
#include <SurgSim/Devices/DeviceFilters/PoseIntegrator.h>
Public Types | |
typedef SurgSim::Math::RigidTransform3d | PoseType |
The type used for poses. More... | |
Public Member Functions | |
PoseIntegrator (const std::string &name) | |
Constructor. More... | |
const PoseType & | integrate (const PoseType &pose) |
Integrates the pose. More... | |
virtual bool | initialize () override |
Fully initialize the device. More... | |
virtual bool | finalize () override |
Finalize (de-initialize) the device. More... | |
virtual void | initializeInput (const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override |
Set the initial input data group. More... | |
virtual void | handleInput (const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override |
Notifies the consumer that the application input coming from the device has been updated. More... | |
virtual bool | requestOutput (const std::string &device, SurgSim::DataStructures::DataGroup *outputData) override |
Asks the producer to provide output state to the device. More... | |
void | setReset (const std::string &name) |
Sets the string name of the boolean entry that will reset the pose to its initial value. More... | |
![]() | |
CommonDevice (const std::string &name) | |
Constructor. More... | |
CommonDevice (const std::string &name, const SurgSim::DataStructures::DataGroup &inputData) | |
Constructor. More... | |
CommonDevice (const std::string &name, SurgSim::DataStructures::DataGroup &&inputData) | |
Constructor. More... | |
virtual | ~CommonDevice () |
Destructor. More... | |
virtual std::string | getName () const override |
Return a (hopefully unique) device name. More... | |
void | setNameForCallback (const std::string &name) |
Set the name used for calling the input consumers and output producer. More... | |
std::string | getNameForCallback () const |
Get the name used for calling the input consumers and output producer. More... | |
virtual bool | addInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override |
Connect this device to an InputConsumerInterface, which will receive the data that comes from this device. More... | |
virtual bool | removeInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override |
Disconnect this device from an InputConsumerInterface, which will no longer receive data from this device. More... | |
virtual bool | setOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override |
Connect this device to an OutputProducerInterface, which will send data to this device. More... | |
virtual bool | removeOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override |
Disconnect this device from an OutputProducerInterface, which will no longer send data to this device. More... | |
virtual bool | hasOutputProducer () override |
Getter for whether or not this device is connected with an OutputProducerInterface. More... | |
![]() | |
virtual | ~DeviceInterface () |
Virtual destructor (empty). More... | |
![]() | |
virtual | ~InputConsumerInterface () |
Virtual destructor (empty). More... | |
![]() | |
virtual | ~OutputProducerInterface () |
Virtual destructor (empty). More... | |
Private Attributes | |
PoseType | m_poseResult |
The result of integrating the input poses. More... | |
SurgSim::Framework::Timer | m_timer |
A timer for the update rate needed for calculating velocity. More... | |
bool | m_firstInput |
true if the input DataGroup should be created. More... | |
std::shared_ptr< SurgSim::DataStructures::DataGroupCopier > | m_copier |
A copier into the input DataGroup, if needed. More... | |
std::string | m_resetName |
The name of the reset boolean (if any). More... | |
int | m_poseIndex |
int | m_linearVelocityIndex |
int | m_angularVelocityIndex |
int | m_resetIndex |
Additional Inherited Members | |
![]() | |
virtual void | pushInput () |
Push application input to consumers. More... | |
virtual bool | pullOutput () |
Pull application output from a producer. More... | |
SurgSim::DataStructures::DataGroup & | getInputData () |
Getter for the input data DataGroup. More... | |
const SurgSim::DataStructures::DataGroup & | getOutputData () const |
Getter for the output data DataGroup. More... | |
A device filter that integrates the pose, turning a relative device into an absolute one.
Also provides the instantaneous linear and angular velocities.
The type used for poses.
|
explicit |
Constructor.
name | Name of this device filter. |
|
overridevirtual |
Finalize (de-initialize) the device.
Implements SurgSim::Input::DeviceInterface.
|
overridevirtual |
Notifies the consumer that the application input coming from the device has been updated.
Treats the pose coming from the input device as a delta pose and integrates it to get the output pose.
device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once). |
inputData | The application input state coming from the device. |
Implements SurgSim::Input::InputConsumerInterface.
|
overridevirtual |
Fully initialize the device.
When the manager object creates the device, the internal state of the device usually isn't fully initialized yet. This method performs any needed initialization.
Implements SurgSim::Input::DeviceInterface.
|
overridevirtual |
Set the initial input data group.
device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once). |
inputData | The application input state coming from the device. |
Implements SurgSim::Input::InputConsumerInterface.
const PoseIntegrator::PoseType & SurgSim::Device::PoseIntegrator::integrate | ( | const PoseType & | pose | ) |
Integrates the pose.
pose | The latest differential pose. |
|
overridevirtual |
Asks the producer to provide output state to the device.
Note that devices may never call this method, e.g. because the device doesn't actually have any output capability.
Typical output data contents (but note that individual devices may do things differently):
type | name | |
---|---|---|
vector | "force" | Commanded force for the device (units are newtons). |
vector | "torque" | Commanded torque for the device (units are newton-meters). |
bool | "isEnabled" | Safety switch input. |
Other possible contents includes:
type | name | |
---|---|---|
bool | "led0" | Desired state for LED 0. |
bool | "led1" | Desired state for LED 1. |
string | "toolId" | Calibration ID to use, e.g. for camera devices. |
device | The name of the device that is requesting the output. This should only be used to identify the device (e.g. if the producer is listening to several devices at once). | |
[out] | outputData | The application output state being fed into the device. |
Implements SurgSim::Input::OutputProducerInterface.
void SurgSim::Device::PoseIntegrator::setReset | ( | const std::string & | name | ) |
Sets the string name of the boolean entry that will reset the pose to its initial value.
Such a reset can be useful if the integrated pose is used to position an object and the integration takes the object out of view.
name | The name of the NamedData<bool> entry. |
Asserts | if called after initialize. |
|
private |
The indices into the DataGroups.
|
private |
A copier into the input DataGroup, if needed.
|
private |
true if the input DataGroup should be created.
|
private |
The indices into the DataGroups.
|
private |
The indices into the DataGroups.
|
private |
The result of integrating the input poses.
|
private |
The indices into the DataGroups.
|
private |
The name of the reset boolean (if any).
|
private |
A timer for the update rate needed for calculating velocity.