Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

P_SensorConfig.h

Go to the documentation of this file.
00001 /***************************************************************************
00002 *cr 
00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 
00004 *cr University of Illinois 
00005 *cr All Rights Reserved 
00006 *cr 
00007 ***************************************************************************/
00008 /***************************************************************************
00009 * RCS INFORMATION:
00010 *
00011 * $RCSfile: P_SensorConfig.h,v $
00012 * $Author: johns $ $Locker: $ $State: Exp $
00013 * $Revision: 1.28 $ $Date: 2019年01月17日 21:21:01 $
00014 *
00015 ***************************************************************************
00016 * DESCRIPTION:
00017 * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu
00018 *
00019 * A SensorConfig is the object that a Sensor gets its configuration
00020 * from. When it is loading a tracker's USL, it should make a
00021 * SensorConfig object and query it for the different sorts of offsets
00022 * and rotations that the particular tracker will use.
00023 *
00024 * SensorConfigs work by loading configuration files and parsing them
00025 * for the needed information. The format for a file is as follows:
00026 * Each line is either blank, a comment, a device line, or a parameter
00027 * for the last device that was specified.
00028 *
00029 * A comment is any line whose first non-whitespace character is a "#"
00030 *
00031 * A device line has the form "device <name> <USL>".
00032 * Parameters look like TCL commands, here are examples of all types:
00033 * scale .4
00034 * forcescale 2
00035 * offset 1 -2 0
00036 * rotate right 0 0 -1 1 0 0 0 1 0
00037 * rotate left 0 0 1 -1 0 0 0 -1 0
00038 ***************************************************************************/
00039 #ifndef SENSOR_CONFIG_H__
00040 #define SENSOR_CONFIG_H__
00041 
00042 #include <stdio.h>
00043 #include "JString.h"
00044 #include "ResizeArray.h"
00045 #include "Matrix4.h"
00046 
00049 class SensorConfig {
00050 public:
00052 SensorConfig(const char *thedevice);
00053 ~SensorConfig();
00054 
00056 const char *getUSL() const;
00057 
00059 const char *getdevice() const;
00060 
00062 static ResizeArray<JString *> *getnames();
00063 
00065 float getmaxforce() const;
00066 float getscale() const;
00067 const float *getoffset() const;
00068 const Matrix4 *getright_rot() const;
00069 const Matrix4 *getleft_rot() const;
00070 const char *gettype() const;
00071 const char *getplace() const;
00072 const char *getname() const;
00073 const char *getnums() const;
00074 const ResizeArray<int> *getsensors() const;
00075 
00078 int have_one_sensor() const;
00079 
00081 int require_local() const;
00082 
00084 int require_cave_name() const;
00085 
00087 int require_freevr_name() const;
00088 
00090 void make_vrpn_address(char *buf) const;
00091 
00092 private:
00094 static void ScanSensorFiles (int behavior, SensorConfig *sensor, void* params);
00095 void parseconfigfordevice(FILE *f, void *);
00096 static void parseconfigfornames(FILE *f, void *ret_void);
00097 
00098 float getfloat(const char *from, float defalt);
00099 int needargs(int argc,int need);
00100 int parseUSL(); 
00101 void read_sensor_nums(); 
00102 
00103 int line; 
00104 
00105 // the USL and its components
00106 JString USL;
00107 char device[50];
00108 char type[21];
00109 char place[101];
00110 char name[101];
00111 char nums[101];
00112 ResizeArray<int> sensors;
00113 
00114 float scale;
00115 float maxforce;
00116 float offset[3];
00117 Matrix4 right_rot;
00118 Matrix4 left_rot;
00119 };
00120 
00121 #endif // SENSOR_CONFIG_H__

Generated on Wed Nov 19 02:47:03 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /