2014年9月14日 星期日

How about Holography + HUD (Head Up Display) ?

How about Holography + HUD (Head Up Display) ?

Now HUD is more and more popular! Not just for military but also applied to mobile car, such as HUDWAY (apps), Garmin HUD and etc. I think this kind of products are great and valuable. When I drive a car, I don't wanna look down to check my velocity、gasoline or something. It is annoying. So I will make some experiments for my HUD. This might combined with the holography, trying to make everything in 3D. The two videos below are just for finding a idea what to do and how to do. If you have any idea of my new project, if you would like, please let me know. And maybe we could collaborate for a totally new and amazing HUD :)







2014年9月3日 星期三

Cross Compiler for Raspberry Pi

Speaking to embedded system, you have to know about cross compiler, toolchain and CMake. Cross Compiler is a compiler which could create the executable code for a platform other than the one which the compiler is running. You don't want to compile your huge source code on the embedded system where maybe took lots of time. In order to set up the environment, toolchain consisting of a compiler and linker could transform the source code into a executable program, libraries to provide interfaces to the operating system and a debugger. In this case, CMake will help you figure out the environment of the platform via toolchain. Basically, you could compile your source code to executabl program which could execute on the Raspberry Pi by these three main tools. It will save your lots of time and more convenient for further processing. Let's see how it works.

Before the beginning of the process, make sure that you have install CMake, git, rsync 
(sudo apt-get install cmake git rsync)

Install Cross Compilation toolchain
At first, you have to download a pre-built cross compilation tool chain for a slightly different version of gcc and libc :




And install the toolchain by adding the environment variable. 
sudo nano ~/.bashrc  and add below line at the end of file.
export PATH=$PATH:/home/gtossk2/Desktop/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin










(After that, you enter "ar" characters and enter tab twice. You see something like arm-linux-gnueabihf-gcc which means successfully intallation.)


Make Raspberry Pi development files (header files, libraries) available on the host
mkdir mnt_rpi and cd mnt_rpi    Now tell rsync to copy the entirely of the /usr and /lib directories of the Raspberry Pi file system into the newly created folder on your computer.






After that, there is a important thing to be done. The files /usr/lib/arm-linux-gnueabihf/libc.so and /usr/lib/arm-linux-gnueabihf/libpthread.so are actually linker scripts refer to absolute paths, which are incorrect when cross compiling. Please remove the absolute path from linker script.

For example :
Becomes :





Make a cmake toolchain file for cross compilation
Now create a toolchain for cmake to set up the environment. Name it as Toolchain-RaspberryPi.cmake in path/rpi

For example :















Cross compile on Ubuntu
Now you can use Toolchain-RaspberryPi.cmake for cross-compiling.
For example :

Note : you have to set CMAKE_EXE_LINKER_FLAGS cause arm-linux-gnueabihf-ld could not recognize the sysroot. You have to set --sysroot=/home/gtossk2/Desktop/rpi/mnt_rpi for CMAKE_EXE_LINKER_FLAGS


Or you will get some linker errors :


Run on the Raspberry Pi
Using scp to transfer the executable file to Raspberry Pi and execute it on Raspberry Pi. See how it works. 






Reference:



2014年9月2日 星期二

Setting DHCP Server for Raspberry Pi

DHCP stands for Dynamic Host Configuration Protocol. That is an standardized networking protocol used on Internet Protocol (IP) networks for dynamically distributing network configuration parameters, such as IP address for interfaces and services. There are  two general purposes for

  • Automatically distributing IP address to users from local area network or ISP
  • A centralized management for all computers within local area network
In order to control my humanoid robot remotely, DHCP sounds a great idea. I could set up the DHCP server on raspberry pi and plugin RJ45 on both computers. It allows to remote command-line login via SSH (Secure Shell) and transfer a file via SCP (Secure Copy). It is very helpful for program and debug.
So let's see how to make it out !!

A popular DHCP server for Raspberry Pi is ISC's dhcpd. You can install the package in a normal way using apt-get (Before it, make sure to update the local package cache using apt-get update)


The DHCP server requires a static IP address and by default, the Pi will have a DHCP one.  Edit /etc/network/interfaces


And modify the records that pertain to eth0 using the network parameters for your network


Edit /etc/dhcp/dhcpd.conf 
The configuration file to suit your requirements. All of the main configuration items are commented out and this is why the startup failed previously.




Edit /etc/default/isc-dhcp-server and uncomment the following records, inserts your network interface name as appreciate and changing the file path if you have chosen to put the file somewhere.


Finally, restart the DHCP daemon process using service command (Make sure to plugin the RJ45 before restart DHCP daemon)



Reference :