mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
example.cpp File Reference

Example file for the Repredictor implementation. More...

#include <mrs_lib/repredictor.h>
#include <mrs_lib/lkf.h>
#include <mrs_lib/mutex.h>
#include <random>
#include <fstream>
#include <mutex>
#include <thread>
#include <ros/ros.h>
#include <mrs_msgs/Float64Stamped.h>
+ Include dependency graph for example.cpp:

Namespaces

 mrs_lib
 All mrs_lib functions, classes, variables and definitions are contained in this namespace.
 

Typedefs

using mrs_lib::rep_t = Repredictor< lkf_t >
 
using A_t = lkf_t::A_t
 
using B_t = lkf_t::B_t
 
using H_t = lkf_t::H_t
 
using Q_t = lkf_t::Q_t
 
using x_t = lkf_t::x_t
 
using P_t = lkf_t::P_t
 
using u_t = lkf_t::u_t
 
using z_t = lkf_t::z_t
 
using R_t = lkf_t::R_t
 
using statecov_t = lkf_t::statecov_t
 

Enumerations

enum  type_e { input, meas_fast, meas_slow }
 

Functions

template<int rows>
Eigen::Matrix< double, rows, 1 > multivariate_gaussian (const Eigen::Matrix< double, rows, rows > &cov)
 
A_t generateA (const double dt)
 
B_t generateB ([[maybe_unused]] const double dt)
 
const H_t H ((H_t()<< 1, 0).finished())
 
void process_msg (const mrs_msgs::Float64Stamped::ConstPtr msg, type_e type)
 
void callback_input (const mrs_msgs::Float64Stamped::ConstPtr msg)
 
void callback_meas_fast (const mrs_msgs::Float64Stamped::ConstPtr msg)
 
void callback_meas_slow (const mrs_msgs::Float64Stamped::ConstPtr msg)
 
void meas_generator_fast ()
 
void meas_generator_slow ()
 
int main (int argc, char **argv)
 

Variables

const Q_t Q = 2.5*Q_t::Identity()
 
const R_t R_fast = 5.5*R_t::Identity()
 
const R_t R_slow = 0.01*R_t::Identity()
 
const x_t x0 = x_t::Zero()
 
const P_t P0 = 5.0*P_t::Identity()
 
const u_t u0 = u_t::Zero()
 
const ros::Time t0 = ros::Time(0)
 
const std::shared_ptr< lkf_tlkf_ptr = std::make_shared<lkf_t>(generateA, generateB, H)
 
const unsigned buf_sz = 100
 
std::mutex rep_pubs_mtx
 
rep_t rep (x0, P0, u0, Q, t0, lkf_ptr, buf_sz)
 
ros::Publisher pub_pos_est
 
ros::Publisher pub_vel_est
 
std::mutex x_mtx
 
x_t x = x_t::Random()
 
ros::Publisher pub_meas_fast
 
ros::Publisher pub_meas_slow
 

Detailed Description

Example file for the Repredictor implementation.

Author
Matouš Vrba - vrbam.nosp@m.ato@.nosp@m.fel.c.nosp@m.vut..nosp@m.cz

This example may be run after building mrs_lib by executing rosrun mrs_lib repredictor_example.

See repredictor/example.cpp.