Klamp't  0.8.1
StateEstimator.h
1 #ifndef STATE_ESTIMATOR_H
2 #define STATE_ESTIMATOR_H
3 
4 #include "Sensor.h"
5 #include <Klampt/Control/Command.h>
6 #include <Klampt/Modeling/Robot.h>
7 #include <KrisLibrary/robotics/Wrench.h>
8 
9 class ODERobot;
10 
23 {
24  RobotStateEstimator(Robot& _robot) :robot(_robot) {}
25  virtual ~RobotStateEstimator() {}
26  virtual void ReadSensors(RobotSensors& sensors) {}
27  virtual void UpdateModel() {}
28  virtual void ReadCommand(const RobotMotorCommand& command) {}
29  virtual void Advance(Real dt) {}
30  virtual void Reset() {}
31 
32  Robot& robot;
33 };
34 
40 {
41  OmniscientStateEstimator(Robot& _robot,ODERobot& _oderobot)
42  :RobotStateEstimator(_robot),oderobot(_oderobot) {}
43  virtual ~OmniscientStateEstimator();
44  virtual void UpdateModel();
45 
46  ODERobot& oderobot;
47 };
48 
57 {
59  virtual ~IntegratedStateEstimator() {}
60  virtual void ReadSensors(RobotSensors& sensors);
61  virtual void UpdateModel() {
62  robot.UpdateConfig(q_predicted);
63  robot.dq = dq_predicted;
64  }
65  virtual void ReadCommand(const RobotMotorCommand& command);
66  virtual void Advance(Real dt);
67  virtual void Reset();
68 
69  //instead of ReadCommand, this estimator uses SetDDQ
70  void SetDDQ(const Vector& ddq) { ddq_predicted = ddq; }
71 
72  Real last_dt;
73  Vector q_predicted,dq_predicted,ddq_predicted;
74  Vector q_sensed,dq_sensed;
75  //these correspond to the world positions of the accelerometers in the sensors
76  vector<RigidTransform> accelerometerFrames;
77  vector<RigidBodyVelocity> accelerometerVels;
78 };
79 
80 #endif
A robot simulated in an ODE "world".
Definition: ODERobot.h:28
The main robot type used in RobotSim.
Definition: Robot.h:79
A collection of basic motor types.
Definition: Command.h:43
A generic state estimator base class. Base class does nothing.
Definition: StateEstimator.h:22
A state estimator will full knowledge of the robot&#39;s simulated state. An ODERobot must be provided at...
Definition: StateEstimator.h:39
A set of sensors for the robot.
Definition: Sensor.h:106
A state estimator that integrates information from accelerometers (i.e., an Inertial Measurement Unit...
Definition: StateEstimator.h:56