source: flair-src/trunk/lib/FlairSimulator/src/Simulator.cpp@ 10

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

lic

File size: 1.8 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/03/25
6// filename: Simulator.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: classe de base du Simulator
14//
15/*********************************************************************/
16
17#include "Simulator.h"
18#include "Simulator_impl.h"
19#include "Euler.h"
20#include "Quaternion.h"
21#include "Vector3D.h"
22#ifdef GL
23#include "Gui.h"
24#endif
25
26using namespace std;
27using namespace flair::core;
28
29namespace
30{
31 flair::simulator::Simulator* simu=NULL;
32}
33
34namespace flair
35{
36namespace simulator
37{
38
39Simulator* getSimulator(void) {
40 return simu;
41}
42
43Simulator::Simulator(string name,int optitrack_mstime,float yaw_deg): FrameworkManager(name)
44{
45 if(simu!=NULL) Err("Simulator should be instanced only one time\n");
46
47 pimpl_=new Simulator_impl(this,optitrack_mstime,yaw_deg);
48 simu=this;
49}
50
51Simulator::~Simulator()
52{
53 delete pimpl_;
54}
55
56Quaternion Simulator::ToVRPNReference(Quaternion quat_in) {
57 Quaternion yaw_rot_quat;
58 Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
59 yaw_rot_euler.ToQuaternion(yaw_rot_quat);
60
61 return yaw_rot_quat*quat_in;
62}
63
64Vector3D Simulator::ToVRPNReference(Vector3D point_in) {
65 Quaternion yaw_rot_quat;
66 Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
67 yaw_rot_euler.ToQuaternion(yaw_rot_quat);
68 point_in.Rotate(yaw_rot_quat);
69
70 return point_in;
71}
72
73float Simulator::Yaw(void) const
74{
75 return pimpl_->yaw_rad;
76}
77
78void Simulator::RunSimu(void)
79{
80 pimpl_->RunSimu();
81}
82
83} // end namespace simulator
84} // end namespace flair
Note: See TracBrowser for help on using the repository browser.