Friday, September 11, 2015

Setup notes on Emacs and Common Lisp

I recently thought about Lisp again, and found last time when I was planning to learn Lisp has been six years ago... O__O

This time I will not to learn Lisp with Vim, but with Emacs.

I am following Practical Common Lisp and found there's a so-called Lisp in a Box package, but I decided not to use it now. My plan is to set up a working environment in Ubuntu using more common approaches.

Here are something I have done so far, and they are left here as a note.

  1. Installed Emacs, Slime, and CLisp:
  2. $sudo apt-get install emacs slime clisp

  3. Created ~/.emacs.d/slime/ (to be checked...)
  4. Add ~/.emacs with the content (copied from websites, some functions are not clear to me):
  5. ;; MELPA
    (when (>= emacs-major-version 24)
      (require 'package)
      (add-to-list
        'package-archives
        '("melpa" . "http://melpa.org/packages/")
        t) 
      (package-initialize))

    (setq inferior-lisp-program "clisp")
    ;; Setup load-path, autoloads and your lisp system
    (add-to-list 'load-path "~/.emacs.d/slime/")
    (require 'slime-autoloads)
    ;; Also setup the slime-fancy contrib
    ;;(add-to-list 'slime-contribs 'slime-fancy)
    ;;(setq tab-always-indent 'complete)

    ;;; for auto-complete
    (require 'auto-complete)
    (global-auto-complete-mode t)
    ;(add-to-list 'ac-modes 'lisp-mode)
    (add-to-list 'completion-styles 'initials t)
  6. After adding MELPA, installed auto-complete by M-x package-install
  7. Also installed evil which enable ``evil-mode'' for Vim-like key strokes
  8. Use M-x slime to start it and the clisp

Tuesday, June 16, 2015

Build PCL with OpenNI2 in Ubuntu 14.04

I have built PCL from source and installed it in my Ubuntu 14.04. Everything was fine till these days.

I wanted to rebuild one of my test code in which I used Xition as the input device and it needed OpenNI2. When running ``make'' the system complained that it couldn't find pcl/io/openni2_grabber.h. I checked and found the head file was in the source package but not in the corresponding system folder. So it was something wrong with the make files.

The solution is to turn on the flag BUILD_OPENNI2 which has OFF as the default value[1]. I used
$ grep -r "BUILD_OPENNI2" .
to find it was in the file of CMakeCache.txt. Then just changed the value of from OFF to ON and did make && sudo make install again.

Monday, January 05, 2015

My QuickBot test with IR sensors

By following the Coursera course, Control of Mobile Robots[1] by Dr. Magnus Egerstedt, I've built my first QuickBot in which the BeagleBone Black is the core.

The course had been closed in several months ago, but I didn't get enough leisure time (and proper mood... maybe...) to complete the robot until these weeks. The following photos show the QuickBot:
Front view of my QuickBot
Top view; the BBB is on the left side

The mess of wires between the chassis
What I have done so far is to test the sensors and motors with the help of the testing code qb_test written by Mike Kroutikov. Because I've used the Sharp GP2Y0A41SK0F IR sensors which are different from the ones assigned in the course, I am not sure whether the output is identical to that given in the comment of the test code. Therefore, after some tests, I decided to modify the test code for the IR sensors to show the detected distances in centimetres[3].

I searched and found some conversion formulas for Arduino[2]:

source: http://www.dfrobot.com/wiki/index.php?title=File:Formulas.jpg

The trend of the output seemed right, but the absolute values were far from accurate. I might have to do some tests to find my own formula.

What I failed in the test was the communication between the host PC (running pysimiam) and the QuickBot's BBB (running quickbot_bbb). I have Wi-Fi adaptor connected to the BBB and it worked perfectly for accessing the internet, but I just couldn't connect the BBB wirelessly from my PC. I decided to postpone this part.

My next plans are:
  • To write some code to drive the motors with the IR readings as the reference;
  • to change the battery packs to the Li-Poly one.

---
[1] Without signing up the course, you may not be able to view the content. Here is the play list on YouTube: https://www.youtube.com/playlist?list=PLp8ijpvp8iCvFDYdcXqqYU5Ibl_aOqwjr . It has only the video course, however.

[2] http://www.dfrobot.com/wiki/index.php/SHARP_GP2Y0A41SK0F_IR_ranger_sensor_%284-30cm%29_SKU:SEN0143

[3] My modified code is here: https://github.com/hiankun/qb_test.git