sensor
LidarSensor
#
Bases: Sensor
Specialized LIDAR sensor.
Its impact entity is represented by a small blue sphere.
Source code in cogip/entities/sensor.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
__init__(asset_entity, name, origin_x, origin_y, direction_x, direction_y)
#
Class constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset_entity |
AssetEntity
|
Entity containing the sensor |
required |
name |
str
|
Name of the sensor |
required |
origin_x |
int
|
X origin of the ray caster |
required |
origin_y |
int
|
Y origin of the ray caster |
required |
direction_x |
int
|
X direction of the ray caster |
required |
direction_y |
int
|
Y direction of the ray caster |
required |
Source code in cogip/entities/sensor.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
Sensor
#
Bases: QObject
Base class for all sensors.
The sensors are based on QRayCaster. It casts a ray and detects collisions with obstacles. Detected collision is represented using a ImpactEntity object.
Attributes:
Name | Type | Description |
---|---|---|
obstacles |
list[QEntity]
|
Class attribute recording all entities that should be detected |
all_sensors |
list[Sensor]
|
Class attribute recording all sensors |
hit |
QRayCasterHit | None
|
Last hit of this sensor |
Source code in cogip/entities/sensor.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
distance: int
property
#
Last sensor hit distance if any.
__init__(asset_entity, name, origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, impact_radius=50, impact_color=QtCore.Qt.red)
#
Class constructor.
Origin and direction are relative to the parent entity (the robot).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset_entity |
AssetEntity
|
Entity containing the sensor |
required |
name |
str
|
Name of the sensor |
required |
origin_x |
int
|
X origin of the ray caster |
required |
origin_y |
int
|
Y origin of the ray caster |
required |
origin_z |
int
|
Z origin of the ray caster |
required |
direction_x |
int
|
X direction of the ray caster |
required |
direction_y |
int
|
Y direction of the ray caster |
required |
direction_z |
int
|
Z direction of the ray caster |
required |
impact_radius |
float
|
Radius of the |
50
|
impact_color |
GlobalColor
|
Color of the |
red
|
Source code in cogip/entities/sensor.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
add_obstacle(obstacle)
classmethod
#
Class method.
Register an obstacle added on the table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obstacle |
QEntity
|
The obstacle to register |
required |
Source code in cogip/entities/sensor.py
113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
add_obstacle_layer(obstacle)
#
Add the obstacle layer to the ray caster. This allows the obstacle to be detected by the ray caster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obstacle |
QEntity
|
The obstacle to detect |
required |
Source code in cogip/entities/sensor.py
127 128 129 130 131 132 133 134 135 136 137 |
|
update_hit()
#
Qt Slot
Compute the distance with the closest detected obstacle.
Source code in cogip/entities/sensor.py
89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
update_impact()
#
Display the impact entity at the collision point.
Source code in cogip/entities/sensor.py
103 104 105 106 107 108 109 110 111 |
|
ToFSensor
#
Bases: Sensor
Specialized ToF sensor.
It is represented by a small red cube placed at the origin of the ray caster.
Its impact entity is represented by a small red sphere.
Source code in cogip/entities/sensor.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
__init__(asset_entity, name, origin_x, origin_y)
#
Class constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset_entity |
AssetEntity
|
Entity containing the sensor |
required |
name |
str
|
Name of the sensor |
required |
origin_x |
int
|
X origin of the ray caster |
required |
origin_y |
int
|
Y origin of the ray caster |
required |
Source code in cogip/entities/sensor.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|