Vision based Line Follower

From Rsewiki
Revision as of 11:23, 3 March 2016 by S130074 (Talk | contribs)

Jump to: navigation, search

RegbotVision.JPG

Contents

Hardware needed

For installing and utilizing the line follower application for RegBot robots the following things are needed:

  • A fully functional RegBot programmed with latest version of the robot software. Consult this section to ensure that.
  • A clean Raspberry Pi (model 2 and above is preferred). In case the Pi is clean with an OS newly installed simply skip the install OS section in Software Installation.
  • A Raspberry Pi camera modul.
  • A mount for Raspberry Pi + camera module. Consult JCA for this.
  • A few female/female jumper wires for connecting the Raspberry Pi with the RegBot.
  • A WiFi dongle e.g. EDIMAX EW-7811Un (Raspberry Pi model 3 includes WiFi).

Also it would be good to have access to a "HDMI input"-screen in order to locally make the initial connection to WiFi and setup SSH for remote access.

Software installation

Instructions on how to install the needed software on a Raspberry Pi.

Raspberry Pi

Installing the OS

Use this link to download and install the newest Raspian OS on a SD card. Detailed instructions on how to write an image to a SD card is found within the link as well.

When the OS has been successfully installed insert the SD into the Raspberry Pi - connect a screen via the Pi's HDMI output and a keyboard + mouse set.

Setting up WiFi

Plug in the WiFi dongle and open up a terminal window.

In terminal open the wpa-supplicant configuration file:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and enter the information about the WiFi:

network={ 
    ssid="Your_SSID" 
    psk="Your_wifi_password" 
} 

Save the file by pressing Ctrl+X then Y, then finally press Enter.

Restart the Pi by typing sudo reboot and it should automatically connect to WiFi when finished restarting.

Setting up SSH

Make sure SSH is enabled. In terminal type:

sudo raspi-config

Scroll down to the "ssh" option and enable it.

Ssh en.png

Change the password while at it as well - default password is raspberry.

Get the Pi's IP address by typing sudo ifconfig.

Next to the wlan0 entry the inet address is present which is the IP address of the Raspberry Pi, and remote access to the device is available by typing:

On Mac and Linux:

terminal: ssh pi@ip_addr

On Windows:

putty: choose SSH --> pi@ip_addr

By now no screen, mouse or keyboard is needed connected for utilizing the Raspberry Pi.

Assign .local domain to Raspberry Pi

The Raspberry Pi's IP address will frequently change and this will result in spending a lot of time looking up IP addresses of devices. Instead one possibility is to assign a static IP to the device or a .local address to the device, which is the option explained here.

For Linux and Apple computers this should work right out of the box while Windows-users have to download Apple's Bonjour client (note that if Windows-users have iTunes installed then Bonjour is most likely installed as well, as it comes with iTunes). The Bonjour client can be downloaded here.

While still in terminal on Raspberry Pi install Avahi:

sudo apt-get install avahi-daemon

After the installation is done remote access is available by typing:

ssh pi@hostname.local

Default hostname is raspberry. Follow these instructions to change the Pi's hostname.

Mount remote folder

Working on applications that needs to compile and run locally on the Raspberry Pi it is very handy to mount the working folder locally on a PC or laptop. Doing this will make it possible to develop the code in a preferred IDE, and drag and drop files to/from the device.

On Mac and Linux go to terminal and type:

sshfs pi@hostname.local:/remote/folder ~/local/folder

Remember to create the local folder before mounting to it.


OpenCV 3

Line Follower application

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox