A simple listener to calculate collision force against a square area for the example application.
More...
#include <MovingSquareForce.h>
A simple listener to calculate collision force against a square area for the example application.
Includes support for the square being moved by a second tool.
- See also
- SurgSim::Input::InputConsumerInterface, SurgSim::Input::OutputProducerInterface
§ computeForce()
Calculates the force as a function of device tip position.
The calculation is very simple, for a simple demo of the device input/output functionality.
- Parameters
-
position | The device tip position. |
- Returns
- The computed force.
§ handleInput()
Notifies the consumer that the application input coming from the device has been updated.
Typical input data contents (but note that individual devices may do things differently):
type | name | |
pose | "pose" | Device pose (units are meters). |
bool | "button1" | State of the first device button. |
bool | "button2" | State of the second device button (and so on). |
Other possible contents includes:
type | name | |
bool | "isHomed" | Device homing status. |
bool | "isHomedX" | Individual homing status for the X axis (and so on). |
bool | "isHeld" | Safety sensor etc. status. |
string | "model" | Device model description. |
string | "serial" | Serial number string. |
(any) | "debug:*" | Various debugging information |
- Parameters
-
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.
§ initializeInput()
Set the initial input data group.
- Parameters
-
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.
§ requestOutput()
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. |
- Parameters
-
| 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. |
- Returns
- true if the producer has provided some output, false if it refuses to do so. A producer that returns false should leave outputData unmodified.
Implements SurgSim::Input::OutputProducerInterface.
§ updateSquare()
Updates the state of the square as described by squareInputData.
- Parameters
-
squareInputData | The state of the device controlling the colliding square. |
§ updateTool()
Updates the state of the tool as described by toolInputData.
- Parameters
-
toolInputData | The state of the device controlling the tool. |
The documentation for this class was generated from the following files:
- SurgSim/Testing/VisualTestCommon/MovingSquareForce.h
- SurgSim/Testing/VisualTestCommon/MovingSquareForce.cpp