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

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

simulator

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