Monday, February 2, 2015

Progress Report

Calculating Compass Bearing

I have been using the GeoPy library for most of my geographical calculations. However, it does not provide a method to calculate bearing between two points. For this case I have referred to jeromer's compassbearing.py found on GitHub.

For some strange reason, whenever the testing device is traveling in the direction of the 4th quadrant, the bearing is not reported correctly as it should be between 180° - 270° (Southeast)

2D Animation using PyGame or Pyglet

In order to visualize all of the abstract math and code, it would be useful to demonstrate an animation of what we are trying to implement. Since Python has many powerful graphics libraries such as PyGame, Pyglet, TkInter, PyGTK, PyCairo, wxPython, PyQT, and turtle, I think it would be a good use of our time to create a simple debugging interface that may save us a lot of time in the long run. PyGame and Pyglet are my top choices, as they are pretty popular and developing our animation will be pretty simple with the tools provided. It will also serve as a great demonstration tool for others to understand our project.

Testing Scenarios

If the team and our equipment is prepared by the 2nd week of February, we will begin our real-world testing of the app and the server. This is far from the stable release of our software, but it should be enough to get some basics worked out.

We would like to come up with at least 4 different scenarios to test. For starters, we will have 4 vehicles with a passenger in each.

Thursday, January 22, 2015

Returning to Python

My programming career started as a teenager in high school. Some of the first computer languages I learned were Turing and C, but that was only to satisfy the requirements in some of my courses. When I decided to pursue a programming career, I chose Python to harden my Computer Science concepts. I used it for about a year, completing assignments that I found online from other universities, and starting my own projects such as a web scraper and an email auto-responder. It has been a few years since I have really gotten back into using Python, and I'm finding it slightly difficult to avoid my C++ syntax.

Geometry

After mastering high school Calculus and experiencing the torture of Engineering Calculus AB at the University of Toronto, I have yet to take full advantage of my knowledge in Math, and my skills are getting a bit rusty.

In order to calculate the velocity using 2 points on a map, we need to find the displacement between the points and the timestamp given for each sample. I will leave the velocity in its X and Y components for simplicity and later calculations.

Map Coordinates

I would like to store map coordinates in time in seconds only, but online I could only find methods for converting between Latitude Longitude to Degrees Minutes Seconds (DMS).

However, according to the University of Nebraska Lincoln, I can easily multiply latitude and longitude by 3600 to get position in seconds.

1° = 60’ = 3600”

Total Seconds = 60(60degrees + minutes) + seconds
Total Seconds = 3600latitude
Total Seconds = 3600longitude

Tuesday, January 13, 2015

CDOT Winter 2015 Initiation

Welcome Back

It has been quite a while since my last blog post, but I promise to submit entries more frequently from now on.

It is the start of a new semester here at Seneca, and I am continuing my 6th semester of the Computer Programming and Analysis program, and my 5th term as a part-time research assistant (RA) at the Centre for Development of Open Technology (CDOT).

This season is quite exciting for some of us as we are springing into many diverse projects with new RAs on-board.

BRAKERS Project

My team is currently working on implementing a Python asynchronous networking server and developing an Android app for BRAKERS Early Warning Systems INC.

Python Networking Server

Neil and I have been researching and benchmarking different web frameworks to be used on the networking server for the Android app. We are considering Tornado, which is a fork of the famous Twisted framework. Tornado is a Python web server as well as an asynchronous networking library, which will allow us to work on the backend.

Initial Android Application

My other group members are developing an Android application to be ready for real-world testing in February.

Weekly Demos and Presentations

Today we will begin our weekly demos and presentations, where individuals or groups within CDOT will briefly demonstrate what they have been working on over the past week or so. Since this is our 2nd week after the holidays, I will be giving a recap of our project and what our team has been working on thus far.

Sunday, July 28, 2013

Binary Serialization of a Doubly Linked List

In order to properly store a list in a file, you must copy each node individually and avoid storing volatile memory addresses.

A binary read/write must accept a char* argument. Using a DLL consisting of integer data, we can simply cast the address of the integer and pass its size.
  int i = list.getValue();
  data.write((const char*)&i, sizeof(i));
The integer (4 bytes) will be written as 4 characters (1 byte each), which can be read back later on.

Sunday, July 7, 2013

Insert into Doubly Linked List

Here is a small snippet including the insertBefore function of a DLL.
void DoublyLinkedList::insertBefore(int d)
{
  DLLNode* newnode = new DLLNode();
  newnode->data = d;

  if(cur == front)
  {
    front = newnode;
  }

  if(cur)
  {
    newnode->next = cur;

    if(cur->prev)
    {
      newnode->prev = cur->prev;
      cur->prev->next = newnode;
    }

    cur->prev = newnode;
  }
  else
  {
    front = cur = back = newnode;
  }

  size++;
}
I found it easier to visualize the list by drawing the nodes on paper.

Saturday, May 25, 2013

AscToInt

The function is already provided in the C Standard General Utilities Library.
long int strtol (const char* str, char** endptr, int base);
Source: http://www.cplusplus.com/reference/cstdlib/strtol/