Sensors
Generic Sensor
GenericSensor
Source code in software/sailowtech_ctd/sensors/generic.py
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 |
|
__init__(brand, sensor_type, name, address, min_delay, metric_type)
Initialisation of a generic sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
brand
|
SensorBrand
|
Brand of the sensor |
required |
sensor_type
|
Sensor
|
Type of the sensor |
required |
name
|
str
|
Name of the sensor |
required |
address
|
int
|
Address of the sensor |
required |
min_delay
|
float
|
Minimum delay of the sensor required for measuring |
required |
Source code in software/sailowtech_ctd/sensors/generic.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
SensorBrand
Bases: Enum
The different brands of the sensors. Some brands have their own protocols, which is why we group them together.
Source code in software/sailowtech_ctd/sensors/generic.py
8 9 10 11 12 13 14 |
|
Mock Sensor
MockSensor
Bases: GenericSensor
Class which provides a mock sensor in order to be able to test the interface
Source code in software/sailowtech_ctd/sensors/mocksensor.py
8 9 10 11 12 13 14 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 |
|
__init__(brand, sensor_type, name, address, min_val, max_val, min_delay, metric_type)
Initialise the mock sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
brand
|
SensorBrand
|
Brand of the sensor (mock_sensor) |
required |
sensor_type
|
Sensor
|
Type of the sensor (mock_sensor) |
required |
name
|
str
|
The given name for this sensor |
required |
address
|
int
|
The address assigned to this sensor (is ignored) |
required |
min_val
|
int
|
The minimum value that the mock sensor is returning |
required |
max_val
|
int
|
The maximum value that the mock sensor is returning |
required |
Source code in software/sailowtech_ctd/sensors/mocksensor.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
init(bus)
Initialises the mock sensor. Always returns true since no setup is required
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
The bus to be used - is ignored |
required |
Returns:
Type | Description |
---|---|
Returns True |
Source code in software/sailowtech_ctd/sensors/mocksensor.py
27 28 29 30 31 32 33 |
|
measure_value(bus)
Measure the value of the mock sensor. Returns a random value between the minimum and maximum set during class instantiation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
The bus to be used - is ignored |
required |
Returns:
Type | Description |
---|---|
Returns the randomly generated simulated measurement |
Source code in software/sailowtech_ctd/sensors/mocksensor.py
51 52 53 54 55 56 57 |
|
read_result(bus)
Method to read the measurement result
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
The bus to be used - is ignored |
required |
Returns:
Type | Description |
---|---|
float
|
Returns the measured value |
Source code in software/sailowtech_ctd/sensors/mocksensor.py
43 44 45 46 47 48 49 |
|
write_read_command(bus)
Method to write the read command to the sensor - is ignored
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
The bus to be used - is ignored |
required |
Returns:
Type | Description |
---|---|
bool
|
Returns True |
Source code in software/sailowtech_ctd/sensors/mocksensor.py
35 36 37 38 39 40 41 |
|
Atlas Sensor
AtlasSensor
Bases: GenericSensor
Class which can be used for all (supported) Atlas Scientific sensors
Source code in software/sailowtech_ctd/sensors/atlas.py
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 |
|
__init__(sensor, name, address, min_delay)
Initialise Atlas Scientific sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sensor
|
Sensor
|
Type of the sensor |
required |
name
|
str
|
Name of the sensor |
required |
address
|
int
|
I2C-address of the sensor |
required |
min_delay
|
float
|
Minimum delay between write / read required for proper functioning |
required |
Source code in software/sailowtech_ctd/sensors/atlas.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
calibrate(bus)
Calibrate the sensor. Currently, does not do anything
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
SMBus object |
required |
Returns:
Type | Description |
---|---|
Returns nothing |
Source code in software/sailowtech_ctd/sensors/atlas.py
51 52 53 54 55 56 57 |
|
init(bus)
Initialises the sensor. Currently, does not do anything
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
SMBus object |
required |
Returns:
Type | Description |
---|---|
None
|
Returns nothing |
Source code in software/sailowtech_ctd/sensors/atlas.py
43 44 45 46 47 48 49 |
|
read_result(bus=None)
Read the measured value from device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
Bus device. Not required |
None
|
Returns:
Type | Description |
---|---|
float
|
Returns true after sending read command |
Source code in software/sailowtech_ctd/sensors/atlas.py
68 69 70 71 72 73 74 75 76 77 78 79 |
|
write_read_command(bus=None)
Write a read command to the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
Bus device. Not required |
None
|
Returns:
Type | Description |
---|---|
bool
|
Returns true after sending read command |
Source code in software/sailowtech_ctd/sensors/atlas.py
59 60 61 62 63 64 65 66 |
|
handle_raspi_glitch(response)
Change MSB to 0 for all received characters except the first and get a list of characters NOTE: having to change the MSB to 0 is a glitch in the raspberry pi, and you shouldn't have to do this!
Source code in software/sailowtech_ctd/sensors/atlas.py
12 13 14 15 16 17 18 19 |
|
Bluerobotics Sensor
BlueRoboticsSensor
Bases: GenericSensor
Base for a Bluerobotics sensor
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
8 9 10 11 12 13 |
|
DepthSensor
Bases: BlueRoboticsSensor
Class for a depth sensor by Bluerobotics
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
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 149 150 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 212 213 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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
__init__(name, address=DEFAULT_ADDRESS, min_delay=1)
Initialise the class of the depth sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the sensor |
required |
address
|
int
|
I2C-Address of the sensor |
DEFAULT_ADDRESS
|
min_delay
|
float
|
Required minimum delay |
1
|
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
_crc4(n_prom)
Checksum function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_prom
|
? |
required |
Returns:
Type | Description |
---|---|
Checksum |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
altitude()
Altitude relative to MSL pressure
Returns:
Type | Description |
---|---|
float
|
Altitude relative to MSL pressure |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
196 197 198 199 200 201 |
|
depth()
Depth relative to MSL pressure in given fluid density
Returns:
Type | Description |
---|---|
float
|
Returns depth |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
188 189 190 191 192 193 |
|
init(bus)
Initialise the device of the depth sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
SMBus over which the device can be reached |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
measure_value(bus)
Measures the different values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
SMBus over which the device can be reached |
required |
Returns:
Type | Description |
---|---|
float
|
Returns the different values |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
108 109 110 111 112 113 114 115 116 |
|
pressure(conversion=UNITS_mbar)
Get the pressure in the requested unit. Defaults to mBar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conversion
|
The unit conversion which should be used to return the value |
UNITS_mbar
|
Returns:
Type | Description |
---|---|
float
|
Returns the pressure measured |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
165 166 167 168 169 170 171 |
|
read(bus, oversampling=OSR_8192)
Take a reading of the sensor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus
|
SMBus
|
SMBus over which the device can be reached |
required |
oversampling
|
Oversampling attribute |
OSR_8192
|
Returns:
Type | Description |
---|---|
bool
|
True if successful |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
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 149 150 151 152 153 154 155 |
|
set_fluid_density(density)
Set the fluid density of the water
Parameters:
Name | Type | Description | Default |
---|---|---|---|
density
|
Density to be set |
required |
Returns:
Type | Description |
---|---|
None |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
157 158 159 160 161 162 163 |
|
temperature(conversion=UNITS_Centigrade)
Temperature in requested units. Default in degrees Celsius
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conversion
|
The conversion to be applied |
UNITS_Centigrade
|
Returns:
Type | Description |
---|---|
float
|
Returns the temperature in requested unit |
Source code in software/sailowtech_ctd/sensors/bluerobotics.py
174 175 176 177 178 179 180 181 182 183 184 185 |
|
Types
Sensor
Bases: StrEnum
Types of all the available sensors. Can then be used in other parts of the software, for example in the config file parsing.
Source code in software/sailowtech_ctd/sensors/types.py
4 5 6 7 8 9 10 11 12 |
|