nav_algo.SailSensors module¶
-
class
nav_algo.SailSensors.ADCDevice(pinNumber)¶ Bases:
objectThis class contains the object of the ADC to be used by other classes for analog devices.
-
readADC(gain=1)¶ This function reads the ADC present on the I2C bus.
- Parameters
gain (int) – The gain of the sensor input.
-
-
class
nav_algo.SailSensors.I2CDevice(deviceAddress, i2cBusIndex)¶ Bases:
objectThis class is used to create a new instance of an I2C sensor module for communication. It also contains functions to communicate with the module.
-
getDeviceAddress()¶
-
getName()¶
-
geti2cBus()¶
-
geti2cBusIndex()¶
-
i2cRdwr(send, recieve)¶ Sends a hexadecimal-command list to the desired component. The function then waits for and retrieves a response from the device with a length based on the parameters.
- Parameters
send (list) – a list of bytes (sends this list of hexadecimal commands).
recieve (int) – the amount of bytes in a list to retrieve from the device.
- Returns
a list of bytes with length of int recieve.
- Return type
list
-
i2cWr(msg)¶ Sends a hexadecimal list to the desired component.
- Parameters
msg (list) – list of bytes (needs to be a list of hexadecimal commands specific to the device).
-
readBlockData(byteNumber, offset=0)¶ Reads a block of data from the i2c device register.
- Parameters
bytenumber (int) – the number of bytes you would like to read from the device’s register.
offset (int) – integer value for the byte offset of data collection from the register.
-
writeBlockData(msg, offset=0)¶ Writes a block of data from the i2c device register.
- Parameters
msg (list) – list of bytes to send.
offset (int) – integer value for the byte offset of data collection from the register.
-
-
class
nav_algo.SailSensors.SailAnemometer(pinNumber)¶ Bases:
nav_algo.SailSensors.ADCDeviceSailAnemometer implements a class used to connect the component to it’s proper communication protocol. This class also implements functions to return raw data and turn on/off the sensors.
-
readAnemometerVoltage(gain=1)¶ Returns the given voltage of the anemometer using the ADC.
- Parameters
gain (int) – the multiplication value of the voltage
-
-
class
nav_algo.SailSensors.SailEncoder¶ Bases:
objectSailEncoder implements a class used to connect the component to it’s proper communication protocol. This class also implements functions to return raw data and turn on/off the sensors.
-
class
nav_algo.SailSensors.SailGPS¶ Bases:
objectSailGPS implements a class used to connect the component to it’s proper communication protocol. This class also implements functions to return raw data and turn on/off the sensors.
-
class
nav_algo.SailSensors.SailIMU(deviceAddress=119, i2cBusIndex=1)¶ Bases:
nav_algo.SailSensors.I2CDeviceSailIMU implements a class used to connect the component to it’s proper communication protocol. This class also implements functions to return raw data and turn on/off the sensors.
-
i2c_read_imu()¶ Reads the IMU and returns a list of 12 bytes representing euler angles.
-
imuCommands= {'readAccelerometerRaw': 66, 'readCompassRaw': 67, 'readOrientationEuler': 1}¶
-