root/juggler/branches/2.2/modules/gadgeteer/test/new.cpp

Revision 19729, 5.1 kB (checked in by patrick, 2 years ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998-2007 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  *************** <auto-copyright.pl END do not edit this line> ***************/
26
27 #include <iostream>
28 #include <iomanip>
29 #include <VPR/SharedMem/vjMemPool.h>
30 //#include <VPR/SharedMem/SharedType.h>
31 #include <Input/vjPosition/vjFlock.h>
32 #include <Input/ibox/hci.h>
33 #include <Input/ibox/ibox.h>
34 #include <Input/vjInput/vjIbox.h>
35 #include <Input/vjGlove/vjCyberGlove.h>
36 #include <vpr/System.h>
37
38 int main()
39 {
40   MemPool* anSgiPool = new SharedPool(1024*1024);
41  
42   Flock* flock = new(anSgiPool) Flock;
43   IBox* anIbox = new(anSgiPool) IBox;
44   CyberGlove* aGlove = new(anSgiPool)
45           CyberGlove("/home/vr/CAVE/glove","/dev/ttyd45",38400);
46
47   POS_DATA *data,*data2;
48  
49   IBOX_DATA *iboxData;
50
51   char achar;
52   std::cout << "U - Update\n"
53             << "S - Start\n"
54             << "X - Stop\n"
55             << "Q - Quit\n"
56             << "O - Output\n";
57   do {
58    std::cin >> achar;
59
60    std::cout << flush;
61    switch(achar) {
62      case 'u':case 'U'break;
63      case 's':case 'S': flock->StartSampling();
64                         anIbox->StartSampling();
65                         aGlove->StartSampling();
66                         break;
67      case 'x':case 'X': flock->StopSampling();
68                         anIbox->StopSampling();
69                         aGlove->StopSampling();
70                         break;
71      case 'o':case 'O':
72      for(int z = 0; z < 10; z++){
73       C2GLOVE_DATA *gdata;
74          flock->UpdateData();
75          flock->GetData(data);
76          flock->GetData(data2);
77          anIbox->UpdateData();
78          anIbox->GetData(iboxData);
79         // aGlove->UpdateData();
80 //       aGlove->GetData(gdata);
81        system("clear"); 
82      std::cout << "vjFlock------------------------------------------------------------"
83                << std::endl
84                << "Data: x:" << std::setw(10) << data->pos.vec[0]
85                << " Data2x:" << std::setw(10) << data2->pos.vec[0] << std::endl
86                << "      y:" << std::setw(10) << data->pos.vec[1]
87                << "      y:" << std::setw(10) << data2->pos.vec[1] << std::endl
88                << "      z:" << std::setw(10) << data->pos.vec[2]
89                << "      z:" << std::setw(10) << data2->pos.vec[2] << std::endl
90                << "    azi:" << std::setw(10) << data->orient.vec[0]
91                << "    azi:" << std::setw(10) << data2->orient.vec[0]
92                << std::endl
93                << "   elev:" << std::setw(10) << data->orient.vec[1]
94                << "   elev:" << std::setw(10) << data2->orient.vec[1]
95                << std::endl
96                << "   roll:" << std::setw(10) << data->orient.vec[2]
97                << "   roll:" << std::setw(10) <<data2->orient.vec[2]
98                << std::endl << std::endl;
99      std::cout << "Ibox---------------------------------------------------------------"
100                << std::endl
101                << " button1: " << iboxData->button[0] << std::endl
102                << " button2: " << iboxData->button[1] << std::endl
103                << " button3: " << iboxData->button[2] << std::endl
104                << " button4: " << iboxData->button[3] << endstd::l << std::endl;
105 /*     std::cout << "Glove--------------------------------------------------------------"
106                  << std::endl
107                  << " first finger: " << gdata->joints[0][0] << " "
108                  << gdata->joints[0][1] << " " << gdata->joints[0][2] << " "
109                  << gdata->joints[0][3] << std::endl
110                  << "second finger: " << gdata->joints[1][0] << " "
111                  << gdata->joints[1][1] << " " << gdata->joints[1][2] << " "
112                  << gdata->joints[1][3] << std::endl
113                  << " third finger: " << gdata->joints[2][0] << " "
114                  << gdata->joints[2][1] << " " << gdata->joints[2][2] << " "
115                  << gdata->joints[2][3] << std::endl
116                  << " fourth finger: " << gdata->joints[3][0] << " "
117                  << gdata->joints[3][1] << " " << gdata->joints[3][2] << " "
118                  << gdata->joints[3][3] << std::endl;
119 */
120          vpr::System::sleep(2);
121     }
122      break;
123    }
124    std::cout << achar;
125   } while ((achar != 'q') && (achar != 'Q'));
126  
127   flock->StopSampling();
128   anIbox->StopSampling();
129   aGlove->StopSampling();
130  
131   delete flock;
132   delete anIbox;
133   delete aGlove;
134   delete anSgiPool;
135   return 0;
136 }
Note: See TracBrowser for help on using the browser.