Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
hrplib
hrpModel
hrplib/hrpModel/Sensor.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3
* All rights reserved. This program is made available under the terms of the
4
* Eclipse Public License v1.0 which accompanies this distribution, and is
5
* available at http://www.eclipse.org/legal/epl-v10.html
6
* Contributors:
7
* National Institute of Advanced Industrial Science and Technology (AIST)
8
*/
9
10
11
#include "
Sensor.h
"
12
13
#ifndef M_PI
14
#define M_PI 3.14159265358979323846
15
#endif
16
17
using namespace
hrp
;
18
19
20
Sensor::Sensor
()
21
{
22
type
=
COMMON
;
23
}
24
25
26
Sensor
*
Sensor::create
(
int
type
)
27
{
28
Sensor
* sensor;
29
30
switch
(type){
31
32
case
FORCE
:
33
sensor =
new
ForceSensor
();
34
break
;
35
36
case
RATE_GYRO
:
37
sensor =
new
RateGyroSensor
();
38
break
;
39
40
case
ACCELERATION
:
41
sensor =
new
AccelSensor
();
42
break
;
43
44
case
RANGE
:
45
sensor =
new
RangeSensor
();
46
break
;
47
case
VISION
:
48
sensor =
new
VisionSensor
();
49
break
;
50
51
case
PRESSURE
:
52
case
PHOTO_INTERRUPTER
:
53
case
TORQUE
:
54
sensor =
new
Sensor
();
55
break
;
56
default
:
57
sensor = 0;
58
}
59
60
return
sensor;
61
}
62
63
64
Sensor:: ~Sensor
()
65
{
66
67
}
68
69
70
void
Sensor::operator=
(
const
Sensor
& org)
71
{
72
name
= org.
name
;
73
type
= org.
type
;
74
id
= org.
id
;
75
localR
= org.
localR
;
76
localPos
= org.
localPos
;
77
}
78
79
80
void
Sensor::destroy
(
Sensor
* sensor)
81
{
82
delete
sensor;
83
}
84
85
86
void
Sensor::clear
()
87
{
88
89
}
90
91
92
void
Sensor::putInformation
(std::ostream &os)
93
{
94
os <<
"name = "
<<
name
<<
", id = "
<<
id
<<
"\n"
;
95
os <<
"localAttitude = "
<<
localR
<<
", localPos = "
<<
localPos
<< std::endl;
96
}
97
98
99
ForceSensor::ForceSensor
()
100
{
101
type
=
FORCE
;
102
}
103
104
105
void
ForceSensor::clear
()
106
{
107
f
.setZero();
108
tau.setZero();
109
}
110
111
112
void
ForceSensor::putInformation
(std::ostream& os)
113
{
114
os <<
"Force Sensor\n"
;
115
Sensor::putInformation
(os);
116
os <<
"f = "
<<
f
<<
"tau = "
<< tau << std::endl;
117
}
118
119
120
RateGyroSensor::RateGyroSensor
()
121
{
122
type
=
RATE_GYRO
;
123
}
124
125
126
void
RateGyroSensor::clear
()
127
{
128
w
.setZero();
129
}
130
131
132
void
RateGyroSensor::putInformation
(std::ostream& os)
133
{
134
os <<
"Gyro\n"
;
135
Sensor::putInformation
(os);
136
os <<
"omega = "
<<
w
<< std::endl;
137
}
138
139
140
AccelSensor::AccelSensor
()
141
{
142
type
=
ACCELERATION
;
143
clear
();
144
}
145
146
147
void
AccelSensor::clear
()
148
{
149
dv(0) = 0.0;
150
dv(1) = 0.0;
151
dv(2) = 9.8;
152
}
153
154
155
void
AccelSensor::putInformation
(std::ostream& os)
156
{
157
os <<
"Acceleration Sensor\n"
;
158
Sensor::putInformation
(os);
159
os <<
"dv = "
<< dv << std::endl;
160
}
161
162
RangeSensor::RangeSensor
()
163
{
164
type
=
RANGE
;
165
scanAngle =
M_PI
;
166
scanStep = 0.1;
167
scanRate = 10;
168
maxDistance = 10;
169
nextUpdateTime = 0;
170
isUpdated =
false
;
171
isEnabled =
false
;
172
}
173
174
VisionSensor::VisionSensor
()
175
{
176
type
=
VISION
;
177
near = 0.01;
178
far = 10.0;
179
width
= 320;
180
height
= 240;
181
imageType = NONE;
182
frameRate = 30.0;
183
nextUpdateTime = 0;
184
isUpdated =
false
;
185
isEnabled =
false
;
186
}
hrp::Sensor::RANGE
Definition:
hrplib/hrpModel/Sensor.h:40
hrp::Sensor::destroy
static void destroy(Sensor *sensor)
Definition:
hrplib/hrpModel/Sensor.cpp:80
hrp::Sensor
Definition:
hrplib/hrpModel/Sensor.h:27
hrp::ForceSensor::putInformation
virtual void putInformation(std::ostream &os)
Definition:
hrplib/hrpModel/Sensor.cpp:112
hrp::Sensor::name
std::string name
Definition:
hrplib/hrpModel/Sensor.h:56
hrp::RateGyroSensor::putInformation
virtual void putInformation(std::ostream &os)
Definition:
hrplib/hrpModel/Sensor.cpp:132
hrp::Sensor::FORCE
Definition:
hrplib/hrpModel/Sensor.h:33
hrp::Sensor::PHOTO_INTERRUPTER
Definition:
hrplib/hrpModel/Sensor.h:37
hrp::AccelSensor::AccelSensor
AccelSensor()
Definition:
hrplib/hrpModel/Sensor.cpp:140
w
w
hrp::Sensor::~Sensor
virtual ~Sensor()
Definition:
hrplib/hrpModel/Sensor.cpp:64
hrp::Sensor::localR
Matrix33 localR
Definition:
hrplib/hrpModel/Sensor.h:60
hrp::Sensor::operator=
virtual void operator=(const Sensor &org)
Definition:
hrplib/hrpModel/Sensor.cpp:70
hrp::ForceSensor::ForceSensor
ForceSensor()
Definition:
hrplib/hrpModel/Sensor.cpp:99
width
png_infop png_uint_32 * width
Definition:
png.h:2309
hrp::RateGyroSensor::clear
virtual void clear()
Definition:
hrplib/hrpModel/Sensor.cpp:126
hrp::Sensor::PRESSURE
Definition:
hrplib/hrpModel/Sensor.h:36
hrp::ForceSensor
Definition:
hrplib/hrpModel/Sensor.h:68
hrp::Sensor::COMMON
Definition:
hrplib/hrpModel/Sensor.h:32
hrp::Sensor::clear
virtual void clear()
Definition:
hrplib/hrpModel/Sensor.cpp:86
hrp::ForceSensor::clear
virtual void clear()
Definition:
hrplib/hrpModel/Sensor.cpp:105
height
png_infop png_uint_32 png_uint_32 * height
Definition:
png.h:2309
hrp::Sensor::Sensor
Sensor()
Definition:
hrplib/hrpModel/Sensor.cpp:20
hrp::Sensor::localPos
Vector3 localPos
Definition:
hrplib/hrpModel/Sensor.h:61
hrp::Sensor::create
static Sensor * create(int type)
Definition:
hrplib/hrpModel/Sensor.cpp:26
hrp::Sensor::RATE_GYRO
Definition:
hrplib/hrpModel/Sensor.h:34
hrp
Definition:
ColdetModel.h:28
hrp::AccelSensor::clear
virtual void clear()
Definition:
hrplib/hrpModel/Sensor.cpp:147
M_PI
#define M_PI
Definition:
hrplib/hrpModel/Sensor.cpp:14
hrp::AccelSensor
Definition:
hrplib/hrpModel/Sensor.h:95
hrp::RangeSensor
Definition:
hrplib/hrpModel/Sensor.h:115
hrp::Sensor::type
int type
Definition:
hrplib/hrpModel/Sensor.h:57
hrp::Sensor::TORQUE
Definition:
hrplib/hrpModel/Sensor.h:39
hrp::AccelSensor::putInformation
virtual void putInformation(std::ostream &os)
Definition:
hrplib/hrpModel/Sensor.cpp:155
Sensor.h
swingTest.f
f
Definition:
swingTest.py:6
hrp::Sensor::putInformation
virtual void putInformation(std::ostream &os)
Definition:
hrplib/hrpModel/Sensor.cpp:92
hrp::RateGyroSensor::RateGyroSensor
RateGyroSensor()
Definition:
hrplib/hrpModel/Sensor.cpp:120
hrp::RateGyroSensor
Definition:
hrplib/hrpModel/Sensor.h:82
hrp::Sensor::VISION
Definition:
hrplib/hrpModel/Sensor.h:38
hrp::Sensor::id
int id
Definition:
hrplib/hrpModel/Sensor.h:58
hrp::VisionSensor
Definition:
hrplib/hrpModel/Sensor.h:135
hrp::VisionSensor::VisionSensor
VisionSensor()
Definition:
hrplib/hrpModel/Sensor.cpp:174
hrp::RangeSensor::RangeSensor
RangeSensor()
Definition:
hrplib/hrpModel/Sensor.cpp:162
hrp::Sensor::ACCELERATION
Definition:
hrplib/hrpModel/Sensor.h:35
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:25