ROS experience

ROS on raspberry pi There is a compiled image for RPi by ubiquity that has ROS kinetic: https://downloads.ubiquityrobotics.com/pi.html. It seems for me too old. It’s 2020, there are ubuntu 18, ros melodic and ros2, next year the support of python2.7 will be discontinued. Meh… It is possible to have ROS melodic on Raspberry Pi 3 B+. See in the next sections. Installing tensorflow for ROS on raspberry pi Alternatively one can try to install it from wheels: https://www....

August 24, 2019 · SergeM

Lenovo E490 memory upgrade

Lenovo e490 is a cheaper and less performant alternative to the famous T series. The laptop came to me with a deformed box but I decided to give it a try and so far so good. I have bought a basic version and upgraded RAM for it. Here are some photos about disassembly process. To open the case one hast to unscrew several screws and accurately open the flexible cover using some non-sharp tool (like guitar pick)....

July 16, 2019 · SergeM

Arduino Experiments

Arduino board Arduino Nano v2.3 manual (pdf) Arduino and shift register 74HC595 74HC595 Datasheet (pdf) 74HC595 Explanation Youtube tutorial with buttons: Tutorial with arduino - I was using that. My version on a breadboard: Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 //the pins we are using int latchPin = 2; int clockPin = 3; int dataPin = 4; void setup() { //set all the pins used to talk to the chip //as output pins so we can write to them pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void loop() { for (int i = 0; i < 16; i++) { //take the latchPin low so the LEDs don't change while we are writing data digitalWrite(latchPin, LOW); //shift out the bits shiftOut(dataPin, clockPin, MSBFIRST, i); //take the latch pin high so the pins reflect //the data we have sent digitalWrite(latchPin, HIGH); // pause before next value: delay(50); } } Alternatives More powerful shift register: TPIC6B595 PWM: TLC5940, TLC5947 PWM with i2c: PCA9685, PCA9635 PWM via shift register PWM Through a 74HC595 Shift Register at forum....

July 14, 2019 · SergeM

Computer vision libraries

So, what else is there except for opencv… CCV CCV website, github CCV 0.7 comes with a sub-10% image classifier, a decent face detector. It runs on Mac OSX, Linux, FreeBSD, Windows*, iPhone, iPad, Android, Raspberry Pi. In fact, anything that has a proper C compiler probably can run ccv. The majority (with notable exception of convolutional networks, which requires a BLAS library) of ccv will just work with no compilation flags or dependencies....

April 26, 2019 · SergeM

Postgres cheatsheet

Basics Connect as user postgres: 1 psql -U postgres Connect to a specific database: \c database_name; Quit the psql: \q List all databases: \l Lists all tables in the current database: \dt List all users: \du Create a new role username with a password: 1 CREATE ROLE username NOINHERIT LOGIN PASSWORD password; Managing tables Create a new table or a temporary table 1 2 3 4 5 6 7 CREATE [TEMP] TABLE [IF NOT EXISTS] table_name( pk SERIAL PRIMARY KEY, c1 type(size) NOT NULL, c2 type(size) NULL, ....

April 24, 2019 · SergeM

Jupyter notebooks on EMR

Explanatory data analysis requires interactive code execution. In case of spark and emr it is very convenient to run the code from jupyter notebooks on a remote cluster. EMR allows installing jupyter on the spark master. In order to do that configure "Applications" field for the emr cluster to contain also jupyter hub. For example: "Applications": [ { "Name": "Ganglia", "Version": "3.7.2" }, { "Name": "Spark", "Version": "2.4.0" }, { "Name": "Zeppelin", "Version": "0....

February 4, 2019 · SergeM

Spark on a local machine

How to install spark locally Considering spark without hadoop built-in. Download hadoop unpack to /opt/hadoop/ Download spark without hadoop, unpack to /opt/spark Install java. Set JAVA_HOVE environment variable. For example: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 create environment variables required for spark to run. One can put those in .bashrc export HADOOP_HOME=/opt/hadoop export SPARK_DIST_CLASSPATH=$HADOOP_HOME/etc/hadoop/*:$HADOOP_HOME/share/hadoop/common/lib/*:$HADOOP_HOME/share/hadoop/common/*:$HADOOP_HOME/share/hadoop/hdfs/*:$HADOOP_HOME/share/hadoop/hdfs/lib/*:$HADOOP_HOME/share/hadoop/hdfs/*:$HADOOP_HOME/share/hadoop/yarn/lib/*:$HADOOP_HOME/share/hadoop/yarn/*:$HADOOP_HOME/share/hadoop/mapreduce/lib/*:$HADOOP_HOME/share/hadoop/mapreduce/*:$HADOOP_HOME/share/hadoop/tools/lib/* Now you can run pyspark for example: $ /opt/spark/bin/pyspark Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information....

January 30, 2019 · SergeM

GPIO controls for Rasbperry Pi

Libraries for GPIO Node JS Python Using RPi.GPIO How to Exit GPIO programs cleanly, avoid warnings and protect your Pi Setting up RPi.GPIO, numbering systems and inputs On using hardware PWM without sudo due to permissions for /dev/gpiomem: discussion General pigpio The library also provides a service. It can be useful if you don’t want to give root access to the client applications and want to control PWM for example....

September 23, 2018 · SergeM

Reducing disk usage in Ubuntu

Here are some recipies to make ubuntu installed on USB drive to work faster. [1] [2] reducing swapping Add these lines to /etc/sysctl.conf, and reboot. vm.swappiness = 0 vm.dirty_background_ratio = 20 vm.dirty_expire_centisecs = 0 vm.dirty_ratio = 80 vm.dirty_writeback_centisecs = 0 More caching while writting on disk Add noatime,commit=120,… to /etc/fstab entries for / and /home

August 16, 2018 · SergeM

Spark in Docker with AWS credentials

Running spark in docker container Setting up spark is tricky. Therefore it is useful to try out things locally before deploying to the cluster. Docker is of a good help here. There is a great docker image to play with spark locally. gettyimages/docker-spark Examples Running SparkPi sample program (one of the examples from the docs of Spark): docker run --rm -it -p 4040:4040 gettyimages/spark bin/run-example SparkPi 10 Running a small example with Pyspark:...

July 29, 2018 · SergeM