source: flair-src/trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp@ 24

Last change on this file since 24 was 15, checked in by Bayard Gildas, 6 years ago

sources reformatted with flair-format-dir script

File size: 2.2 KB
Line 
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 <cvmatrix.h>
21#include <Layout.h>
22#include <LayoutPosition.h>
23#include <Vector2D.h>
24
25using std::string;
26using namespace flair::core;
27using namespace flair::gui;
28
29namespace flair {
30namespace filter {
31
32TrajectoryGenerator2DCircle::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}
38
39TrajectoryGenerator2DCircle::~TrajectoryGenerator2DCircle() { delete pimpl_; }
40
41bool TrajectoryGenerator2DCircle::IsRunning(void) const {
42 return pimpl_->is_running;
43}
44
45cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const {
46 return pimpl_->output;
47}
48
49void TrajectoryGenerator2DCircle::StartTraj(const Vector2D &start_pos,
50 float nb_lap) {
51 pimpl_->StartTraj(start_pos, nb_lap);
52}
53
54void TrajectoryGenerator2DCircle::FinishTraj(void) { pimpl_->FinishTraj(); }
55
56void TrajectoryGenerator2DCircle::StopTraj(void) { pimpl_->is_running = false; }
57
58void TrajectoryGenerator2DCircle::GetPosition(Vector2D &point) const {
59 point.x = pimpl_->output->Value(0, 0);
60 point.y = pimpl_->output->Value(0, 1);
61}
62
63void TrajectoryGenerator2DCircle::SetCenter(const Vector2D &value) {
64 pimpl_->pos_off = value;
65}
66
67void TrajectoryGenerator2DCircle::GetSpeed(Vector2D &point) const {
68 point.x = pimpl_->output->Value(1, 0);
69 point.y = pimpl_->output->Value(1, 1);
70}
71
72void TrajectoryGenerator2DCircle::SetCenterSpeed(const Vector2D &value) {
73 pimpl_->vel_off = value;
74}
75
76void TrajectoryGenerator2DCircle::Update(Time time) {
77 pimpl_->Update(time);
78 ProcessUpdate(pimpl_->output);
79}
80
81} // end namespace filter
82} // end namespace flair
Note: See TracBrowser for help on using the repository browser.