server/UtDynamicsSimulator/Sensor.cpp
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2 /*
3  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
4  * All rights reserved. This program is made available under the terms of the
5  * Eclipse Public License v1.0 which accompanies this distribution, and is
6  * available at http://www.eclipse.org/legal/epl-v10.html
7  * Contributors:
8  * The University of Tokyo
9  * National Institute of Advanced Industrial Science and Technology (AIST)
10  * General Robotix Inc.
11  */
12 
17 #include "Sensor.h"
18 
20 {
21  type = COMMON;
22 }
23 
24 
25 Sensor* Sensor::create(int type)
26 {
27  Sensor* sensor;
28 
29  switch(type){
30 
31  case FORCE:
32  sensor = new ForceSensor();
33  break;
34 
35  case RATE_GYRO:
36  sensor = new RateGyroSensor();
37  break;
38 
39  case ACCELERATION:
40  sensor = new AccelSensor();
41  break;
42 
43  case PRESSURE:
44  case PHOTO_INTERRUPTER:
45  case VISION:
46  case TORQUE:
47  sensor = new Sensor();
48  break;
49  default:
50  sensor = 0;
51  }
52 
53  return sensor;
54 }
55 
56 
58 {
59 
60 }
61 
62 
63 void Sensor::operator=(const Sensor& org)
64 {
65  name = org.name;
66  type = org.type;
67  id = org.id;
68  localR = org.localR;
69  localPos = org.localPos;
70 }
71 
72 
73 void Sensor::destroy(Sensor* sensor)
74 {
75  delete sensor;
76 }
77 
78 
79 void Sensor::clear()
80 {
81 
82 }
83 
84 
85 void Sensor::putInformation(std::ostream &os)
86 {
87  os << "name = " << name << ", id = " << id << "\n";
88  os << "localAttitude = " << localR << ", localPos = " << localPos << std::endl;
89 }
90 
91 
93 {
94  type = FORCE;
95 }
96 
97 
99 {
100  f = 0.0;
101  tau = 0.0;
102 }
103 
104 
105 void ForceSensor::putInformation(std::ostream& os)
106 {
107  os << "Force Sensor\n";
108  Sensor::putInformation(os);
109  os << "f = " << f << "tau = " << tau << std::endl;
110 }
111 
112 
114 {
115  type = RATE_GYRO;
116 }
117 
118 
120 {
121  w = 0.0;
122 }
123 
124 
125 void RateGyroSensor::putInformation(std::ostream& os)
126 {
127  os << "Gyro\n";
128  Sensor::putInformation(os);
129  os << "omega = " << w << std::endl;
130 }
131 
132 
134 {
135  type = ACCELERATION;
136  clear();
137 }
138 
139 
141 {
142  dv(0) = 0.0;
143  dv(1) = 0.0;
144  dv(2) = 0.0;
145 }
146 
147 
148 void AccelSensor::putInformation(std::ostream& os)
149 {
150  os << "Acceleration Sensor\n";
151  Sensor::putInformation(os);
152  os << "dv = " << dv << std::endl;
153 }
virtual void putInformation(std::ostream &os)
virtual void putInformation(std::ostream &os)
w
Sensor(RTC::Manager *manager)
virtual void putInformation(std::ostream &os)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:41