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

Last change on this file since 10 was 10, checked in by Sanahuja Guillaume, 6 years ago

lic

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
30{
31namespace filter
32{
33
34TrajectoryGenerator2DCircle::TrajectoryGenerator2DCircle(const LayoutPosition* position,string name) : IODevice(position->getLayout(),name)
35{
36    pimpl_=new TrajectoryGenerator2DCircle_impl(this,position,name);
37    AddDataToLog(pimpl_->output);
38}
39
40
41TrajectoryGenerator2DCircle::~TrajectoryGenerator2DCircle()
42{
43    delete pimpl_;
44}
45
46bool TrajectoryGenerator2DCircle::IsRunning(void) const
47{
48    return pimpl_->is_running;
49}
50
51cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const
52{
53    return pimpl_->output;
54}
55
56void TrajectoryGenerator2DCircle::StartTraj(const Vector2D &start_pos,float nb_lap)
57{
58    pimpl_->StartTraj(start_pos,nb_lap);
59}
60
61void TrajectoryGenerator2DCircle::FinishTraj(void)
62{
63    pimpl_->FinishTraj();
64}
65
66void TrajectoryGenerator2DCircle::StopTraj(void)
67{
68    pimpl_->is_running=false;
69}
70
71void TrajectoryGenerator2DCircle::GetPosition(Vector2D &point) const
72{
73    point.x=pimpl_->output->Value(0,0);
74    point.y=pimpl_->output->Value(0,1);
75}
76
77void TrajectoryGenerator2DCircle::SetCenter(const Vector2D &value)
78{
79    pimpl_->pos_off=value;
80}
81
82void TrajectoryGenerator2DCircle::GetSpeed(Vector2D &point) const
83{
84    point.x=pimpl_->output->Value(1,0);
85    point.y=pimpl_->output->Value(1,1);
86}
87
88void TrajectoryGenerator2DCircle::SetCenterSpeed(const Vector2D &value)
89{
90    pimpl_->vel_off=value;
91}
92
93void TrajectoryGenerator2DCircle::Update(Time time)
94{
95    pimpl_->Update(time);
96    ProcessUpdate(pimpl_->output);
97}
98
99} // end namespace filter
100} // end namespace flair
Note: See TracBrowser for help on using the repository browser.