In file /home/blah/darwin2k/src/dyno/mechanism/dyno.h:

class dynoTimer

an object that gets called periodically during simulation.

Inheritance:


Public Fields

[more]dynoTimerCallback cb
a user-specified callback
[more]void* userData
user-specified callback data
[more]int alwaysUpdate
indicates that the timer should always be called after a simulation time step.
[more]double dt
the desired time between steps.
[more]double nextTime
the next time the timer's doAction method will be called

Public Methods

[more]typedef int (*dynoTimerCallback)(void* userData, dynoTimer* tm, double t, timerAction &action)
a type for the optional user callback supplied to the constructor
[more] dynoTimer(dynoTimerCallback CB, double Dt, void* UserData)
constructor
[more]virtual int doAction(double currentTime, timerAction &action)
this method is called by the dynamicSystem at the time specified by nextTime, to within the dynamicSystem's timer resolution (determined by dynamicSystem::ticksPerSecond).
[more]virtual int reschedule(double newDt = -1)
reschedules the timer to go at ds->currentTime()+dt.

Public Members

[more]enum timerAction
actions to be taken after the current timer update
  • CONTINUE - schedule the next update in 'dt' seconds
  • PAUSE - deactive the timer, but don't remove it from the system
  • DELETE - remove the timer from the system and delete it


Inherited from dynoObject:

Public Fields

odynamicSystem* ds
oint active
oint stateSize

Public Methods

oinline virtual int getState(double* state)
oinline virtual int setState(const double* state)
oinline virtual int reset(void)


Inherited from synObject:

Public Fields

ostatic int staticClassID
oint objectID
oint verboseLevel

Public Methods

ovirtual const char* className(void) const
ovirtual synObject* copy(void) const
ovirtual int isOfType(int typeNum, int derivedOk)
ostatic int setStaticClassID(void)
ovirtual int classID(void) const


Documentation

an object that gets called periodically during simulation. The dynoTimer allows periodic events to be triggered, such as updating a controller's torque commands. A dynamicSystem must be supplied to the constructor, and the dynoTimer will be automatically deleted by the dynamicSystem when the dynamicSystem is deleted. To enforce this, the destructor is a protected method, so dynoTimers cannot be created except by the new operator.
oenum timerAction
actions to be taken after the current timer update

otypedef int (*dynoTimerCallback)(void* userData, dynoTimer* tm, double t, timerAction &action)
a type for the optional user callback supplied to the constructor

odynoTimerCallback cb
a user-specified callback

ovoid* userData
user-specified callback data

oint alwaysUpdate
indicates that the timer should always be called after a simulation time step. nextTime is used as an upper limit on the amount of time between calls

odouble dt
the desired time between steps. subclasses or callbacks can change the value of dt, and doAction will compute the next time at which the timer will be called.

odouble nextTime
the next time the timer's doAction method will be called

o dynoTimer(dynoTimerCallback CB, double Dt, void* UserData)
constructor

ovirtual int doAction(double currentTime, timerAction &action)
this method is called by the dynamicSystem at the time specified by nextTime, to within the dynamicSystem's timer resolution (determined by dynamicSystem::ticksPerSecond). The current simulation time is passed in currentTime. If the timer wishes to be paused or deleted, it can set 'action' to dynoTimer::PAUSE or dynoTimer::DETELE. Otherwise, doAction will compute nextTime as currentTime+dt. When 'action' is set to dynoTimer::DELETE, the timer will be deleted by the dynamicSystem

ovirtual int reschedule(double newDt = -1)
reschedules the timer to go at ds->currentTime()+dt. If newDt is greater than zero, than dt is first set to newDt.


This class has no child classes.
Friends:
dynamicSystem

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.