1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | // created: 2013/04/08
|
---|
6 | // filename: TrajectoryGenerator2DCircle.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class generating a circle trajectory in 2D
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include "TrajectoryGenerator2DCircle.h"
|
---|
19 | #include "TrajectoryGenerator2DCircle_impl.h"
|
---|
20 | #include <Matrix.h>
|
---|
21 | #include <Layout.h>
|
---|
22 | #include <LayoutPosition.h>
|
---|
23 | #include <Vector2D.h>
|
---|
24 |
|
---|
25 | using std::string;
|
---|
26 | using namespace flair::core;
|
---|
27 | using namespace flair::gui;
|
---|
28 |
|
---|
29 | namespace flair {
|
---|
30 | namespace filter {
|
---|
31 |
|
---|
32 | TrajectoryGenerator2DCircle::TrajectoryGenerator2DCircle(
|
---|
33 | const LayoutPosition *position, string name)
|
---|
34 | : IODevice(position->getLayout(), name) {
|
---|
35 | pimpl_ = new TrajectoryGenerator2DCircle_impl(this, position, name);
|
---|
36 | AddDataToLog(pimpl_->output);
|
---|
37 | SetIsReady(true);
|
---|
38 | }
|
---|
39 |
|
---|
40 | TrajectoryGenerator2DCircle::~TrajectoryGenerator2DCircle() { delete pimpl_; }
|
---|
41 |
|
---|
42 | bool TrajectoryGenerator2DCircle::IsRunning(void) const {
|
---|
43 | return pimpl_->is_running;
|
---|
44 | }
|
---|
45 |
|
---|
46 | Matrix *TrajectoryGenerator2DCircle::GetMatrix(void) const {
|
---|
47 | return pimpl_->output;
|
---|
48 | }
|
---|
49 |
|
---|
50 | void TrajectoryGenerator2DCircle::StartTraj(const Vector2Df &start_pos,
|
---|
51 | float nb_lap) {
|
---|
52 | pimpl_->StartTraj(start_pos, nb_lap);
|
---|
53 | }
|
---|
54 |
|
---|
55 | void TrajectoryGenerator2DCircle::FinishTraj(void) { pimpl_->FinishTraj(); }
|
---|
56 |
|
---|
57 | void TrajectoryGenerator2DCircle::StopTraj(void) { pimpl_->is_running = false; }
|
---|
58 |
|
---|
59 | void TrajectoryGenerator2DCircle::GetPosition(Vector2Df &point) const {
|
---|
60 | point.x = pimpl_->output->Value(0, 0);
|
---|
61 | point.y = pimpl_->output->Value(0, 1);
|
---|
62 | }
|
---|
63 |
|
---|
64 | void TrajectoryGenerator2DCircle::SetCenter(const Vector2Df &value) {
|
---|
65 | pimpl_->pos_off = value;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void TrajectoryGenerator2DCircle::GetSpeed(Vector2Df &point) const {
|
---|
69 | point.x = pimpl_->output->Value(1, 0);
|
---|
70 | point.y = pimpl_->output->Value(1, 1);
|
---|
71 | }
|
---|
72 |
|
---|
73 | void TrajectoryGenerator2DCircle::SetCenterSpeed(const Vector2Df &value) {
|
---|
74 | pimpl_->vel_off = value;
|
---|
75 | }
|
---|
76 |
|
---|
77 | void TrajectoryGenerator2DCircle::Update(Time time) {
|
---|
78 | pimpl_->Update(time);
|
---|
79 | ProcessUpdate(pimpl_->output);
|
---|
80 | }
|
---|
81 |
|
---|
82 | } // end namespace filter
|
---|
83 | } // end namespace flair
|
---|