Awesome dotfiles Awesome

Table of contents:

MAY CONTAIN BIOHAZARDS, VIRUSES, BUGS AND BLACK HOLES!

Linux Cookbook and best practises:

mps-youtube

sudo pip3 install -U git+https://github.com/mps-youtube/mps-youtube.git
sudo pip3 install youtube-dl

Troubleshooting:

Franz:

Download Franz, the all-in-one messenger, extract and you are good to go!

Installation Tweaks:

MATLAB:

Before installing any MATLAB toolbox on an already installed MATLAB, do:

sudo chmod -R ugo+rw /usr/local/MATLAB
sudo chown -R $USER /usr/local/MATLAB

Git setup:

  1. sudo apt-get install git-all
  2. Create a repository from your browser.
  3. Edit git config:
    git config --global user.name "chahatdeep"
    git config --global user.email chahatdeepsingh@gmail.com
    git config --global core.editor emacs
    

    Check your configuration, do git config --list

  4. Git clone your repository, do git clone htttp://github.com/chahatdeep/<repo_name>

  5. cd

  6. shell-script && git init

  7. Copy all the files you want to move to the repo.

  8. In the repo, do git add *

  9. git add LICENSE (Optional)

  10. git commit -m 'initial project version'

  11. git push

sudo apt-get purge rtl8812au-dkms
sudo apt-get update
sudo apt-get install git dkms
git clone  https://github.com/ptpt52/rtl8812au.git
cd rtl8812au
sudo make -f Makefile.dkms install
sudo modprobe rtl8812au

Note: Make sure the security boot is disabled. Disable Secure Boot (UEFI) in the BIOS!! ***

Appearance:

For Gnome-Terminal Solarized Color Schemes, follow this

lxapperance will do it for you! You also want QT, GTK 2.0, and GTK+ to look the same as your chosen theme.

sudo apt-get install lxappearance gtk-chtheme qt4-qtconfig

Now, open the apperance setting using lxapperance from the terminal. Check if you have any dark theme available! If not, try one of theme from this link. Or simply try one of these:

  1. Adapta:
    sudo apt-add-repository ppa:tista/adapta -y
    sudo apt-get update
    sudo apt-get install adapta-gtk-theme 
    
  2. Numix:
    sudo add-apt-repository ppa:numix/ppa  
    sudo apt update  
    sudo apt install numix-gtk-theme 
    
  3. Vertex:
    sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' >> /etc/apt/sources.list.d/vertex-theme.list"  
    sudo apt update  
    sudo apt install vertex-theme  
    
  4. Arc: (Probably the best available)
    sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' >> /etc/apt/sources.list.d/arc-theme.list"  
    sudo apt update  
    sudo apt install arc-theme  
    

    and set the desired theme using lxapperance from the terminal. ***

nm-applet:

sudo apt-get install nm-applet

and add: exec --no-startup-id nm-applet to your i3 config file. Now, open lxapperance from your console and tweak the window properties that suits best for you :)

A simple Notification Utility dunst

This is a simple notification utility. It isn’t absolutely required to get i3 working, but if you don’t install it then you won’t get notification about things like wireless network status. ***

Mailnag notifier:

For debian based systems:
sudo add-apt-repository ppa:pulb/mailnag
sudo apt-get update
sudo apt-get install mailnag
For Arch Linux:

Either run yaourt -S mailnag or packer -S mailnag (as root) to install the package. Mailnag is available in the AUR repository. Desktop Integration Plugins:

Reference ***

Google Chrome:

Emacs setup:

After copying the .emacs.d folder and .emacs config file to ~/, follow the following steps:

sudo apt-get install emacs24
sudo apt-get install build-essential

Download emacs24.4 source code from here, then cd to the emacs source directory or do download emacs24.4 directly.

Reference ***

Slack:

sudo apt-add-repository -y ppa:rael-gc/scudcloud
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt update
sudo apt install scudcloud

Also, Aliasing scudCloud as slack will be handy! Do:

echo "alias slack='scudcloud'" >> ~/.bashrc

Reference

For Arch Linux:

There is a PKGBUILD available on the Arch User Repository. You can install it using whichever AUR method you use. For instance, if you use cower:

cower -d scudcloud
cd scudcloud
makepkg -si

Avant Window Navigator:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install --install-recommends avant-window-navigator

if Avant Window Navigator crashes the first time you run it, use the following command to restart gconfd-2:

killall gconfd-2

Then, use Synaptic Package Manager to install the AWN applets you want to use (simply search for “awn applet” and you should get a complete list of applets).

Or, to install all the available applets (except the DockBarX AWN applet, which is not part of AWN), use the following command:

sudo apt install --no-install-recommends awn-applets-all

I used “–install-recommends” for the AWN package because on Linux Mint, recommended packages are not installed by default, and that would result in awn-settings package (among a few others) not being installed. For the awn-applets-all, I used “–no-install-recommends” to prevent it from installing Unity Control Center and other Unity / GNOME Flashback packages along with the AWN applets in Xubuntu, Ubuntu MATE, etc (this is not the case for Linux Mint). Here is the reference link.


Git GUI Application for Linux:

Apart from gitkraken, rabbitvcs is an amazing app which comes with an integration of nautilus. Add ppa:

sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-get update
sudo apt-get install rabbitvcs-nautilus rabbitvcs-cli

Note: If you are using nautilus3 instead of nautilus, do sudo apt-get install rabbitvcs-nautilus3 Reference ***

Handy-Stuff:

  1. Setup your sources.list
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
    
Note: If you are using Mint, $(lsb_release -sc) will output something like serena or some other name linked to your version of Linux Mint. So, to install ROS in Mint, try:
  1. Set up your keys
    sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
    
  2. Installation Make sure your packages are up to date:
    sudo apt-get update
    
    • If you are using Ubuntu Trusty 14.04.2 and experience dependency issues during the ROS installation, you may have to install some additional system dependencies. Do not install these packages if you are using 14.04, it will destroy your X server:
      sudo apt-get install xserver-xorg-dev-lts-utopic mesa-common-dev-lts-utopic libxatracker-dev-lts-utopic libopenvg1-mesa-dev-lts-utopic libgles2-mesa-dev-lts-utopic libgles1-mesa-dev-lts-utopic libgl1-mesa-dev-lts-utopic libgbm-dev-lts-utopic libegl1-mesa-dev-lts-utopic
      
    • Do not install the above packages if you are using 14.04, it will destroy your X server
    • Alternatively, try installing just this to fix dependency issues:
      sudo apt-get install libgl1-mesa-dev-lts-utopic
      
  1. Initialize rosdep:
    sudo rosdep init
    rosdep update
    
  2. Environment setup
    • Adding ROS environment variables to your bash session: echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc or for kinetic: echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
      source ~/.bashrc
      
  3. Getting rosinstall:
    • It enables you to easily download many source trees for ROS packages with one command:
sudo apt-get install python-rosinstall
  1. See the next section for ROS turorials. Enjoy!

*All credits to ROS community and their Installation Guidlines.


ROS Tutorials (for you!):

Important: I highly recommend installing Catkin Tools before moving forward!

  1. Configuring ROS Environment: (Make sure you did Point 6 of last section) A good way to check is to ensure that environment variables like ROS_ROOT and ROS_PACKAGE_PATH are set:
    printenv | grep ROS
    

    You should get something like this:

    ROS_ROOT=/opt/ros/kinetic/share/ros
    ROS_PACKAGE_PATH=/opt/ros/kinetic/share
    ROS_MASTER_URI=http://192.168.1.1:11311
    ROS_HOSTNAME=
    ROSLISP_PACKAGE_DIRECTORIES=
    ROS_DISTRO=kinetic
    ROS_IP=
    ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
    

    If you don’t, restart the terminal or open a new terminal window. If it still doesn’t work, do:

    echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
    
  2. Creating ROS Workspace: Creating a ROS Workspace is simple.
    mkdir -p ~/catkin_ws/src
    cd ~/catkin_ws/src
    

Snapdragon Flight:

For this manual the host operating system is assumed to be Ubuntu 16.04

  1. Set up the host platform:
    1. Install ROS
    2. Add the following lines to your ~/.bashrc:

       export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
       #export ROS_IP=192.168.1.96
       export ROS_IP=$(ifconfig | grep -Po '(?<=inet addr:)192.168.1[.0-9]+' )
       export ROS_HOSTNAME=$ROS_IP
       export ROS_MASTER_URI=http://192.168.1.1:11311
      

      Note: for the ROS_IP variable you can hardcode the ip address, but it can change, that is why the regexp is used.

    3. Install ADB
       sudo apt-get install android-tools-adb android-tools-fastboot
      
  2. Configure the drone:
    1. Make sure ADB works: connect your platform with a micro usb cable and type in console:
       adb devices
      

      The output will be:

       * daemon not running. starting it now on port 5037 *
       * daemon started successfully *
       List of devices attached 
       1daf9fb4   device
      

      Now, in order to connect to platform type adb shell

      Note: DO NOT use USB 3.0 (10 pin) cable (it does not work)! Use a standard type A to micro B usb cable one instead. If you see an error message ‘Unable to mount Android’ - that is OK.

      • 10 pin USB 3.0 (Don’t use)

      • Use Standard Type A to Micro B

    2. Connect via SSH:
      • Connect to the drone’s wi-fi network Atlanticus_XXXXX. To check your Snapdragon’s Wifi-ssid and passphrase, do vim /etc/hostapd.conf. Once you are connected to the Snapdragon’s AP network, do:
          ssh linaro@192.168.1.1
        
          The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
          ECDSA key fingerprint is SHA256:ckKLZj8FB9OoekLIEmwPNfXi21S3EY96YrBm3hzB6sA.
          Are you sure you want to continue connecting (yes/no)? yes
          Warning: Permanently added '192.168.1.1' (ECDSA) to the list of known hosts.
          linaro@192.168.1.1's password: 
        

        The password is ‘linaro

      • Set root password:
          passwd root
          <enter new UNIX password>
        

        Set it to ‘mathematical

      • Login as root:
          su
        
    3. Add the following lines to your /root/.bashrc:
       export HOME=/root
       cd $HOME
      
       export MV_SDK=/opt/qualcomm/mv/lib/mv
       source /opt/ros/indigo/setup.bash
       export ROS_IP=192.168.1.1
       export ROS_HOSTNAME=$ROS_IP
       export ROS_MASTER_URI=http://$ROS_HOSTNAME:11311
      
    4. Configure the Wi-Fi:
      • Configure the station mode by editing the /etc/wpa_supplicant/wpa_supplicant.conf: Configure one of the network sections (make sure only one network section is uncommented):

          network={
                   ssid="Land of Ooo"
                   proto=RSN
                   key_mgmt=WPA-PSKa
        

        This configuration is for the Land of Ooo router. For different networks edit accordingly.

      • You can change SSID for the access point mode in /etc/hostapd.conf

    5. Learn how to switch between Wi-Fi modes:
      • Access point (by default; Used for connecting directly to Ground Station Server; No internet Connection):
         /usr/local/qr-linux/wificonfig.sh -s softap
        
      • Station mode (connect to router):
         /usr/local/qr-linux/wificonfig.sh -s station
        

        After this you will need to reboot:

         reboot
        

        IMPORTANT: After you are connected to the internet, ping 8.8.8.8. If for some reason, you are unable to reach the www server, try the following:

      • Check if your wlan0 is on/off. Do:
         ip link show wlan0
         wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether 00:03:7f:17:93:43 brd ff:ff:ff:ff:ff:ff
        

        If you get DOWN in wlan0: <NO_CARRIER,BROADCAST,MULTICAST,DOWN> then you need to turn on your wireless network. Don’t worry, the DOWN in pfifo_fast state DOWN doesn’t matter. To turn on the wireless device, do:

       sudo ip link set wlan0 up
      

      and check ip link show wlan0 again. Note: The name of your wireless device is generally wlan0. It can be anything else like: wlp0s3. Check iwconfig for the network name.

      • Try connecting to a no-key wifi server. Create a hotspot from you Mobile device, say: BlackTrojan ($SSID). Now,
         sudo iwconfig wlan0 essid $SSID # it sets the essid properly now
         sudo dhclient -v wlan0
        

        Now, You should be connected to the internet. Try ping 8.8.8.8. Voila! It worked. Note: Make sure that you have given access to iwconfig for the network connections. Inbuilt CLI applications/ services like network-manager may interfere with your network environment. To stop that particular service, do:

         sudo service <service_name> stop
        

        e.g. sudo service network-manager stop

      1. Reference 1: Stop network-manager service
      2. Reference 2: Connect to Wifi Network through CLI
      3. Reference 3: Another Wifi Connection using CLI
      4. Reference 4: Installing an easy Network Interface in Linux
      5. Reference 5: netctl interface; Use wifi-menu
      6. Reference 6: Install necessary applications (like dialog and wpa_supplicant) for ARM
      7. Reference 7: Using nmcli
      • If ping works fine, follow Reference 2 in order to connect to a WEP/WPA key protected Wifi network.

      NOTE! For some reason ROS refuses to properly communicate with host through the station mode, use AP instead! Station mode is useful if you need Internet access on the platform.

  3. Move some files to the platform. Go to the ‘snapdragon_setup’ folder, then execute (with platform connected via usb):
     adb push ./PX4/px4.config /usr/share/data/adsp/px4.config
     adb push ./PX4/mainapp.config /root/mainapp.config
     adb push ./PX4/px4 /root
     adb push ./PX4/libpx4.so /usr/share/data/adsp
     adb push ./PX4/libpx4muorb_skel.so /usr/share/data/adsp
     adb push ./opencv3_20160222-1_armhf.deb /root
     adb push ./camera.h /usr/include
     adb push ./camera_parameters.h /usr/include
     adb push ./mv0.8.deb /root
     adb push ./snapdragon-flight-license.bin /usr/lib/
     adb shell sync
    
     adb shell
     dpkg -i ./mv0.8.deb
     dpkg -i ./opencv3_20160222-1_armhf.deb
    
  4. Install the software on the platform
    1. Make sure to switch to the station mode and install ROS for snapdragon flight: link
      • Also, install additional packages: sudo apt-get install libeigen3-dev sip-dev libyaml-cpp-dev libboost-dev cmake ros-indigo-mavlink ros-indigo-tf ros-indigo-orocos-toolchain ros-indigo-angles ros-indigo-tf2 ros-indigo-tf2-ros
    2. Download our catkin workspace:
       cd
       git clone https://github.com/cognifli/cognifli
       cp ~/cognifli/contrib/environment/.vimrc ~/
       cd cognifli
       git checkout snapdragon
      
       cd contrib
       ./INSTALL.py
      
    3. Build everything:
       cd ~/cognifli
       catkin_make
      
  5. Run the software
    • Motor control
      • Make sure px4 is running (./px4 mainapp.config or through autorun)
      • In a separate window:
          roslaunch mavros px4.launch fcu_url:="udp://:14550@192.168.1.1:14556"
        

        You should see something like this in the end of the output. If you don’t, something is wrong with your ip or port:

          [ WARN] [5117.660738345]: TM: Clock skew detected (-4893.277222308 s). Hard syncing clocks.
          [ INFO] [5118.277715740]: CON: Got HEARTBEAT, connected. FCU: PX4
          [ INFO] [5118.294045062]: RC_CHANNELS message detected!
          [ INFO] [5118.296279802]: IMU: High resolution IMU detected!
          [ INFO] [5119.289135323]: VER: 1.1: Capabilities 0x00000000000024ef
          [ INFO] [5119.290862667]: VER: 1.1: Flight software:     000000ff (7a23a043fbdfa880)
          [ INFO] [5119.291693604]: VER: 1.1: Middleware software: 000000ff (7a23a043fbdfa880)
          [ INFO] [5119.292522146]: VER: 1.1: OS software:         000000ff (0000000000000000)
          [ INFO] [5119.293103396]: VER: 1.1: Board hardware:      00000001
          [ INFO] [5119.294391833]: VER: 1.1: VID/PID: 0000:0000
          [ INFO] [5119.295084593]: VER: 1.1: UID: 0000000100000002
          [ INFO] [5119.295712510]: VER: 1.1: Capabilities 0x00000000000024ef
          [ INFO] [5119.296223395]: VER: 1.1: Flight software:     000000ff (7a23a043fbdfa880)
          [ INFO] [5119.296868239]: VER: 1.1: Middleware software: 000000ff (7a23a043fbdfa880)
          [ INFO] [5119.297530688]: VER: 1.1: OS software:         000000ff (0000000000000000)
          [ INFO] [5119.298221208]: VER: 1.1: Board hardware:      00000001
          [ INFO] [5119.298689490]: VER: 1.1: VID/PID: 0000:0000
          [ INFO] [5119.299195531]: VER: 1.1: UID: 0000000100000002
          [ INFO] [5133.279507089]: WP: mission received
          [ INFO] [5133.280639589]: WP: seems GCS requesting mission
          [ INFO] [5133.280740682]: WP: sheduling pull after GCS is done
        
      • On a configured host, run rostopic list. You will see a lot of /mavros/... topics. For more information on Mavros, see this.

      • Now run the demo code. (You need to have cognifli repo set up on host):
          rosrun snapflight snapflight
        
    • Localization: In a separate windows (if you did not put it on autorun):
        imu_app -s 2
      

      And

        rosrun snap_ros_examples snap_vislam_node
      

      Then on a host run rviz and visualize tf!

  6. Tips and tricks!
    • Make things like ./px4 or IMU driver to run on system startup:
        cd ~/cognifli/contrib
        ./INSTALL.py --startup
      
        vim ~/.root_startup.sh
      

      Add line:

        nohup /root/px4 /root/mainapp.config &>> $LOGFILE &
      
    • Wipe the platform: Connect the drone via usb cable, execute on the host:
        cd firmware # This folder is in the 'snapdragon_setup'
        chmod +x jflash.sh
        sudo ./jflash.sh
      
  7. Read more:

To Do:

Add auto lock using xautolock and i3lock using the link given down below: