Klamp't  0.9.0
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 namespace Klampt {
10 
11 class ODERobot;
12 
25 {
26  RobotStateEstimator(RobotModel& _robot) :robot(_robot) {}
27  virtual ~RobotStateEstimator() {}
28  virtual void ReadSensors(RobotSensors& sensors) {}
29  virtual void UpdateModel() {}
30  virtual void ReadCommand(const RobotMotorCommand& command) {}
31  virtual void Advance(Real dt) {}
32  virtual void Reset() {}
33 
34  RobotModel& robot;
35 };
36 
42 {
43  OmniscientStateEstimator(RobotModel& _robot,ODERobot& _oderobot)
44  :RobotStateEstimator(_robot),oderobot(_oderobot) {}
45  virtual ~OmniscientStateEstimator();
46  virtual void UpdateModel() override;
47 
48  ODERobot& oderobot;
49 };
50 
59 {
61  virtual ~IntegratedStateEstimator() {}
62  virtual void ReadSensors(RobotSensors& sensors) override;
63  virtual void UpdateModel() override {
64  robot.UpdateConfig(q_predicted);
65  robot.dq = dq_predicted;
66  }
67  virtual void ReadCommand(const RobotMotorCommand& command) override;
68  virtual void Advance(Real dt) override;
69  virtual void Reset() override;
70 
71  //instead of ReadCommand, this estimator uses SetDDQ
72  void SetDDQ(const Vector& ddq) { ddq_predicted = ddq; }
73 
74  Real last_dt;
75  Vector q_predicted,dq_predicted,ddq_predicted;
76  Vector q_sensed,dq_sensed;
77  //these correspond to the world positions of the accelerometers in the sensors
78  vector<RigidTransform> accelerometerFrames;
79  vector<RigidBodyVelocity> accelerometerVels;
80 };
81 
82 } //namespace Klampt
83 
84 #endif
A set of sensors for the robot.
Definition: Sensor.h:111
A collection of basic motor types.
Definition: Command.h:45
A generic state estimator base class. Base class does nothing.
Definition: StateEstimator.h:24
A robot simulated in an ODE "world".
Definition: ODERobot.h:30
The main robot type used in RobotSim.
Definition: Robot.h:83
A state estimator that integrates information from accelerometers (i.e., an Inertial Measurement Unit...
Definition: StateEstimator.h:58
A state estimator will full knowledge of the robot&#39;s simulated state. An ODERobot must be provided at...
Definition: StateEstimator.h:41
Definition: ContactDistance.h:6