Monday, December 28, 2015

Resident Database

I am now concentrated in ASP.NET to get our resident database reports ready this year. I haven't be happy with MS Access reports and I am now investigating Crystal Reports for Visual Studio and Visual Studio's own report tool. I hope I can use the flexibility of LINQ. I used Crystal Reports ten years ago.

It was a time consuming work to figure out, how to transfer MM Access database to SQL Express. I didn't get the conversion tool to work. I transferred the data table by table by converting them first to text. I am naturally overdoing our database, but I want to learn.

Basically the database front end is now designed with the Web Forms. I was planning to go the ASP.NET MVC, but it was too much learning at this point. Eventually I have to do that later.

Front End- design is not so easy with ASP.NET than with MS Access and Visual Studio Windows Forms. I made a lot of googling, but I couldn't find proper solutions. Then I started to make that with the old way. It means start to think:)  All controls on ASP- pages actually create a HTML code. It took a lot of time to profoundly understand  it!  I can now combine data controls with regular controls by editing the source HTML file.

Tuesday, December 22, 2015

Eddie's First Steps

Eddie is now moving!! The serial port problem was actually my simple program bug. I didn't clear one variable.  It is actually seen in my last post in the C# code. My big audience didn't find it:)

My analysis was totally wrong, but I still have problems with receiving data.
I found a good article about serial ports on .NET:

http://www.innovatic.dk/knowledg/SerialCOM/SerialCOM.htm

The picture is from the screen capture from Eddies eyes and brains, Dell laptop.



Sunday, December 20, 2015

Eddie Obeys but won't Give Good Feedback

Eddie is now moving from the  dashboard. Sending commands appeared to be easy, but receiving data is another story. I have tried to read sensors and update form controls and I had only partial success.

I got finally all working by reading serial data byte by byte. Trying to read receive data line by line or the whole buffer didn't work for me. It can be a driver issue or I haven't get the full idea of threading.

Now I cannot clear the receiving buffer. That means I cannot update form fields properly without tricks. All worked very well with VB5&6 in good old times.

I am using now timer to send commands like with VB5.

Anyway, here is the code:

private void SerialPortDataReceived(object sender, SerialDataReceivedEventArgs e)
        {
          
            byte[] buff = new byte[sp.BytesToRead];
               
                int result = sp.Read(buff, 0, sp.BytesToRead);
                /*
                foreach (byte b in buff)
                  
                */
                foreach (byte b in buff)
                {
                RecASCII += b.ToString();
                }
            //string aa = sp.ReadLine();
            //string aaa = sp.ReadExisting();
            Thread.Sleep(100);
            sp.DiscardInBuffer(); // clear buffer
            RecHEX = ASCIITOHex(RecASCII);
          
            this.Invoke((MethodInvoker)delegate
            {
                RightPing.Text = RecHEX;
                LeftPing.Text = RecHEX;
            });

            }

Wednesday, December 16, 2015

Geodesy

I have now studied LINQ (Language Integrated Query) in the ASP project. It is more flexible than normal query language, because I can make queries in the code level. I created our resident database with MS Access and I had difficulties to create complicated queries for reports. This should work

I have tried to check the "Chart Channel" geodesy part. At this point it is overwhelming to me. Unfortunately I never studied  geodesy profoundly and I never knew, what the code is exactly doing. So get a new study project. Typically things are clearing up and I don't need to know all. Just persistent work.

Sunday, December 13, 2015

Pinging

I haven't been lazy this weekend. I am still fighting with threads. It appears to be very fundamental and new to the old Visual Basic - programmer like me. Some progress anyway.

The code below reads Eddie's ping (sonar) sensors and update the form text controls.
Text controls updates happen in the different thread. I had a lot of googling to make this happen. The other option I have check is the Backgroundworker-class.

Things are going slowly now, but I know based on my experience, all will accelerate later.

I have also worked with ASP-study and the VB6 "Charts Channel" with Artinsoft tool. Unfortunately it's free version allows only 10000 lines. So I have to divide the code. The "Charts Channel" is about 23000 lines. Naturally I can remove some code. Artinsoft tool isn't the perfect solution, but it gives some foundation how to do the conversion. 


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;

namespace SimpleEddie


{
public partial class Form1 : Form


{
public Form1()


{
InitializeComponent();
serialPort1.PortName = "COM3";


serialPort1.BaudRate = 115200;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);


serialPort1.Open();
string msg = "PING \r";


serialPort1.Write(msg);

}
private void Form1_Load(object sender, EventArgs e)


{

}
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)


{
string data = serialPort1.ReadExisting();
if (data != "")


{
string data1 = data.Substring(0, 3);
string data2 = data.Substring(4, 3);
this.Invoke((MethodInvoker)delegate {
LeftPing.Text = data1; // runs on UI thread


RightPing.Text = data2;
});
}

}
}
}

Tuesday, December 8, 2015

Upgraded Plans and the Goal

My ASP.NET project is still in learning mode. I have basically reread the things I have known earlier. Just now I am studying database controls that I never used with my old database application, the Open Door Mission Master Database. I used an existing application that I modified.  I am going to the new area now.

I have designed a simple resident  database for my organization St. Francis Charities based on Microsoft Access. The goal is turn that to the Internet based ASP.NET/SQL Server application. Then I will but that to the cloud using Microsoft Azure.

I have also studied the VB6 "Charts Channel" software. I am feeling more comfortable with it. It needs only perseverance to convert  that to .NET. I can clean some unnecessary parts of it to make conversion simpler. VB6 and the Object Oriented .NET are different and I cannot estimate the exact conversion time just now. My optimistic schedule is three months.

Eddie is the way to learn C# and the real Object Oriented Program design.

Three things are now going on and they support the goal  to make a  telepresence, position and navigation software for Eddie robot. The estimated time  to do it is six months. It is a kind of graduation work after what I have learned during  past forty years. I pray and hope I will get a chance to make it happen.

Sunday, December 6, 2015

Troubles

Eddie caused lot of troubles this weekend and then I found that battery level was too low! It was a shame and also a relief, because I thought that the control board is faulty again. Then the charger unit was broke and I built a temporary one using a LCD monitor power source. These were the engineering incidents.
 
I built a new serial port application. Now the serial interface is as a control in a form. That's way it used to be in old VB6. Then I got a problem when I tried to update fields on the form. I got error messages that controls cannot be updated from the different thread. I never had that kind of issue with VB6. Now I have to worry about threads. Threads are naturally basic stuff with multitasking, but I miss the old VB6. Anyway, after Googling I found a workaround. Basically a new thread must be created.
I was studying also ASP.NET databases. The new SQL Server Express 2014 has a new graphical  interface for creating queries like MS Access  has. In the old SQL Server 2008 the only way is  you have type queries with the query language.

The battle continues.

Thursday, December 3, 2015

WPF

I started to code my small robot control software, but it wasn't so easy I thought. I have learned to  update form fields straight from the program module, but it won't work easy way. The reason is Windows Presentation Foundation (WPF). I have to possibly go back to "school" and study more or find a workaround. Perhaps back to normal Windows forms.

The good news is I got the old Visual Basic 6 based "Charts Channel"  program work under Windows XP. I miss the old times when all was easier...

I have finally start to study Internet databases with ASP.NET.

Monday, November 30, 2015

ASP.NET 2

I am reading the book Wrox: Beginning ASP.NET 4.5.1: in C# and VB. Third of the book is now accomplished. I made some shortcuts, because I am interested in databases in the latter part of this book. The book itself is very good. The book is using Visual Studio 2013.  I am using it, although Visual Studio 2015 is available. There should not be any mismatches.

I designed and coded  SQL databases using Client/Server model. Currently all is going to the cloud and ASP.NET is the answer, if Microsoft technology is used. ASP,NET is trickier to program than the Client/Server. I excepted it was easier, but I have now to adjust. I have seen many online database applications based on ASP.NET.

I will get Eddie back tomorrow!

Friday, November 27, 2015

ASP.NET 1

I am also studying ASP.NET. The target is to create database to the Azure (MS Cloud) and possibly website that is connected to Eddie

Tuesday, November 24, 2015

New Dashboard

Proposed user interface is now renewed:
Straight slider is controlling both wheels with the same power and turn slider  distributes it. It is like steering a ship. Stop button set slider values to zero stopping Eddie.
I have used a lot of time to get one old VB6 program to work. It will possibly benefit Eddie.
I get Eddie in touch after Thanksgiving and then is the testing time.


Thursday, November 19, 2015

Some Thoughts and Future Plans

Eddie can now read his USB port fluently. I was stuck with string and character handling. It is different from the technics 20 years ago. Some testing and learning is needed.

Eddie was originally designed and targeted for the Microsoft Robotics Studio that was considered complicated and difficult. I am now keeping things simple. Eddie will read sensors, evaluate next step, go forward etc.. It is not so sophisticated, but should work.

I have an old navigation & position  software and naturally a source code. Converting that to Eddie is a huge challenge. I am going to try. Basically I have to rewrite the whole software, because it was designed with MS Visual Basic with other add-ins. I simply cannot convert it with current conversion tools.

I like to make an indoor navigation system. There are ways to do that. GPS won't work inside, anyway. A Finnish startup company IndoorAtlas has a solution that is based on magnetic anomalies, that exist in buildings because of their metal structures. I worked a lot with magnetometers and their applications. I regret that I didn't invent that:)

When I bought Eddie. I had an idea to create visitor tour robot over Internet. It makes tour  through predesigned paths in a building and yard. Skype technology will be possibly used. So visitors don't need to visit  in a tour place. A big challenge!

Other idea is a land mine detection system that touch a bit what I was doing in past. Or something totally new...

OK, this was a dreaming session and back to work tomorrow to make ground work

Wednesday, November 18, 2015

User Interface

Here is a proposed user interface with Visual Studio:


This is a starting point and grow, when other features are added. Now it needs code. Currently I can control wheels in the debug mode. 

Tuesday, November 17, 2015

Kinect XBOX 360 Installation

I tried to install the Kinect XBOX 360 camera to Eddie. It worked earlier. Problem is Windows 10 and hope Microsoft will fix it. The newer model with SDK 2.0 should work, but no plans to buy it. The new SDK won't support XBOX 360. For the time being Eddie is blind and it has to trust proximity sensors.

Monday, November 16, 2015

First C# Test

I can now control Eddie with MS Visual Studio/C#. USB connection works like RS232 Serial Interface! Routines are very same. I worked a lot with serial interface programming twenty years ago and I feel nothing has changed. It is now good to continue. I actually used a C#-code from the Net and then modified it for testing. Anyway, still very long way to go.

Sunday, November 15, 2015

New Eddie Control Board Installation

I installed the new Eddie control board and it is working. Wheels are turning and I can read distance sensors with Parallax Serial Terminal. I don't get info from position controllers. I think they are broken. Parallax warned they are sensitive and they have a new redesigned set of them. For a while I am not going to do dead reckoning, so let it be. Quite much work to recall all setups after three years.

New Start

Microsoft Robotics Developer Studio  is dead. Microsoft suspended it a year ago and won't support it anymore. Anyway, I am not going to give up. I'm going to "think big". So, the story goes on.

I have a dream building a robot, that uses databases and navigates with maps and geographic coordinates. I will use my former experience in this field and then create something new. Virtual Reality, Internet of Things and Cloud technologies give enormous challenges.

Currently robotic rovers are widely used and there is no pioneer work. I believe the ideas will pop-up. Now it is a learning time and combine the technologies I used earlier in my career. Typically I have been involved building prototypes and make pioneer work and I still love to do it. It is very challenging and needs hard work without counting hours.

I have been a Microsoft guy all my professional life  and I  believe that Microsoft is still innovating, not stuck in past. I have seen new Microsoft keynotes and I have a reason to believe so. Microsoft has now a new free Visual Studio 2015 Community Edition that is at professional level. It will be my tool and I will use C# as a programming language.

Other option is  to use Open Source platforms that are mainly used in robotics. Learning curve is too steep and I would need more time than with Microsoft technology that I have known. Software business is very dynamic and it can be possible that I have to go the Open Source, e.g. ROS (Robot Operating System with Linux). Anyway, the time is not wasted, because the software foundation is pretty same in all technologies.

Let's start with Eddie the robot.