Skip to content

Class robot_dart::Scheduler

ClassList > robot_dart > Scheduler

Public Functions

Type Name
Scheduler (double dt, bool sync=false)
double current_time () const
current time according to the simulation (simulation clock)
double dt () const
dt used by the simulation (simulation clock)
double it_duration () const
double last_it_duration () const
double next_time () const
next time according to the simulation (simulation clock)
bool operator() (int frequency)
double real_time () const
time according to the clock's computer (wall clock)
double real_time_factor () const
void reset (double dt, bool sync=false, double current_time=0., double real_time=0.)
bool schedule (int frequency)
void set_sync (bool enable)
double step ()
bool sync () const

Protected Types

Type Name
typedef std::chrono::high_resolution_clock clock_t

Protected Attributes

Type Name
double _average_it_duration = = 0.
int _current_step = = 0
double _current_time = = 0.
double _dt
double _it_duration = = 0.
clock_t::time_point _last_iteration_time
int _max_frequency = = -1
double _real_start_time = = 0.
double _real_time = = 0.
double _simu_start_time = = 0.
clock_t::time_point _start_time
bool _sync

Public Functions Documentation

function Scheduler

inline robot_dart::Scheduler::Scheduler (
    double dt,
    bool sync=false
) 

function current_time

inline double robot_dart::Scheduler::current_time () const

function dt

inline double robot_dart::Scheduler::dt () const

function it_duration

inline double robot_dart::Scheduler::it_duration () const

function last_it_duration

inline double robot_dart::Scheduler::last_it_duration () const

function next_time

inline double robot_dart::Scheduler::next_time () const

function operator()

inline bool robot_dart::Scheduler::operator() (
    int frequency
) 

function real_time

inline double robot_dart::Scheduler::real_time () const

function real_time_factor

inline double robot_dart::Scheduler::real_time_factor () const

function reset

void robot_dart::Scheduler::reset (
    double dt,
    bool sync=false,
    double current_time=0.,
    double real_time=0.
) 

function schedule

bool robot_dart::Scheduler::schedule (
    int frequency
) 

function set_sync

inline void robot_dart::Scheduler::set_sync (
    bool enable
) 

synchronize the simulation clock with the wall clock (when possible, i.e. when the simulation is faster than real time)


function step

double robot_dart::Scheduler::step () 

call this at the end of the loop (see examples) this will synchronize with real time if requested and increase the counter; returns the real-time (in seconds)


function sync

inline bool robot_dart::Scheduler::sync () const

Protected Types Documentation

typedef clock_t

using robot_dart::Scheduler::clock_t =  std::chrono::high_resolution_clock;

Protected Attributes Documentation

variable _average_it_duration

double robot_dart::Scheduler::_average_it_duration;

variable _current_step

int robot_dart::Scheduler::_current_step;

variable _current_time

double robot_dart::Scheduler::_current_time;

variable _dt

double robot_dart::Scheduler::_dt;

variable _it_duration

double robot_dart::Scheduler::_it_duration;

variable _last_iteration_time

clock_t::time_point robot_dart::Scheduler::_last_iteration_time;

variable _max_frequency

int robot_dart::Scheduler::_max_frequency;

variable _real_start_time

double robot_dart::Scheduler::_real_start_time;

variable _real_time

double robot_dart::Scheduler::_real_time;

variable _simu_start_time

double robot_dart::Scheduler::_simu_start_time;

variable _start_time

clock_t::time_point robot_dart::Scheduler::_start_time;

variable _sync

bool robot_dart::Scheduler::_sync;


The documentation for this class was generated from the following file robot_dart/scheduler.hpp