sabato 12 giugno 2021

ANN leg tilting classification, finally this seems to work :)

                                         https://www.youtube.com/watch?v=rep5edOnzvU

How it works: a Spring Boot PI4J and Weka based java application running on a Raspberry PI3 allows reading the 12 accelerometers on the legs junctions, plus the 4 buttons on the feet. An additional accelerometer on the head of the spider provides unique head 3 axis acceleration. The artificial neural networks, read all of the sensors values and upon a trained model "classify" data to provide a feedback on which one is the tilted leg. Upon this, the system can decide how to try to rebalance, then perform another classification and try to rebalance, until the spider is "flattened" horizontally. 


Next step will be to implement the read-classify-balance process mentioned above and interface the LIDAR set under the spider.


The classifier used that is a multi layer perceptron:



arff format used:

% 1. Title: Tss balance condition
% 2. Sources:
%      (a) tss arff generation routine
%

@RELATION tssbalance

@ATTRIBUTE LEG_SEG_ACC_A_0_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_A_0_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_A_1_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_A_1_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_A_2_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_A_2_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_9_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_9_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_10_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_10_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_11_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_B_11_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_6_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_6_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_7_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_7_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_8_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_C_8_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_3_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_3_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_4_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_4_Y NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_5_X NUMERIC
@ATTRIBUTE LEG_SEG_ACC_D_5_Y NUMERIC
@ATTRIBUTE FOOT_A0 {0, 1}
@ATTRIBUTE FOOT_B9 {0, 1}
@ATTRIBUTE FOOT_C6 {0, 1}
@ATTRIBUTE FOOT_D3 {0, 1}
@ATTRIBUTE HEAD_ACC_X NUMERIC
@ATTRIBUTE HEAD_ACC_Y NUMERIC
@ATTRIBUTE HEAD_ACC_Z NUMERIC
@ATTRIBUTE CLASS {LEG_A,LEG_B,LEG_C, LEG_D, NONE}

@DATA
To populate this data section some leg-named REST endpoints have been implemented that tilt a specific leg and save a leg tilted specific arff file. The merge of all these 5 files (LEG_ALEG_B, LEG_C, LEG_D, NONE) makes the training alle-legs arff file used to train the model.

giovedì 4 febbraio 2021

mercoledì 6 gennaio 2021

Tss training dataset for Weka ann, single files, one for each tilted leg (A,B,C,D) and one for no leg tilted (NONE):

tss_training_dataset_LEG_A_1609957235461.arff

tss_training_dataset_LEG_B_1609957257019.arff

tss_training_dataset_LEG_C_1609957278586.arff

tss_training_dataset_LEG_D_1609957300163.arff

tss_training_dataset_NONE_1609957213880.arff


and merged arff file:


tss_training_dataset_LEGS.arff


REST endpoint to generate all ARFF for the ann:

http://raspberry:8080/resources/ann/arff/all


All files are available on git repo.






Connecting the Slamtech A1M8 RPLIDAR to the Raspberry, Raspbian

dmesg

 


lsusb



Lidar is rotating and no power consumption issue detected on dmesg so far.




domenica 3 gennaio 2021

 Checking USB devices:


USB devices they should show up with lsusb and/or usb-devices when (physically) connected to the Pi. With nothing connected to the USB ports, you get as output:




domenica 6 dicembre 2020

 Mechanics completed, via REST endpoints the pi4j Spring Boot implementation executes simple commands, like stand up and tilt on each leg.







Current consumption calculation for PI GPIO:

10mA Raspberry PI servo hat

12 x 350µA for adxl 335 accelerometers 8400 µA 0 4,2 milli Ampere


The operating voltage of the GPIO pins is 3.3v with a maximum current draw of 16mA