mc_control::Ticker Struct Reference

#include <mc_control/Ticker.h>

Collaboration diagram for mc_control::Ticker:

Classes

struct  Configuration
 

Public Member Functions

 Ticker (const Configuration &config)
 
void reset ()
 
bool step ()
 
void run ()
 
double elapsed_time () const noexcept
 
const mc_control::MCGlobalControllercontroller () const noexcept
 
mc_control::MCGlobalControllercontroller () noexcept
 

Protected Member Functions

void simulate_sensors ()
 
void setup_gui ()
 
void set_time (double t)
 

Protected Attributes

Configuration config_
 
mc_control::MCGlobalController gc_
 
std::shared_ptr< mc_rtc::log::FlatLoglog_
 
size_t iters_ = 0
 
double sim_real_ratio_ = 1.0
 
std::atomic< bool > do_reset_ = false
 
bool running_ = true
 
bool replay_done_ = false
 
int64_t rem_steps_ = 0
 

Detailed Description

A ticker runs a (potentially infinite) loop of MCGlobalController

The default behavior is to run in open-loop mode where the outputs of mc_rtc are used to feed the inputs of MCGlobalController

It also supports loading log files to replay inputs, in replay we can:

  • replay the sensor inputs
  • replay the GUI inputs
  • replay arbitrary data into the datastore
  • replay outputs

Constructor & Destructor Documentation

◆ Ticker()

mc_control::Ticker::Ticker ( const Configuration config)

Initialize the ticker with the given configuration, this also initialize the controller

Member Function Documentation

◆ controller() [1/2]

const mc_control::MCGlobalController& mc_control::Ticker::controller ( ) const
inlinenoexcept

Access the controller (const)

◆ controller() [2/2]

mc_control::MCGlobalController& mc_control::Ticker::controller ( )
inlinenoexcept

Access the controller

◆ elapsed_time()

double mc_control::Ticker::elapsed_time ( ) const
inlinenoexcept

Elapsed simulation time since the last reset

◆ reset()

void mc_control::Ticker::reset ( )

Reset the ticker to the initial configuration

Note: the reset happes on the next call to step()

◆ run()

void mc_control::Ticker::run ( )

Run as many iterations as configured

◆ set_time()

void mc_control::Ticker::set_time ( double  t)
protected

◆ setup_gui()

void mc_control::Ticker::setup_gui ( )
protected

◆ simulate_sensors()

void mc_control::Ticker::simulate_sensors ( )
protected

◆ step()

bool mc_control::Ticker::step ( )

Run one step

This function does not do any time synchronization

Member Data Documentation

◆ config_

Configuration mc_control::Ticker::config_
protected

◆ do_reset_

std::atomic<bool> mc_control::Ticker::do_reset_ = false
protected

Do a reset on the next iteration

◆ gc_

mc_control::MCGlobalController mc_control::Ticker::gc_
protected

◆ iters_

size_t mc_control::Ticker::iters_ = 0
protected

Number of steps taken since the last reset

◆ log_

std::shared_ptr<mc_rtc::log::FlatLog> mc_control::Ticker::log_
protected

◆ rem_steps_

int64_t mc_control::Ticker::rem_steps_ = 0
protected

Number of steps remaning before going back to pause

◆ replay_done_

bool mc_control::Ticker::replay_done_ = false
protected

True when the replay is done

◆ running_

bool mc_control::Ticker::running_ = true
protected

True while running

◆ sim_real_ratio_

double mc_control::Ticker::sim_real_ratio_ = 1.0
protected

Current sim/real ratio


The documentation for this struct was generated from the following file: