Thursday, 9 February 2017

Roborealm with the Mbed - Sophie Wicks

Introduction

The lampbot relies heavily on the vision system to be in operation. This is used for facial or object tracking to give the lamps a personality. The aim is to get communication from the Roborealm program to the mbed. A serial setup will be used to send information from Roborealm to the board. The board waits to receive characters serially, which is provided by Roborealm.

Roborealm Setup

Roborealm provides a main which serves as a while (1) loop. The user can include however many functions are needed into the pipeline which will execute sequentially. The pipeline used looks like the following:
Roborealm Pipeline used

There are 5 functions that roborealm is performing in this pipeline. The first is the horizontal flip. This is for user convenience and is used to mirror the screen so the users movement is the mirror image on the camera window. Otherwise the movement is in the same direction and appears to be opposite. 

The next module is Object Recognition. This is used to save a particular object that is to be recognized. The object can be added and is saved into the path that is provided in the pipeline. This can be changed if necessary. The object must be added and then "trained" in as per the following image:

Training objects in roborealm

The third module in the pipeline is the brains of the program as this is where the variable manipulation takes place. This is within the VB Script program. This program is used to assign variables based on the recognised object. The object of choice was the number "8". This was stored as the OBJECT_NAME = Eight in the VB script program.
The program implements simple functionality when the number "8" is recognized. The variable "object" was created and set to "u" when the "8" was recognized. Object was then set to "d" when there was no objects recognized. The following are the lines of code that were written in VBscript to implement the functionality described:

objectName = GetVariable("OBJECT_NAME")

if  GetStrVariable("OBJECT_NAME") = "Eight" then
SetVariable "object", "u"
else 
SetVariable "object", "d"
end if

The serial module is used to establish serial communications with the mbed. This is the peice which links all of the communication together. Since the mbed is waiting for a serial input, the roborealm serial module is used to automatically send down serial data based on the object recognised. The data being sent to the mbed is "object" which was assigned the value "u" or "d" as per the VB script. The serial module is set up as follows to establish a connection. Note the Baud rate is set to 9600.
The following image shows the serial module sending down the "object" variable which is set to d or u. The image shows the object, Eight, being recognised. The serial module is sending down the value of "object" which is "u" and turns the brightness of LED 1 up.

Serial Comms module within Roborealm
The program therefore works in the following way:
  1. The user shows the number "8" to the camera
  2. The character "u" is sent serially to the mbed
  3. The mbed is expecting the character "u" (from C++ code) to turn up the brightness of LED1 and does so.
  4. The user removes the object from the view of the camera
  5. The character "d" is sent serially to the mbed
  6. The mbed is expecting the character "d" to turn down the brightness of LED1 and does so.
The following is the function in the C++ program which accepts the serial commands from Roborealm

 while (true) 
{       
        char c = pc.getc();
        if((c == 'u') && (brightness < 0.5)) 
        {
            brightness += 0.01;
            led = brightness;
        }
        if((c == 'd') && (brightness > 0.0)) 
        {
            brightness -= 0.01;
            led = brightness;
        } 
         Thread::wait(100);
           stdio_mutex.unlock();
}

About the Author :) 

My name is Sophie Wicks and I'm studying the BSc in Applied Electronics. I went through the ladder system in Waterford Institute of Technology which means Higher Cert, Ordinary degree, and now the Honours degree. I got into electronics primarily from an interest in Physics. I enjoy building circuits and working with hardware but I'm slowly learning about the softer side of electronics. I find project in the Applied Robotics Lab really inspiring because you start out with no idea how to do something and 12 weeks later you have a full project working. I'm really looking forward to working in the groups on the LampBot. 

In my spare time I love doing yoga and going for runs (when time permits!) I am also really interested in music and played guitar for 6 years. I have an interest in picking up the guitar again when I get the chance. Here's a picture of me at the Cliffs of Moher on a weekend that I spent in Clare on work placement.


Technical Interests

I am doing my FYP using Linux and have a strong interest in it. I started using Linux in industrial placement where I had to pick it up very quickly. I was given the opportunity to write bash scripts for the team and customers to automate kernel stitching and I really loved that work. I am looking forward to learning more about Linux with this module. I am also very excited to improve my software skills and learn as much as I can this semester about OOP and C++.

~ Life Motto ~

If you don't ask, the answer will always be no!

No comments:

Post a Comment