Skip to main content

Posts

Showing posts from 2015

Featured Post

Product Design of a 4 wheel differential drive robot

Searching and Precision Landing of AR Drone 2.0 using Neural Network | Gazebo | ROS

The drone is able to search and find the landing platform. Once it finds the landing platform it will try to orient itself and land in the platform. Both of these are implemented using Neural Network. The tag used in the landing platform is from the ros package ar_track_alvar.

Precision Landing of AR Drone 2.0 using Neural Network | Gazebo | ROS

This is the initial results of the AR Drone autonomous landing procedure using Neural Network. The video is playing at 2X. NB: These are not the final result. Need further optimization.

Visual servoing of AR Drone 2.0 using Neural Network | Gazebo | ROS

This video is a part of an AR Drone autonomous landing project. Here the AR Drone is controlling itself so that the landing platform is exactly in the middle so that it can  initiate a proper landing. Here AR Drone is also tracking the Tag embedded on the landing platform (Not using the inbuilt tag detection. The tag that is being used here is from the ar_track_alvar package.). This is implemented using Neural Network. The video is not a part of a completed project. (The video is playing at a slightly faster rate.) [NB: As you can see the drone is not orienting itself as it is trying to reach just above the tag. This is only because I didn't train it to do so.] Packages used: ardrone_autonomy, tum_simulator, ar_track_alvar, custom packages (some packages I created for collecting data for training, republishing twist cmd_vel with time stamp, implementation of NN, custom launch files and worlds.)

Simulation & Controlling AR Drone 2.0 using Gamepad | Gazebo | ROS

This is a demonstration of AR Drone 2.0 simulation under gazebo using tum_simulator on ROS Indigo. This video is a part of an autonomous landing of AR Drone project.  Packages used: ardrone_autonomy, tum_simulator, ardrone_tutorials

A Multilayer Neural Network Based Obstacle Avoiding Robot | ROS | Simulation

This is an obstacle avoiding robot which I and Sooraj Krishna built in ROS using STDR simulator. The robot is making decision based on a 3 layer Neural Network. The learning algorithm used is back-propagation (which we wrote in python). The network design is shown below. The 4 inputs are distances from sonar sensors placed on the Robot. The two outputs are linear velocity on x -axis and angular velocity on z-axis. The Neural Network is first trained using the data captured from joystick controlling the simulated Robot. Then the  trained weights are used in the NN for controlling the Robot. This is the first version that is trained with small training set. The video is showing the Robot avoiding obstacles on its own. This is after a bit more training. NB: The video is playing a bit more faster than the actual simulation as you can see from the time showing in simulator. NB: Among two outputs one is for angular velocity. For turning right the value will be positive

Controlling turtlesim using a Gamepad | ROS

This is a sample program I wrote to learn ROS. I have used linux joystick api to directly capture values of the analog stick of my joystick (F710 Wireless Gamepad). These data are then directly send to the turtlesim/cmd_velocity as a geometry_msgs/Twist type. NB: There are ready to use ROS packages available to capture joystick key events (which are easy to implement). This is to just start coding with ROS.

Clap Switch

For some time I was thinking of making a simple clap switch for my room. ( Kind of lazy to go and switch off the light and fan every time... :-) ) First get it work on a breadboard. "Circuit is simple and straight way. Feed the output from the mic to a comparator. The output of comparator will act as the trigger for micro-controller. Micro-controller detects the pattern and enable the corresponding relay switch. Micro-controller always waits for an interrupt (a clap). If a clap is detected it will wait and counts the following claps within a period of 1s. It will discard miss claps and only takes into account the pattern that is programmed. 2 claps means light on/off & 3 claps means fan on/off. There will be separate switch to enable/disable the clap circuit and precedence will be given for the physical switch. That means if the physical switch is on regardless of the relay state light/fan will be ON. If it's not then it will depend on the clap circuit." Co

Vision Based Line Follower using opencv

The robot is powered by beagleboneblack using a 1500mAh Li Ion Battery with a differential drive mechanism.

Best tutorial for BeagleBoneBlack

For a long time I was searching for a good tutorial for BeagleBoneBlack. Since the community is little less for the BBB it was a little hard to get started. But I found a book which is very useful to get started (in my opinion). {every book is unique in its on way}. "Exploring BeagleBone Tools and Techniques for Building with Embedded Linux" by Derek Molloy. Here is link to his homepage where he listed almost all contents in the text. The book cover almost every basics you need to know to get started. (BBB, Electronics, Linux, Cross compilation, Git, Opencv, ...) Most of the other books and tutorials focus on the javascript tool (node). But I didn't feel so good with it. This book mainly focus programming the BBB using c which I feel good. You will find an e-book here .

Reading and showing images using opencv

Here is a sample code to read and show an image after converting it into grey scale. Program reads a picture file called boy.jpg in the current folder and displays it. After 1 second it will change to grey scale. Use this command to compile the program. g++ first.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv` where first.cpp is the file name.

Mobile Robot controlling using BeagleBone Black

Finally start working properly. Need a better voltage regulator and a better battery pack! Voltage spikes when BeagleBoneBlack starts. After a while the BBB will shutdown due to voltage fluctuations... :-( WiFi module in BBB is drawing so much current . Now the robot can be controlled wireless and can move forward, backward, left and right using keyboard. Need much more work... :-) NB: Voltage issue resolved using LM2596 DC-DC Buck Converter. I have included a camera and a light source for the robot. But its not connected in the video. A laptop battery is placed at the rear end of the robot. It's not the power source. It is just added for giving enough weight to avoid skidding. Otherwise it will drift a lot. NB: There was a problem with wireless connection. It will drop at odd times. Solved using a script that will reconnect if connection is lost.

Controlling a differential drive motor with Beaglebone black

Display text in color - Linux terminal

Ever wanted to print text in colours? You can do it with ANSI escape characters. You can use ANSI codes in any programming language as long as the terminal supports it. echo -e "\e[31mRed" Red echo -e "\e[32mGreen" Green Replace the number to get different colors. You can make text bold, italics, underline etc. Following is a short table describing several codes. 39     Default 30     Black      31      Red    32      Green    33      Yellow     34      Blue     35      Magenta 36      Cyan    37      Light gray    97      White      For a complete reference, link . (The page has a complete list of ANSI codes)

BeagleBoneBlack ADC

Follow the instruction to enable the ADC and read outputs from the file. echo  BB-ADC > /sys/devices/bone_capemgr.9/slots (*There may be slight variation for directories. Figure this out if not working.) Verify whether ADC is loaded by cat /sys/devices/bone_capemgr.9/slots Read ADC value by cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw Here AIN0 (PIN39 on P9) is connected to a potentiometer. Do not exceed the voltage above 1.8V . This will damage the BBB. Its a 12 bit ADC. So maximum value will be 4096. To calculate value in voltage, (1.8/4096) *ADC_Value I wrote a bash script to do this work. For this script to work install bc on BeagleBoneBlack. bc is a small program to do mathematical calculation from terminal. apt-get install bc Save the above bash script to a file (adc_bash) and set permission to execute by chmod +x adc_bash To run it every 0.5 second, watch -n 0.5 ./adc_bash Once finished with the ADC you can unexport it. But it

BeagleBoneBlack GPIO Push Button + LED

 

LED Cube using Atmega328P

GPIO Blink an LED using C - BeagleBoneBlack

First enable gpio23 and set it as output. echo 23 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio23/direction (Refer this page for circuit info.) Then compile this code and run it. There are two arguments to this code. One is the number of times the LED blinks and the other one is the delay in us.

GPIO Blinking an LED using bash script

Refer this site . This gives a fare idea about how to design a simple transistor switch. Or go to this site . The max o/p voltage from the gpio pin is 3.3 V. But you can get a 5V VDD from Beaglebone Black board. The circuit I designed is given below. The transistor I used is KN2222A . (You can use any transistor)   Will add a nice circuit diagram later. Once you are finished with the circuit follow the steps in this page . cd /sys/class/gpio echo 23 > export cd gpio23 echo out > direction Then save the script given below to a file and run this in your BBB. (It will blink the LED once every second.) Cntrl + C to stop the script.  

Getting started with GPIO (Testing GPIO with a multimeter)

There are 65 possible GPIO pins that you can control. Some of the GPIO pins are normally configured to different functions. Let's play with one of them. Go to the beaglebone website and figure out the header pin corresponding to gpio23. The gpio23 is mapped to the 13th header pin. In this tutorial we are testing the gpio23 output using a multimeter (Do not connect an LED directly to BBB IO pin). First go to following directory cd /sys/class/gpio / Then make gpio23 available echo 23 > export A new directory will be created. Open gpio directory. cd gpio23 The direction of IO will be normally set as in (input).  To make it as output, echo out > direction Then set the pin to high using echo 1 > value Measure the voltage at pin 13 of P8 header. If its 3.3 V then you are on the right track. Pin 1 and 2 will be ground. You can connect the negative terminal of multimeter to pin 1 or 2. To set output as zero, echo 0 > value After finished wit

BeagleBoneBlack apt-get upgrade error due to led-aging.sh

When I try to upgrade my new BBB bought from element14 (4gb emmc) it throws a list of errors. stem facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv:  loop involving service mountkernfs at depth 1 insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility

Getting internet on BBB via usb (Share internet from your linux machine)

Login to your BBB and type route add default gw 192.168.7.1 Then type the follwing in your linux machine to route the network. sudo su iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface eth1 -j ACCEPT  echo 1 > /proc/sys/net/ipv4/ip_forw ard Note: eth0 is LAN interface which has internet connectivity. eth1 is the usb network connection with BBB. 192.168.7.1 is the ip address that assigned to your PC. Following part is not needed if internet is working properly. If you are using network that doesn't allow third party dns server (like google dns 8.8.8.8 or 8.8.4.4), you had to configure /etc/resolv.conf. First find out what dns server address your internet provider (your college) gives you. If you have a working network type nm-tool to find out the dnsaddress. Then delete all the entries in /etc/resolve.conf and replace it with nameserver <dnsaddr> eg: nameserver 192.168.0.5

Remote access your BeagleBone Black using vnc

Before going into how to share desktop with your BBB I assume you have a proper ssh access to your BBB. (through USB) (if not read this ) Also this tutorial is for BBB with Debian installed (type cat /etc/*-release to know which distro you are currently using. Or refer here ) First install the vnc server in BBB.(After logging into BBB) ssh root@192.168.7.2 apt-get install x11vnc Then go to your local computer and open a terminal window. Install a vnc viewer like vinagre. sudo apt-get install vinagre Now its time to start vnc server in BBB. x11vnc -auth /var/run/lightdm/root/:0 -forever This will start a vnc server at port 5900. Note this server setup is temporary. If you want to remotely connect to your BBB after a reboot type the above command again. Go to your local computer and type  vinagre 192.168.7.2::5900 A remote desktop will be shown if all goes well. Try exploring other options in x11vnc using (in BBB) man x11vnc The se

Program BBB using C (Blink onboard LED)

If you are familiar with linux, you may know that everything in linux is a file. You can talk to a hardware as if you are writing to a file. There are 4 on board LEDs in BBB. You can play with that LED. Go to /sys/class/leds/beaglebone:green:usr3/ cd /sys/class/leds/beaglebone:green:usr3/ If you write a '1' to the file corresponding to LED3, then it will light that LED. Writing '0' will switch off the LED. echo 1 > brightness It will switch on the LED forever. :-) If you want to switch off it again type echo 0 > brightness Let's do it in c. First ssh into your BBB (refer here ). Then create a directory to work with. mkdir helloworld cd helloworld Open your favourite texteditor. nano LEDBlink.c Then type this program. #include<stdio.h> int main() {         FILE *LEDHandler=NULL;         char *LEDPath="/sys/class/leds/beaglebone:green:usr3/brightness";         if(LEDHandler=fopen(LEDPath,"r+")){             

Getting started with BeagleBone Black (Remote login via SSH with Linux / Windows)

Just started working with beaglebone black Rev C. As I move on with beaglebone black I will keep my blog posted. It may be helpful for newbies like me... :-) Connect your BBB (BeagleBone Black) with your PC. Open up your terminal and type ifconfig to check whether it's connected. You will see an eth1 (ethx) connection with an IP assigned as 192.168.7.1 When you connect your BBB, you will see a drive mounted up (if not mount the disk). Open the drive and open start.htm. You will see documentation of the device there. You can install drivers from there. (Driver installation isn't required, but you might find a few udev rules helpful.) Just download the mkudevrule.sh file. Go to the folder where you download the file. Then give permission to execute the file. cd ~/Downloads/ chmod +x mkudevrule.sh Then run it by, sudo ./mkudevrule.sh In orded to remotly login to your BBB using ssh type ssh root@192.168.7.2 There won't be any root password set yet. For win