-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathparticle.h
45 lines (37 loc) · 1.3 KB
/
particle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT-0
#pragma once
#include <drake/common/drake_copyable.h>
#include <drake/systems/framework/basic_vector.h>
#include <drake/systems/framework/context.h>
#include <drake/systems/framework/continuous_state.h>
#include <drake/systems/framework/leaf_system.h>
namespace drake_external_examples {
namespace particles {
/// A linear 1DOF particle system.
///
/// With very simple dynamics @f$ \ddot x = a @f$, this system can be
/// described in terms of its:
///
/// - Inputs:
/// - linear acceleration (input index 0), in @f$ m/s^2 @f$ units.
/// - States/Outputs:
/// - linear position (state/output index 0), in @f$ m @f$ units.
/// - linear velocity (state/output index 1), in @f$ m/s @f$ units.
///
/// @tparam_double_only
///
template <typename T>
class Particle final : public drake::systems::LeafSystem<T> {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Particle);
/// A constructor that initializes the system.
Particle();
protected:
void CopyStateOut(const drake::systems::Context<T>& context,
drake::systems::BasicVector<T>* output) const;
void DoCalcTimeDerivatives(
const drake::systems::Context<T>& context,
drake::systems::ContinuousState<T>* derivatives) const override;
};
} // namespace particles
} // namespace drake_external_examples