Klamp't  0.8.1
ForceSensors.h
1 #ifndef CONTROL_FORCE_SENSORS_H
2 #define CONTROL_FORCE_SENSORS_H
3 
4 #include "Sensor.h"
5 #include <KrisLibrary/math3d/primitives.h>
6 using namespace Math3D;
7 
39 class ContactSensor : public SensorBase
40 {
41  public:
42  ContactSensor();
43  virtual ~ContactSensor() {}
44  virtual const char* Type() const { return "ContactSensor"; }
45  virtual void Simulate(ControlledRobotSimulator* robot,WorldSimulation* sim);
46  virtual void SimulateKinematic(Robot& robot,RobotWorld& world);
47  virtual void Reset();
48  virtual void MeasurementNames(vector<string>& names) const;
49  virtual void GetMeasurements(vector<double>& values) const;
50  virtual void SetMeasurements(const vector<double>& values);
51  virtual map<string,string> Settings() const;
52  virtual bool GetSetting(const string& name,string& str) const;
53  virtual bool SetSetting(const string& name,const string& str);
54  virtual void DrawGL(const Robot& robot,const vector<double>& measurements);
55 
56  int link;
57  RigidTransform Tsensor;
58  Vector2 patchMin,patchMax;
60  bool hasForce[3];
61  Vector3 fResolution;
62  Vector3 fVariance;
63  Real fSensitivity;
64  Vector3 fSaturation;
66 
67  bool contact;
68  Vector3 force;
69 };
70 
90 {
91  public:
93  virtual ~ForceTorqueSensor() {}
94  virtual const char* Type() const { return "ForceTorqueSensor"; }
95  virtual void Simulate(ControlledRobotSimulator* robot,WorldSimulation* sim);
96  virtual void SimulateKinematic(Robot& robot,RobotWorld& world);
97  virtual void Reset();
98  virtual void MeasurementNames(vector<string>& names) const;
99  virtual void GetMeasurements(vector<double>& values) const;
100  virtual void SetMeasurements(const vector<double>& values);
101  virtual map<string,string> Settings() const;
102  virtual bool GetSetting(const string& name,string& str) const;
103  virtual bool SetSetting(const string& name,const string& str);
104  virtual void DrawGL(const Robot& robot,const vector<double>& measurements);
105 
106  int link;
107  bool hasForce[3];
108  bool hasTorque[3];
109  Vector3 fVariance, tVariance;
110 
111  Vector3 f,t;
112 };
113 
114 #endif
The main robot type used in RobotSim.
Definition: Robot.h:79
Vector2 patchMax
The 2D contact patch in the local frame of the sensor.
Definition: ForceSensors.h:58
A class containing information about an ODE-simulated and controlled robot.
Definition: ControlledSimulator.h:17
Vector3 fSaturation
The maximum force registered on each axis (default inf)
Definition: ForceSensors.h:64
RigidTransform Tsensor
Local frame of the sensor relative to the link (by convention, origin is at contact patch center...
Definition: ForceSensors.h:57
Simulates a force-torque sensor mounted between a link and its parent. Can be configured to be up to ...
Definition: ForceSensors.h:89
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:20
Vector3 force
Measurement: the force magnitude.
Definition: ForceSensors.h:68
Vector3 tVariance
Estimated variance of the sensor (default 0)
Definition: ForceSensors.h:109
A sensor base class. A SensorBase should allow a Controller to both connect to a simulation as well a...
Definition: Sensor.h:51
Real fSensitivity
The minimum z force needed to register contact (default 0)
Definition: ForceSensors.h:63
Simulates a contact sensor / tactile sensor.
Definition: ForceSensors.h:39
Real patchTolerance
The deformation tolerance of the contact patch (default 0.001)
Definition: ForceSensors.h:59
Vector3 fResolution
Resolution of the sensor (default 0)
Definition: ForceSensors.h:61
Vector3 fVariance
Estimated variance of the sensor (default 0)
Definition: ForceSensors.h:62
Real falloffCoefficient
The falloff coefficient (default 0)
Definition: ForceSensors.h:65
int link
The link on which the sensor is located (between link and parent)
Definition: ForceSensors.h:106
int link
The link on which the sensor is located.
Definition: ForceSensors.h:56
A physical simulator for a RobotWorld.
Definition: WorldSimulation.h:67
bool contact
Measurement: true if contact has been made.
Definition: ForceSensors.h:67
Vector3 t
Measurement: the force/torque at the given position, on the link (negative on the parent link) ...
Definition: ForceSensors.h:111