Klamp't  0.9.0
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 
7 
8 namespace Klampt {
9 
10 using namespace Math3D;
11 
43 class ContactSensor : public SensorBase
44 {
45  public:
46  ContactSensor();
47  virtual ~ContactSensor() {}
48  virtual const char* Type() const override { return "ContactSensor"; }
49  virtual void Simulate(SimRobotController* robot,Simulator* sim) override;
50  virtual void SimulateKinematic(RobotModel& robot,WorldModel& world) override;
51  virtual void Reset() override;
52  virtual void MeasurementNames(vector<string>& names) const override;
53  virtual void GetMeasurements(vector<double>& values) const override;
54  virtual void SetMeasurements(const vector<double>& values) override;
55  virtual map<string,string> Settings() const override;
56  virtual bool GetSetting(const string& name,string& str) const override;
57  virtual bool SetSetting(const string& name,const string& str) override;
58  virtual void DrawGL(const RobotModel& robot,const vector<double>& measurements) override;
59 
60  int link;
61  RigidTransform Tsensor;
62  Vector2 patchMin,patchMax;
64  bool hasForce[3];
65  Vector3 fResolution;
66  Vector3 fVariance;
67  Real fSensitivity;
68  Vector3 fSaturation;
70 
71  bool contact;
72  Vector3 force;
73 };
74 
94 {
95  public:
97  virtual ~ForceTorqueSensor() {}
98  virtual const char* Type() const override { return "ForceTorqueSensor"; }
99  virtual void Simulate(SimRobotController* robot,Simulator* sim) override;
100  virtual void SimulateKinematic(RobotModel& robot,WorldModel& world) override;
101  virtual void Reset() override;
102  virtual void MeasurementNames(vector<string>& names) const override;
103  virtual void GetMeasurements(vector<double>& values) const override;
104  virtual void SetMeasurements(const vector<double>& values) override;
105  virtual map<string,string> Settings() const override;
106  virtual bool GetSetting(const string& name,string& str) const override;
107  virtual bool SetSetting(const string& name,const string& str) override;
108  virtual void DrawGL(const RobotModel& robot,const vector<double>& measurements) override;
109 
110  int link;
111  bool hasForce[3];
112  bool hasTorque[3];
113  Vector3 fVariance, tVariance;
114 
115  Vector3 f,t;
116 };
117 
118 } //namespace Klampt
119 
120 #endif
bool contact
Measurement: true if contact has been made.
Definition: ForceSensors.h:71
int link
The link on which the sensor is located.
Definition: ForceSensors.h:60
A physical simulator for a WorldModel.
Definition: Simulator.h:69
Vector3 force
Measurement: the force magnitude.
Definition: ForceSensors.h:72
RigidTransform Tsensor
Local frame of the sensor relative to the link (by convention, origin is at contact patch center...
Definition: ForceSensors.h:61
Simulates a force-torque sensor mounted between a link and its parent. Can be configured to be up to ...
Definition: ForceSensors.h:93
A class containing information about an ODE-simulated and controlled robot.
Definition: SimRobotController.h:19
A sensor base class. A SensorBase should allow a Controller to both connect to a simulation as well a...
Definition: Sensor.h:55
Vector2 patchMax
The 2D contact patch in the local frame of the sensor.
Definition: ForceSensors.h:62
Real fSensitivity
The minimum z force needed to register contact (default 0)
Definition: ForceSensors.h:67
Real falloffCoefficient
The falloff coefficient (default 0)
Definition: ForceSensors.h:69
Real patchTolerance
The deformation tolerance of the contact patch (default 0.001)
Definition: ForceSensors.h:63
The main robot type used in RobotSim.
Definition: Robot.h:83
Vector3 t
Measurement: the force/torque at the given position, on the link (negative on the parent link) ...
Definition: ForceSensors.h:115
Simulates a contact sensor / tactile sensor.
Definition: ForceSensors.h:43
Vector3 tVariance
Estimated variance of the sensor (default 0)
Definition: ForceSensors.h:113
Vector3 fVariance
Estimated variance of the sensor (default 0)
Definition: ForceSensors.h:66
Definition: ContactDistance.h:6
Vector3 fSaturation
The maximum force registered on each axis (default inf)
Definition: ForceSensors.h:68
Vector3 fResolution
Resolution of the sensor (default 0)
Definition: ForceSensors.h:65
int link
The link on which the sensor is located (between link and parent)
Definition: ForceSensors.h:110
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:24