Klamp't  0.9.0
Public Member Functions | Public Attributes | List of all members
Klampt::ContactSensor Class Reference

Simulates a contact sensor / tactile sensor. More...

#include <ForceSensors.h>

Inheritance diagram for Klampt::ContactSensor:

Public Member Functions

virtual const char * Type () const override
virtual void Simulate (SimRobotController *robot, Simulator *sim) override
 Called whenever the sensor is updated from the simulaton.
virtual void SimulateKinematic (RobotModel &robot, WorldModel &world) override
 Updates the sensor for a kinematic world. Useful for non-simulation debugging.
virtual void Reset () override
 Should be overridden if the sensor is stateful to reset to an initial state.
virtual void MeasurementNames (vector< string > &names) const override
 Must be overridden to produce a list of names of each measurement.
virtual void GetMeasurements (vector< double > &values) const override
 Must be overridden to returns a list of all measurements.
virtual void SetMeasurements (const vector< double > &values) override
virtual map< string, string > Settings () const override
 Returns a map of all current name-value pairs of the sensor's settings.
virtual bool GetSetting (const string &name, string &str) const override
 Get a named setting. Returns false if the name is not supported.
virtual bool SetSetting (const string &name, const string &str) override
virtual void DrawGL (const RobotModel &robot, const vector< double > &measurements) override
- Public Member Functions inherited from Klampt::SensorBase
virtual void Advance (double dt)
 Advances to the next time step with duration dt elapsed.
virtual bool ReadState (File &f)
virtual bool WriteState (File &f) const
virtual void GetInternalState (vector< double > &state) const
 Any other state besides measurements/settings that you might want to store. Used in ReadState.
virtual void SetInternalState (const vector< double > &state)
 Any other state besides measurements/settings that you might want to store. Used in WriteState.

Public Attributes

int link
 The link on which the sensor is located.
RigidTransform Tsensor
 Local frame of the sensor relative to the link (by convention, origin is at contact patch center, z is normal to surface, out of robot)
Vector2 patchMin
Vector2 patchMax
 The 2D contact patch in the local frame of the sensor.
Real patchTolerance
 The deformation tolerance of the contact patch (default 0.001)
bool hasForce [3]
 If an element is true, that component of force is measured (default false)
Vector3 fResolution
 Resolution of the sensor (default 0)
Vector3 fVariance
 Estimated variance of the sensor (default 0)
Real fSensitivity
 The minimum z force needed to register contact (default 0)
Vector3 fSaturation
 The maximum force registered on each axis (default inf)
Real falloffCoefficient
 The falloff coefficient (default 0)
bool contact
 Measurement: true if contact has been made.
Vector3 force
 Measurement: the force magnitude.
- Public Attributes inherited from Klampt::SensorBase
string name
double rate
bool enabled

Detailed Description

Simulates a contact sensor / tactile sensor.

The sensor comprises a block of space which needs to be placed on the surface of a robot. The x-y coordinates of this block form a "contact patch" over which the sensor obtains readings. The sensor origin is the center of this block.

If the simulator generates any contacts inside the contact patch, where the contact z-coordinate lies within patchTolerance of 0, then the sensor reports contact. The sensor can also have up to 3 axes of force sensing.

If falloffCoefficient=0, then the entire patch basically acts as a rigid strain gauge. Otherwise, the contact force at local point (x,y) attenuates according to the weight (1-4*|x||y|/(xpatchSize*ypatchSize))^falloffCoefficient so that forces near the edge of the patch are reduced in their influence on the measurement.

Configurable settings:

Member Function Documentation

virtual void Klampt::ContactSensor::DrawGL ( const RobotModel robot,
const vector< double > &  measurements 

If the sensor can be drawn, draw the sensor on the robot's current configuration, using these measurements, using OpenGL calls.

Reimplemented from Klampt::SensorBase.

virtual void Klampt::ContactSensor::SetMeasurements ( const vector< double > &  values)

Updates the internal measurement vector. Should be overridden to correctly restore state using ReadState(), or to visualize a physical robot's sensors.

Reimplemented from Klampt::SensorBase.

virtual bool Klampt::ContactSensor::SetSetting ( const string &  name,
const string &  str 

Set a named setting. Returns false if the name is not supported, or the value is formatted incorrectly

Reimplemented from Klampt::SensorBase.

The documentation for this class was generated from the following file: