- 3.0.2 core module.
EventHandler.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
9 
10 namespace ct {
11 namespace core {
12 
14 
23 template <size_t STATE_DIM, typename SCALAR = double>
25 {
26 public:
30  virtual ~EventHandler() {}
31  virtual bool callOnSubsteps() = 0;
32 
34  virtual void reset() = 0;
35 
37 
43  virtual bool checkEvent(const StateVector<STATE_DIM, SCALAR>& state, const SCALAR& t) = 0;
44 
46 
51  virtual void handleEvent(const StateVector<STATE_DIM, SCALAR>& state, const SCALAR& t) = 0;
52 
53 private:
54  StateVectorArray<STATE_DIM, SCALAR> stateTrajectory_;
55  tpl::TimeArray<SCALAR> timeTrajectory_;
56 };
57 }
58 }
virtual void reset()=0
reset event handler
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
clear all close all load ct GNMSLog0 mat reformat t
virtual bool callOnSubsteps()=0
EventHandler()
Default constructor.
Definition: EventHandler.h:28
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: StateVector.h:12
An array in time.
Definition: TimeArray.h:22
virtual bool checkEvent(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR &t)=0
check if an event has happened
Interface for an event handler for an Integrator.
Definition: EventHandler.h:24
virtual void handleEvent(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR &t)=0
handle the event
virtual ~EventHandler()
destructor
Definition: EventHandler.h:30