roboskin.sensor package

Submodules

roboskin.sensor.adxl335 module

roboskin.sensor.flexiforce module

roboskin.sensor.lsm6ds3 module

This code is heavily inspired by this wonderful GitHub repo: https://github.com/CRImier/python-lsm6ds3 Thanks Homie! Datasheet Link: https://cdn.sparkfun.com/assets/learn_tutorials/4/1/6/DM00133076.pdf

class roboskin.sensor.lsm6ds3.LSM6DS3_IMU(raspi_bus_number=1, i2c_address='0x6b')[source]

Bases: roboskin.sensor.sensor.Sensor

This is the Python Class for LSM6DS3. This includes all subroutines including calibration to handle everything related to the device.

calibrate()[source]

# Need to implement this function

Returns

Return type

None

get_bus_number()[source]
get_i2c_address()[source]
is_lsm6ds3()[source]

This function will detect if the accelerometer is LSM6DS3 or not

Returns

True if the detected accelerometer is LSM6DS3, otherwise false

Return type

Bool

read()[source]

Reads the sensor values and continuously streams them back to the function whoever called it. This is the function you need to put while(True) loop for continuous acquisition of accelerometer values. :returns: List of floats with Acceleration values and angular velocity values in G in the form of

[ax, ay, az, gx, gy, gz] respective directions

Return type

list

read_raw()[source]
read_raw_accelX()[source]

Read a raw acceleration value for x axis

Returns

accelX

Return type

float

read_raw_accelY()[source]

Read a raw acceleration value for y axis

Returns

accelY

Return type

float

read_raw_accelZ()[source]

Read a raw acceleration value for z axis

Returns

accelZ

Return type

float

read_raw_accels()[source]

Read raw acceleration values for all axis

Returns

accels

Return type

List[float]

read_raw_gyroX()[source]

Read a raw angular velocity value for x axis

Returns

gyroX

Return type

float

read_raw_gyroY()[source]

Read a raw angular velocity value for y axis

Returns

gyroY

Return type

float

read_raw_gyroZ()[source]

Read a raw angular velocity value for z axis

Returns

gyroZ

Return type

float

read_raw_gyros()[source]

Read raw angular velocity values for all axis

Returns

gyros

Return type

List[float]

roboskin.sensor.sensor module

Generic Sensor Module

class roboskin.sensor.sensor.Sensor[source]

Bases: object

Sensor Class

calibrate()[source]

Calibrate the sensor

read()[source]

Fetch sensor data

roboskin.sensor.utils module

roboskin.sensor.utils.make_16bit_value(vh, vl)[source]

The acceleration is usually from 2 Byte sized registers. We obtain acceleration value in 2’s complement form So first we obtain both MSByte as well as LSByte, combine them both, and convert them into 2’s complement form :param vh: The MSByte :type vh: int :param vl: The LSByte :type vl: int

Returns

Acceleration Value in G

Return type

float

roboskin.sensor.utils.twos_comp(val, num_of_bits)[source]

compute the 2’s complement of int value val. Reference: https://en.wikipedia.org/wiki/Two%27s_complement :param val: The original value, which we have to convert to 2’s complement :type val: int :param num_of_bits: # of bits, this is particularly important because if you don’t know bit size, you dont what’s the

MS Bit, and entire thing can go wrong. Fortunately our both Accelerometer registers combined are of 16 bit length. So that’s what we will pass

Returns

Two’s complement value of passed value

Return type

int

roboskin.sensor.vl53l1x module

This is a python class for VL53L1X Proximity Sensor Datasheet Link: https://www.st.com/resource/en/datasheet/vl53l1x.pdf This library heavily uses VL53L1X pip application: pip install VL53L1X

class roboskin.sensor.vl53l1x.VL53L1X_ProximitySensor(raspi_bus_number=1, i2c_address=41, range_value=0, timing_budget=33000, inter_measurement_period=33)[source]

Bases: roboskin.sensor.sensor.Sensor

Code for VL53L1X distance sensor class.

calibrate()[source]

This is the calibration function. # TODO: Decide whether you have to implement it or not :returns: :rtype: None

initialize(range_value, timing_budget, inter_measurement_period)[source]
read()[source]

Reads the sensor values and continuously streams them back to the function whoever called it. This is the function you need to put while(True) loop for continuous acquisition of accelerometer values. :returns: Continuous stream of floats from the proximity sensor :rtype: float

read_raw()[source]

This is a function which reads the raw values from the sensor, and gives them back to you, unchanged

Returns

Raw sensor reading from the proximity sensor

Return type

float

stop()[source]

Stop VL53L1X ToF Sensor Ranging

Module contents

Init for our Sensors.