#include <mc_observers/EncoderObserver.h>
Public Member Functions | |
EncoderObserver (const std::string &type, double dt) | |
void | configure (const mc_control::MCController &ctl, const mc_rtc::Configuration &config) override |
void | reset (const mc_control::MCController &ctl) override |
bool | run (const mc_control::MCController &ctl) override |
Computes encoder velocity if necessary: More... | |
void | update (mc_control::MCController &ctl) override |
Public Member Functions inherited from mc_observers::Observer | |
Observer (const std::string &type, double dt) | |
virtual | ~Observer ()=default |
void | name (const std::string &name) |
Set the observer's name. More... | |
const std::string & | name () const noexcept |
Returns the observer's name. More... | |
void | addToLogger_ (const mc_control::MCController &ctl, mc_rtc::Logger &logger, const std::string &category="") |
Add observer entries to the logger under the categrory "category + name()". More... | |
void | removeFromLogger_ (mc_rtc::Logger &logger, const std::string &category="") |
Remove observer from logger. More... | |
void | addToGUI_ (const mc_control::MCController &ctl, mc_rtc::gui::StateBuilder &gui, std::vector< std::string > category={}) |
Add observer to the gui under category {category, name()}. More... | |
void | removeFromGUI_ (mc_rtc::gui::StateBuilder &gui, std::vector< std::string > category={}) |
Remove observer from gui. More... | |
const std::string & | desc () const noexcept |
Short description of the observer. More... | |
const std::string | type () const noexcept |
const std::string & | error () const noexcept |
double | dt () const noexcept |
Protected Types | |
enum | PosUpdate { PosUpdate::Control, PosUpdate::EncoderValues, PosUpdate::None } |
enum | VelUpdate { VelUpdate::Control, VelUpdate::EncoderVelocities, VelUpdate::EncoderFiniteDifferences, VelUpdate::None } |
Protected Member Functions | |
void | addToLogger (const mc_control::MCController &, mc_rtc::Logger &, const std::string &) override |
Add observer from logger. More... | |
Protected Member Functions inherited from mc_observers::Observer | |
virtual void | removeFromLogger (mc_rtc::Logger &, const std::string &) |
Remove observer from logger. More... | |
virtual void | addToGUI (const mc_control::MCController &, mc_rtc::gui::StateBuilder &, const std::vector< std::string > &) |
Add observer information the GUI. More... | |
virtual void | removeFromGUI (mc_rtc::gui::StateBuilder &, const std::vector< std::string > &category) |
Remove observer from GUI. More... | |
Protected Attributes | |
PosUpdate | posUpdate_ = PosUpdate::EncoderValues |
VelUpdate | velUpdate_ = VelUpdate::EncoderFiniteDifferences |
bool | computeFK_ = true |
Whether to compute forward kinematics. More... | |
bool | computeFV_ = true |
Whether to compute forward velocity. More... | |
bool | initialized_ = false |
True if the observer's memory has been initialized. More... | |
std::string | robot_ = "" |
Robot estimated by this observer. More... | |
std::string | updateRobot_ = "" |
Robot to update (defaults to robot_) More... | |
std::vector< double > | prevEncoders_ |
Previous encoder values (for VelUpdate::EncoderFiniteDifferences) More... | |
std::vector< double > | encodersVelocity_ |
Estimated encoder velocity. More... | |
bool | logPosition_ = false |
bool | logVelocity_ = true |
Protected Attributes inherited from mc_observers::Observer | |
std::string | name_ |
Observer name. More... | |
std::string | type_ |
Observer type. More... | |
std::string | desc_ |
Short description of the observer and its configuration. More... | |
std::string | error_ |
Descriptive error message to show if the observer failed. More... | |
double | dt_ |
Timestep. More... | |
Estimator of floating base position and velocity
Position is directly obtained from sensor values Velocity is then computed by finite differences
The default behaviour is to update the real robot from the estimated position and velocity.
You can configure the estimator with the following JSON configuration
|
strongprotected |
|
strongprotected |
Velocity update type
|
inline |
|
overrideprotectedvirtual |
Add observer from logger.
Default implementation does nothing, each observer implementation is responsible for adding its own log entries
category | Category in which to log this observer |
Reimplemented from mc_observers::Observer.
|
overridevirtual |
Configure observer
Reimplemented from mc_observers::Observer.
|
overridevirtual |
Reset finite differences estimator from current encoder values and sets encoder velocity to zero
std::runtime_error | if the robot does not have encoder values |
Implements mc_observers::Observer.
|
overridevirtual |
Computes encoder velocity if necessary:
Implements mc_observers::Observer.
|
overridevirtual |
Update the real robot from the estimator state according to the observer's results
Implements mc_observers::Observer.
|
protected |
Whether to compute forward kinematics.
|
protected |
Whether to compute forward velocity.
|
protected |
Estimated encoder velocity.
|
protected |
True if the observer's memory has been initialized.
|
protected |
|
protected |
|
protected |
|
protected |
Previous encoder values (for VelUpdate::EncoderFiniteDifferences)
|
protected |
Robot estimated by this observer.
|
protected |
Robot to update (defaults to robot_)
|
protected |