Kevin Power - #3 Tello to OpenCV to Ubidots

Intro

This week we split into two teams, one group was working on autopiloting the Tello drone, and the other group were working on OpenCV to display the Tello Drone feed, then take this feed and show it on Ubidots.

I was on the team working on the Tello to Ubidots connection using OpenCV. I had some past experience using OpenCV so we got together as a team and had a talk. From this it was decided that there were two main connections we need to sort out, using getting a connection from OpenCV to Ubidots and connecting Tello to OpenCV.

Past OpenCV Work


I did a project in our distributed systems module that used OpenCV to send a camera feed onto a website that anyone can connect to, providing they are on the same network. Using this knowledge, I found my old code for this module and sent that code to the rest of the project team so we could use this as a starting point. We then split into our two groups, one group was responsible for getting the Tello stream to the website, and the other getting a normal camera from the laptop onto Ubidots. In the hope that in the end we could combine the two together to have a working project.

Ubidots Tutorial

I was on the team that was getting Ubidots working with the webcam camera. Our project lead sent us a link for a tutorial for using Ubidots for connecting the camera from OpenCV to Ubidots. I'll link that tutorial here:  https://ubidots.com/blog/people-counting-with-opencv-python-and-ubidots/ After completing this tutorial we had a successful connection from my laptop to Ubidots and an OpenCV python application that could data to Ubidots from. However, this tutorial had a key flaw, it was only able to send Images and numeric data to Ubidots. We could not get values back down off Ubidots or get a live camera feed which was the original plan. 

This meant this tutorial learning how to send pictures to and from Ubidots using OpenCV was helpful in learning more about the platform and sending images to OpenCV but not directly helpful for what we wanted in the project. 

What's Next


After this heartbreak, we started thinking about how to send a live stream video feed to Ubidots, we did some research and from that we found out that there was no inherent way of achieving this objective, Ubidots has no inbuilt video displaying widget and blocks any attempts at this. However, we did know that Ubidots allowed a HTML widget to be used.

This led me to thinking about past project I had worked on, eventually I remember a very useful tool in HTML which allowed us to make a breakthrough in how to achieve our objective, IFRAMES!! You can capture any webpage you want in an IFrame and display it in another html page in one line of code. We tested this in Ubidots and it worked! This meant we could get any video or website online and display it in our Ubidots dashboard. I show a picture of the IFrame working on Ubidots above.

Localhost vs Online

Once we had an IFrame working on Ubidots, we looked back at the code I had provided from my past work on OpenCV and displaying a webpage with a video feed online. I looked at trying to get an IFrame of the localhost website displaying on Ubidots but could not get that to work. I tested the application on my phone and laptop and it was displaying no problem but could not get it to work. After a couple hours of debugging I realised why it was not working, the website with video feed can only be shown to people connected to the same network as the application. Ubidots is hosted online and not on the same college wifi that the project was running on, but since all our devices where connected to it, it would display there.

Conclusion and Next Week

In conclusion this week, I did a lot of research on Ubidots and various means of connecting video streams to the network. It was very challenging and enjoyable to try figure out, additionally we looked into OpenCV and a few applications for video streaming and hosting for OpenCV to try get an IFrame displaying on Ubidots. 

Moving forward I will be investigating how to get a video feed on a public website that we can use as an Iframe for Ubidots. Maybe through the use of Social Media like Twitch or Youtube live.

Comments

Popular posts from this blog

How to: Tello drone to micro bit - Victor Alikberov, Blog#1

First USV Test - Jack Pender, Blog #5

OpenCV To RoboRealm - Jack Pender, Blog #7