07/28/2017 at 11:27 0 comments

    ODROID Powered LIDAR

    Today, it arrived:

    The ODROID!

    It has EIGHT cores. Four run at 2Ghz, and four run at 1.6Ghz. Remember your original Pentium 133Mhz? This thing runs at FIFTEEN TIMES faster than it, and does it four times at once— and has another four cores just for kicks. And it fits inside your coffee cup. How much is it? $59.

    Plug it in, HDMI, power, USB keyboard & mouse, USB wifi. And first up, run the old:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade

    To get the latest everything.

    And because of the NEON multi-processing instruction set, the performance is quite good for particular tasks such as SLAM, even compared to the quite powerful Pi.

    Let’s git clone my install system and run it:

    sudo apt-get install git
    git clone https://github.com/tjacobs/betabot
    cd betabot/install

    Now we have lots of good python, pip, opencv, audio and video things such as ffmpeg, alsa etc things installed. Now let’s install BreezySLAM:

    git clone https://github.com/simondlevy/BreezySLAM
    cd BreezySLAM/python
    sudo python setup.py install
    cd ../examples
    make pytest

    Oh! A SLAMed room! This is from its built in data file, so no external physical lidar yet. Let’s try watching the thing run live. Need matplotlib.

    sudo apt-get install python-matplotlib
    make movie

    Cool, we can see it run. Sweet, a map is being generated.

    Okay, now let’s try out the Lidar. We’ll need to install xvlidar.

    git clone https://github.com/simondlevy/xvlidar
    sudo python setup.py install
    python lidarplot.py

    Oh! No serial.

    sudo pip install pyserial

    Oh! No pip!

    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py

    Ok, back to pyserial.

    sudo pip install pyserial

    SerialException could not open port /dev/ttyACM0

    Sweet, it’s trying to access the serial port. Let’s see what it is.

    ls /dev/tty*


    Well that’s odd.


    Oh there it is.

    Hm, now where do we plug the Lidar into?

    Let’s read the manual.

    Ok, not in the manual. Ah, here it is. These pins.

    I see the receive and transmit pins: UART_0.RXD (#6) and UART_0.TXD (#8). Let’s take a ground (#2) and a 5v power (#1) as well. Most XV Lidars are 5v, I’ll take my chances. And I’ll use that little 1.8v pin to power the lidar motor, hopefully it can supply enough amperage.

    Ok, plugged in, and running lidarplot.py again, we get a spinning lidar, and a blank plot with a single dot in it, and the occasional “Checksum fail” when I wiggle the plugs. So it’s getting something. But not anything good yet.

    Let’s add some printouts to see what it’s getting. Ah, lots of 82’s, every value along the 360 degree array is 82. I guess that means “Not spinning fast enough” because I used my old Pi 2 to generate 3.3v, and plugged the motor into that instead of the measly 1.8v, and voilà! Lidar scans! And quickly updating too, when I put my hand in front of it, it’s reflected within a second or so.

    And how about a bit of SLAM?

    cd BreezySLAM/examples
    python xvslam.py

    Now that’s some SLAM!