Motoring A Web Cam

Journal Page

 

 

January 25, 2005

Today I was assigned my project of motoring a web camera.  The problem description is to develop a two-axis web cam that can be controlled over the internet.  Requirements are listed as follows: 1) The camera can be moved horizontally and vertically from a standard client web browser, 2) pictures are updated at the browser on demand, 3) pictures update in real-time with the time stamp of the latest picture displayed on the client's screen, 4) the system deals with nay racing conditions caused by multiple users, 5) the system deals with user permissions and maintains a log of usage, and 6) the system can center an object.  From here I got a copy of DDJ, October 2002 -- Two-Axis Real-Time Camera Control, by Cort Dougan.  After reading this journal it gave me a very broad idea of how where I need to go with my project.

January 27, 2005

Not knowing what to do to start my project I thought the best thing was to get the materials from Dr. Pankratz.  Looking at all the motors gave me alot to think about, so I decided that it would be best to get a plan to figure out where I want to start this project. I decided that the best thing to do was to try to first find a way to broadcast my images over my webpage.  After much researching on the web, I had come up with a couple programs, TinCam, and WebCam 1-2-3.  Both of these programs are used to stream live video from your website.  I could not seem to get either of these to work.  Also, the problem with these was that the computer that is going to view the webcam has to have Windows Media Player.  TinCam did have another option of setting up an image server, but I had no clue what that was.  Another problem was that I could not get the source code to either of these, as they are not free programs, so I really was not too enthusiastic about using them.  So the research went on again, when I ran into another program on the web called WebCam2000.  WebCam2000 is a free open source program compiled in Visual C++.NET that is used to grab an image from the web camera and put it onto an image server on port 8080.  After the research on video streaming and an image server, I felt that the image server was the best route.  I feel this way, because for streaming video you have to upload using ftp which is really slow.  Also, you need to have windows media player, quicktime, or real player installed on your computer.  By having the image server it is a better choice in that you do not need any of these programs installed on your computer, and it is extremely fast.  I can have it refresh the page every second.  From here I started to attempt to play with this program.

January 30, 2005

I decided that it would be best to first figure out the making of an image server in which the pictures will update online.  It is here that I am stuck right now.  I am practicing with a program online to take a picture and put it on a web server in which I can link this to my website.  The problem here is that I cannot seem to get it to work.  It works perfectly typing http:\\localhost:8080, but it will not work with my IP address.  I have port forwarding and a static IP set up already and nothing is working so far.  I tried looking through the knowledge database on both RoadRunner cable service as well as for my Linksys router, but I found no help here.  Everything I tried just left me where I had begun.  I tried getting a domain name to see if that would help and still nothing.  I also changed my IP to be static and still that did not seem to work.  I tried downloading Apache Web Server to see if that was what I needed, but quickly I realized that I am going way to technical and it is really something not too technical that needs to be fixed. I also tried unplugging the router to see if the router was the problem, and I still could not seem to get my server up and running.  I then decided to call up for Linksys Technical Support.  After trying to understand a man with broken English, it kind of left me with a waste of about 30 minutes and a headache, so I decided to just call it quits for tonight.

January 31, 2005

Still stuck on the program I asked some of the guys at computer services what it might be doing that is keeping me stuck.  They had told me that there has to be some sort of firewall blocking me from entrance, and otherwise what I have sounds like it should be working.  So I went on the router and found that there was a firewall enabled, so I disabled that.  Still does not work.  I made sure that Windows Firewall was turned off and it was.  So that left me with Norton AntiVirus.  Still no firewall turned on.  Finally I found it.  Norton Internet Worm was blocking me from accessing the port.  So I quickly turned that off and what do you know, the server works perfectly.  I wrote the JavaScript code for my IP address and got my website up and running. :):):).  I also made it so that it refreshes the picture every second, so I now have real-time pictures updating on the website of my room.  I went in and talked to Dr. Pankratz once again and we agreed that before I go into motors the next thing I need to do is to use Perl programming and try to turn off and on the camera from the web browser.  I also feel that I need to use my domain name server from No-IP.com so that my dynamic IP address will be updated on my website every time my computer is restarted.  Ok got that one down!  I now use the call http://paprks.no-ip.info:80/ for access to my image server.  Visual Studio .NET is finally installed after hours of an installation and I can now begin to look at the source code and figure out my next step in the project.

February 1, 2005

Today I tried to work with looking up perl information so that I can link to the web page to change settings on my visual C++.net program, but that did not seem to work out for me at all.  After hours of searching I seemed to get nowhere and just quit.  So I went back to the drawing board and thought that I should start doing some research on different motors.  I have been looking up information on servo motors, which can move 90 degrees each direction, or you can buy ones that will go 360 degrees.  I am thinking these will probably be my best bet, but from what I have found so far, it seems to me that I might need to buy a servo motor board instead of using the gadget board. I have also found a couple free programs on the web that can control the servo motors once I get it all figured out.  I have also looked up some brackets and such that I am thinking of using to mount the camera so that it can move on a two-axis rotation.

February 3, 2005

Today I was doing a lot of research on Visual Studio.NET.  What I was trying to do is to figure out how to access my c++.NET webcam2000 program from the website to turn on and off the camera.  Nevertheless, I did not seem to get anywhere but I learned a lot of information while trying.  Here is what I came up with:  To access program controls using visual studio .NET I can use either web services or remoting.  Web services is mainly used to package up a .exe program which one can download from the website.  From here, the client server can open this program, which can access information from the server program and change the settings.  This would be very useful if I had the client download my software and control the webcam from their desktop.  However, this is not what I want.  Rather, I want them to be able to do the controls at the browser level.  On the subject of remoting, it will be the better choice as I can access controls via a web browser, but tends to be very complicated.

I tried a remoting example to try to understand everything.  How this worked is that the client would put in two numbers, and the server does the addition and returns the result to the client computer.  This reminded me of my old networking labs, in which we were communicating back and forth. 

Not being able to find a solution to turning on and off the camera, I came up with the idea of putting a checkbox on my website that can change in picture on the screen, which in result will quasi turn on and off the camera.

Today I also did research on servo motors, and how I can control them via web browser.  I came to the conclusion that with an active x client and .NET remoting it is possible to do these controls!

February 7, 2005

I have been continuing my research on servo motors, and I feel that the best choice is to buy a USB servo motor board.  I have looked a few up and I think I found the best one for me.  It can control up to 4 servo motors, and comes with software in numerous languages to aid in developing your robotics projects.  The kit can be obtained at www.phidgetusa.com.  I have also found accessories for my motors which will aid in tilting the camera up and down and left and right.  These can be purchased from Images SI, Inc.  The product I am going to need is the ServoMotor X-Y Mount.

My next step in the project is to continue research on how I will access my webcam2000 program from the web browser so that I can have a zoom feature among other things.  On this subject, I have done some research, and I found a way to do it with TWAIN and ActiveX controls, but the problem is that you need to have an SSL certificate to do this, which is not free.  For this reason, I am going to try to stay away from this path and keep looking for a better solution to my problem.

February 9, 2005

Today was a pretty big day for me for not planning on working on the project at all.  So I call up my mom at work and have her try my website to show her what I have done so far so she can see me moving around.  Well here is where the big thing came in my project.  The picture did not auto-refresh like the code has it do.  I didn't think anything of it, just thought it was an old computer, but I decided I need to go to the computer labs and give it a real test.  So I get to work and try it out, and guess what, no auto-refresh.  I looked up settings online to see what could be wrong, and I called my roommate to change a setting on it.  Well that did not work either.  So I tried to remote desktop to my computer so I could change the settings, but for some reason that was not working today either.  After work I went home to try some new things. First I went on instant messenger to have my brother in Atlanta do the testing from the client side.  From here I implemented two other auto-refresh javascript functions.  Well these did not work either, and the best refresh rate he was getting was at about 2-3 seconds.  So for my third try, I used a java appelett.  While the stories repeats, cause that was just as fast as the two. Now at a stump in my life I decide that I need to just get a new webcam open source program.  I first tried VLC media player, but that did not work, as it is a program a client can download to connect to the stream on my computer.  So then I did some more research where I came up to find the program Dorgem.  Dorgem is a webcam capture application just like webcam2000, except that it also has ftp capability.  So I tried this ftp capability, but that did not seem to work either.  It took up all the resources on my computer making it slower than ever, and the refresh wasn't even working on my computer.  By this time my brother had to retire for the night, and get home from school.  After playing around with Dorgem for a while, I changed some settings to make the picture resolution much worse, but it also makes the file smaller for a faster refresh image download rate.  So from here I contacted one of my SNC buddies and had her contact my server (with the original refresh function and Dorgem), and wah ha ha it works perfectly. It is refreshing faster than a second.  So yay! I am back where I thought I was yesterday, but so much farther in reality. I am just glad I was able to get it all fixed before I retire for the night.

February 14, 2005

After class today I decided to work on my project again.  This time I was looking how to access the Microsoft Image Driver from online.  I was doing this research in order to call a zoom without having to use DvDriver since it is not a free program.  The only way I found on the web was to use Java programming.  I tried and tried for a few hours of working on it but I did not seem to get anywhere.  The problem is that I am using a Logitech Quickcam Pro 4000, and any camera by Logitech 3000 and beyond their developing kit does not work for.  Also, if I use Java programming then the my project wont be too extendable, as it will be only useable with the the Logitech 4000 camera.  So for this reason after a number of hours of research and trying things out, I decided that what I have now is the best and I should just leave things how they are.

February 16, 2005

Here I have my client-server picture up to show how the process works so far in my project.

February 17, 2005

What a night! What a night! As I cannot sleep from last night, I decided to just go grocery shopping at 5am and now its 6:20am doing my journal! So for my project, I thought that it would be necessary to have something that people can always view in my bedroom since I am not always here.  For this reason I am buying a dog today! So here is my first added addition to my project that I was not assigned. Giving a prop for people to look at and move the camera around at (once I get the servo's up and running and in the mail and everything else).  So for the story:  I was planning on getting a Boston Terrier for my graduation present from my parents, but the thing is that my mom knows that she will have to take full responsibility for it, so she is sketchy about me getting another dog.  But anyways I was looking through the classified ads as I was sitting in the sauna at the YMCA when I came across an add for a 2 year 2 month old long-hair Chihuahua that is litter-box trained for $50.  So I called them up and they said someone was looking at it between 5-6 pm.  Well I was waiting and when 9 rolled around I called and he said it was sold.  I was a little bummed and was looking up other breeds online when at 9:40 he called me back and said the dog is mine.  The other people didn't think it would get along with their cat and did not want it anymore.  So today I am picking up my new dog and addition to my senior project! Here is a picture of my puppy just in case you have not seen Lar-Z-Co yet.

February 22, 2005

Later that day on February 17th I picked up my dog and then I went to Dr. Pankratz and showed the little puppy, went to the store and came back to pick up my equipment that I ordered.  I received the servo motors as well as the pan and tilt kit that I ordered. I had to go home this weekend for a funeral and wake so I knew I would have no time to work on the project.  I decided to bring my parts home anyways.  When I got home I decided to plug in the servo motors and experiment with the servo board.  I first downloaded the test programs from www.phidgetusa.com and tried all of the servo examples.  Some of the examples showed that the servo was attached while other ones did not, and none of them worked.  I couldn't figure it out for a long time until I unplugged the servo motor and plugged it into the far end port all the way to the left.  After this was done it worked great for me.  At first I thought it was a USB problem and kept on restarting the computer and uninstalling and reinstalling drivers and whatnot.  The speed of the servo motors really suprised me.  The motors move very very fast, actually faster than the camera can capture the image.  This is going to pose a problem with the web server.  The problem is that the web server does not update very fast, and on some computers it may take 1-2 seconds to refresh the image. So by the time it is refreshed the servo might have jumped 180 degrees. For this reason, I will take this into account when I begin programming to make sure that the speed can only go so fast.  I also need to set stops so that the motors can only turn as far as I would like them to turn.  That is if I feel that there is a problem with them going the full throttle or not.

With the help of my dad, and a visit to both radio shack and the hardware store, the construction was about to begin.  From radioshack I purchased a case to put the circuit board in so that it would be protected, and I also got it so that it will be the base of my project.  We tried various designs with the motors to figure out how I could construct it, and finally we found a way.  Then we had to find out how we would mount the actual camera to the motors.  After a while of pondering thoughts I tried taking apart the base that came with the logitech webcam.  I was able to take it apart and take the rotating part, and attach it to one of the universal mounts for the servo motors.  Once this was attached we put the whole thing together.  To make it so that the base would not tip over I had to put washers in it which are currently taped down.  We drilled 2 holes in the side for the USB and the power cord to plug into the circuit board.  Another hole was drilled to allow the servo motor cords to go into the box to be plugged in.  After this we hooked everything up.  Once done, I was playing with it and realized that the pan and tilt only worked for one position of the camera.  So we were back to the drawing board.  After experimenting with the motors we decided to switch it from having the base turn the camera up and down to that the base turns the other motor left and right.  Then the second motor is what turns the camera up and down.  This way pan and tilt work in all situations!  Perfect.  So we screwed in the motors in the base a new way without the parts from the hardware store and everything works great.  A couple of pictures are shown below.

One problem that I have been contemplating lately is with the image server.  Although the image server refreshes at streaming speed from my computer, it tends to go slower from remote locations.  I have seen performance on other computers refreshing anywhere from 0.5 seconds to 2 seconds per picture. For this reason I would like to introduce streaming video but that opens up an array of other problems.  By having streaming video over ftp it would be much smoother, but the problem is that compsci is really slow.  I don't seem to have uploads faster that 4.5kb/s. Because of this the stream would never finish uploading before it needs to be displayed so the project would always be buffering. So in conclusion I feel that using Dorgem is still the best thing I can do for my project.

One last thing that I did today was contact PhidgetUSA because they forgot to send me the power cord.  They emailed me back and are sending it 2nd day air.  So until that comes I will have to let the motors rest. 

February 28, 2005

I just did some more research on streaming video, and I found a new way to to it. I am using realproducer basic 8.0 which I was able to obtain from a russian website since Real does not use it anymore. But it is a free program so it works! But the way it works is streaming audio and video. I am at the labs so I don't have my webcam with me right now, but I practiced with the program using a pre-recorded audio file and it works great. Here is the site for that: http://compsci.snc.edu/cs460/paprks/New.html

Later today I will try streaming to see where I can get with that. Also I talked to phidget online today and asked them about integrating controls in the web browser. They said that they are currently working on it now and it will be done end of march. But they way they are going about it is to have the client end download the phidget library to access the server to run the controls. (that is for visual basic script). But I have no clue how to go about this part. But from phidgets I have java source, visual basic source, c++ source, labview source, delphi source, and visual basic script source. And I just need to figure out how to integrate that part online..

Ok so that first real thing did not work as you have to pay for a RealServer to get it to work. So I have a website up right now http://compsci.snc.edu/cs460/paprks/frame.html that shows 2 examples. One which is Streaming using TrackerCam program and its java applet. The other being the image server. At first the image server was faster by about 2fps but then it slowed down and it often shuts out and does not show a picture. On the other hand, the TrackerCam at first seemed slower but is very very consistant. So all in all he suggested the TrackerCam as the best source. Also, the TrackerCam page can be loaded using a cell phone with internet capabilities which seems like it can be a plus. Testing was done by Jon Barber from the lab as I worked here, and so TrackerCam now proves to stream a little better.

But the problem with TrackerCam is that it is not as easy to use.  If you are connecting to the internet with a router then you have to change a number of settings to get it to work each time you open the program.  Dorgem is much easier to use and has a great logging ability already built into the program to log the users that connect to the server.

March 1, 2005

Today I was trying to research how I can actually control my motors from the Internet.  I tried many things and did not seem to get anywhere. I thought that .NET Web Services would be the way to go, but after practicing with it for 4 hours I really don't feel that it is going to work like I wanted it to.  I can invoke a web service which can compute say Celsius to Fahrenheit.  The client computer would run my vb program and when they enter the degrees Celsius it will compute it on my server computer and return the result to the user.  Maybe this will work to run my program.  But it seems doubtful.  And I am back where I started.

PART II

I am about to cry i am so excited. I just worked on web services for 4 hours and got NO WHERE. Just about to quit I tried on my own designing a VB ASP.NET Web Program. And I used the basic VB servo program that tells if it is attached to take code from and transfer it and everything of the such. And guess what! My brother was able to move my servo. It didnt say it was attached, but everytime he hit refresh it moved my servo! Which means I GOT IT! My program has overcome the triumph I thought I would never get through! SO now to program it so that I can have a slider that moves!  This first part can be seen here (even though it doesnt show the client end much) http://69.76.63.224/WebApplication2/WebForm1.aspx

March 2, 2005

Today I started to try to convert the servo-slider program over to a VB ASP.NET Web Application.  Here I ran into another dilemma.  ASP.NET does have a slider class.  So I tried looking it up online to find one and found nothing.  I kept this research up and found a javascript slider that I could implement. So I did that, and it showed a slider, but the VB code could not get access to it.  Later today I went and talked to Dr. Pankratz, and he suggested to just scrap the whole idea of a slider and to just use buttons that move it at a specified increment.  So I figured this was my next step.

But before I went on I had to contact Phidgets.com online help.  I had to tell them that I got remote access to the servo-motors, since they said that they cannot figure anything out yet.  Well they were really impressed and I stepped them through how I accomplished the whole feat.  I had to start with having to add registry keys to make it so that I could convert the Visual Basic 6.0 project into a Visual Basic.Net application, and from here from that to a Visual Basic ASP.Net web application.  They told me that they will use the help that I gave them and write it up so that when others call about problems with converting they can help them out, because in the past they have been telling them that they don't know how to convert it to .NET.  They also request that I get back to them on my progress of my project when I actually get the servos up and running so that the client can change the settings.  And this all reminded me of why I actually got into computers. In my wrath as a teen I kept on crashing the computer, and not knowing where to fix it I would call Technical Help.  Well that never went good, as I solved the problem before they did about 99% of the time.  So this was a big accomplishment of a day for me!

Later this day I started the conversion process.  Well guess what, it was not working at all.  I couldn't even get the client to say that the servo motor was attached.  So I knew I had a problem.  Thus, I went back to the drawing board.  I opened back up my web application that just moved the servo and had no user controls, and decided I would try everything to try to get it to display the servo that was attached.  It just would not work for me.  So then I went back on Phidgets.com and downloaded their vb sample program that had 4 servos and a ton of different options.  I noticed here that the way the servo's were opened was a completely different way than they other two that I have been working with.  When I used this example and coded up little sections I was able to obtain data from the phidget.  So now I know how I will start the actual project coding.

March 3, 2005

After class today I started coding the page to have it so that you enter a text value and the servo will move to that position.  It took some time but I finally got it to work, and from here I tried the min and max values.  The min and max posed another problem. I once again could not access information from the phidget.  Finally I figured it out, I needed separate function calls and not just coding in the sub.  And here my problem was solved.  I had to use functions to access the phidget to get the actual information from it.  So from here I coded and coded away and well eventually I got it up and running.  So far on the project i have both pan and tilt control.  The client can enter a max and min value and set it, and the servo cannot move past these settings.  The user can enter an angle and press go, and the servo will move to that position.  One last thing is that the user can enter an increment value and move the servo motor by the increments.  The program shows the motor value, and lastly shows the actual angle value that is returned from the phidget device.

The next thing I have to do is first organize for my presentation. But next, I have to make it so that it is more robust. I need to make it so that if a user enters anything but a number it gives them an error message.  After this, I will start user authentication for my website.  Here is the address for the web application: http://69.76.63.224/WebApplication2/WebForm1.aspx

Later today I added a new program link to the website being Project Steps.  This link is here for the general public to look at and understand the steps they would need to go through to understand the steps in making the webcam design and steps for them to develop their own webcam for online access. It includes bypassing firewalls to bypassing routers, to installing the .net components to have make a computer a web server, to going through the parts to buy, and even goes and steps through the process to put together the webcam and motors like I have in my design.

By the way: I have been hooked, but I am cooling off now! I wanted to get some of this out of the way this week so that next week I can focus on my Christian Traditions paper, Accounting test, and Accounting project.  That way the day before the walk-though I wont have much to do to prepare!

I almost forgot:  I talked to the guy at Phidgets.com and told him that I have my beta project done.  He had me change the values for the max and min so that it never gets to the end where the motor gets stopped on its own. This way we won't have to deal with any broken motors. He also wants me to try to get it so that when the program starts, it starts from where the motors left off at.  I did not get to that part yet.  Once this is all done or once I am done and organized he is going to put a link from Phidgets.com to my website to show that the motors can be controlled remotely.  He will also put my whole project on there for people to download so that they can use their phidget projects remotely as well. 

March 7, 2005

Today I worked on trying to get my project so that it works on a remote computer.  It took much effort, as nothing was working for me.  I tried xcopy as well as the copy inside of visual studio.net but neither would work.  I also tried the last way in which you build an external program to run on the remote computer.  I was able to make it and add all the references, but every time I tried to build it, it would come up with an unrecoverable build error.  So I tried more with the copy and installed all the necessary steps on my roommates computer.  It still would not work.  I tried looking up all the errors that showed on his computer when I used the copy from visual studio, and I got no where.  I kept on trying new things but nothing seemed to work. Finally I decided to look up the error in my build of the other way to deploy a web application in which I make a .exe.  It was here that I finally got somewhere.  I had to reinstate one of the .dll files and once I finished this, everything seemed to work.  I installed it on my roommates computer and it worked great. So after that I took off visual studio from his computer, and tried it again and it still worked.  Thus, I found out that the only two things one needs to deploy my web application on a remote computer are 1) .NET framework and 2) IIS installed and configured on their computer with Frontpage extensions.

March 9, 2005

Today I fixed my visual basic form so that it looks a little nicer, and made some error corrections.  The rest of the day I will make everything up for my presentation tomorrow, and get Dr. Pankratz's computer so that I can have my application run on his computer during class tomorrow.

March 10, 2005

Today I got a drawing on the website that shows the client server operation of what is going on with my program.  I am now ready to present...

March 14, 2005

After class I decided it was time to do some more research on user authentication.  What I have come up with is that there are three ways with asp.net: 1) Windows 2) Forms 3) Passport.  The windows authentication is the easiest, but the only way to add a user is for the programmer to actually do it.  The client cannot do this because the user names are stored in the Web.config file which cannot be changed while the program is being run.  The third item, passport authentication is actually really cool.  It is authentication using your hotmail email address, msn passport account among others.  I practiced using this last week, but after some time I realized that you have to pay for this service.  You can develop and have a test account but to actually publish costs around 10,000.  Now for the last authentication, forms, the client and server can both add users.  To do this, the user name and passwords are stored in a database.  Three options here are an SQL Server, Microsoft Access Database, or an XML File.  I first did research on having a Microsoft Access Database.  After some testing, I found that you need to be running an SQL Server for it to work.  I figured this was just going to be too big of a mess.  I did however download the free SQL Server and start to try it out.  I really quit because I realized that I could just have a XML File store the database entries.  I thought this was the easiest thing to do.  So I went through numerous tutorials and finally figured it out.  I then added my generated code into my project and changed some settings around.  A lot of errors did come with it however.  I could not seem to get access to my adduser.aspx page.  To solve this problem I had to add extra code to the web.config file in order to give that file special permission to allow all users.  The problem was before that it wouldn't load because the user did not enter their username and password.  The next problem that I ran into was adding to the users.xml file.  I kept on getting an error message saying that access is denied.  I had to change IIS settings to allow write to the whole program. I also had to make it so that it can run both scripts and executables.  After this I had to go to the users.xml file in IIS and go through the permission wizard to inherit the changes from the main folder.  Now it works great!  To conclude here, I now have an XML based database that stores the user name and password.  I have implemented it on my website, you cannot move the camera unless you first log in. The next thing I want to work on is racing conditions.  Once I am done with this I need to do some error checking and wrap it all up.

March 29, 2005

On Dealing With Racing Conditions & Multiple Users:  First off I have to say I wish that I would have done this write-up before spring break because everything here was done then and all my tries are what I can remember and I am sure there were more tests.  But anyways here we go....

I practiced before spring break a numerous amount of things to figure out how to limit access to users so that only one can go online at a time.  First I set up a second database.  I had it so that whenever a user logs in, it checks the database and if it is empty then it adds the user to the database and gives them full permission.  Then when they leave it should delete there name from the database.  If another user comes on and sees that there is one already in then they have to wait.  They are added to the db.  I used a method here of obtaining their IP address to store them in the database.  I had a timer so that after a certain amount of time it would delete the name from the list and make the session end by redirecting the page. The problem here is that if the person left without the timer running out then their name would never be deleted from the list.  Also there is no way to refresh the page for person waiting to determine that they are the next runner up.  So they have to click the login button again and wait to see if they get in or not (getting in if they are on the top of queue or it it is empty).  So then I something different for the users without permission to have a sleep timer.  I would have them sleep for a designated time, and then check if they are next up and if not sleep again. If they are then it would redirect them to the pan and tilt page.  Problem here is the sleep slowed the client computer dramatically and sleep makes the program freeze.  Another problem was with the IP address.  If the user is using a computer with a router then it will have that address.  If two people have that type of router then the next person wont have access.  For example, all linksys routers are 192.168.1.1.  And with that I think it is time to move on.....

The next thing I thought would work is to check the number of concurrent users that are connected to my website.  And if it is >1 then do not grant access.  This example is using the global.aspx file and queries a SQL Microsoft Access Database.  Well this seemed like a great idea and almost worked for me.  It would add to the database a number when the session starts.  When the session ends meaning the user left, it deletes them.  This brought upon me some more problems.

1. So here the user logs in and the first user gets permission.  Now other users have to wait.  Problem from before is that there is no way to check if the next user has access unless they constantly press the login button again and again. 

2. Min Session = 60 seconds   I wanted the thing to be more at like 30 seconds, or 10 seconds for testing purposes.

3. Any time a button is pressed the session time starts over.  So I still need a timer in the program.

4. Session does not automatically end when a browser is closed.  There is no way to tell that the browser is closed except for that once closed there is no activity.  Thus, 60 seconds later they are deleted from the list.  Problem is that since there is no way to tell that a user left, one might leave after 10 seconds of activity, and then the next has to wait 60 seconds before access.  Well that is no good.

5.  SLOW.  Any code in the global.aspx file slows the program down. By querying to a database it is SLOW. So for remote computers, this brings about a huge problem of waiting for the users.

6.  Even if I have a timer, if the timer does not run out and end their session before the window is closed, then the next user still has to wait the 60 seconds.

So what I did to try to solve some of these problems....

First I tried to make it so that I would check the number of users online. From here I would add them to the database and have tit check to let me know if multiple users are online.  Well then have a timer 30 seconds which when it runs out it makes all the controls read only and the session is automatically ended! This seemed to work.  but the timer really does not work as accurately as it says it does.  20 is supposed to be 20 ms.  When I put in 19, the timer is out before the program ends.  when I put 20ms it waits about 30 seconds.  When I put 21ms well it does not seem to ever end.  So that imposes another problem here. I also added a logout button which terminates the session.  This way the next user should be able to have access right away.  Problem is that if they do not press this button, and press the X button, then we still run into all the problems that we had explored earlier.  Plus another problem with this is that since the database store number of users and not the names, the next user to get access is really by luck in pressing the login button.

So what can I do to have fast access that deals with multiple users???????????  For now I am stuck at this point.  Problem is that since this is a server driven program I have to query to a database.  Otherwise just using an array to store information, it will only be stored on the specific client computer. Thus, we have to go back and forth between the client and server computer, and every time this is done it just slows the whole process down a little more.  Realistically however, I should not have to run into too many situations where there are multiple users.  However, this is a huge computer science objective and seems like it really should be handled.  But with the database access what is more important? Speed or someone moving the machine right after you moved it.  With my examples that I have imposed it seems that the best thing would be the speed, so they can at least access the camera controls without having to wait 30 seconds just for the page to load with all the client <-> server problems going on.   However to wrap it all up I really hope I can find a faster and more reliable way to do all of this work. So I guess it is just more and more research and problem solving to try to figure this out.

 

April 6, 2005

Last thursday I had a meeting with Dr. Pankratz and we went through some of the issues I am still trying to deal with.  1. Timers.  I cannot seem to get timers to work.  To solve this problem I did more research, and there is a problem with server based timers.  They just do not work right and there are always memory leaks.  To get around this problem I got a new solution.  It was a lot of thinking and it was a lot more of work and a lot more of trying hundreds of things.  But in the end...  I have a meta refresh call from my main page.  This timer works!  So after the user does not press any buttons for a specified time (i said 30 sec), then they are redirected to another page.  This page then tells them they do not have access, decreases the current user count (deals with my session timeout problem) and then closes the window.  WELL this was a big problem.  I could not seem to get the counter to decrease.  Eventually however, I realized i can import the variable from the main form and change it! After hours it works great. 

The second thing we discussed was my session timeout. I described this above in my other problems.  To solve this I made it so that when the user clicks the X button a message pops up telling them to press cancel and close from inside the main form.  The main form now has a close program button. When pressed it first terminates the session and the form. After this it decreases the current user count, and lastly it uses javascript to close the page.  This was another thing that led me to many upon many of problems.  (this was actually before the first step that I mentioned above).  After I finally got it solved I moved onto the refresh problem mentioned above.  Once this was done I was a happy kid cause I finally figured something out to solve my huge counter problem.

The third and last issue that we discussed was on the issue of slowing down the servo motors.  Before I was going to go through all the code, I contacted the Phidgets company and talked to them to see if it was possible.  They told me that it is not possible.  The only way to do this is to have it increment at a lesser setting.  I have practiced with this before, and now I will set the default to be 4 instead of a 10 step.  For the total move, I think that the when one presses go you would want it to go fast, and I think I will just let it go.  But to slow this down I would just take the number divide it by some smaller fraction, and then do a loop that will keep going till it gets to the destination.  In this loop I would have it so that the motors move by the small increment that I calculated and then sleep for a short number of time, and just keep looping on that.

Another thing I did today was to start documentation on my code.

Next, I made another page so that if there are users in the program, then after logging in the multiple users are redirected to another page that tells them they do not have access.  Otherwise my close button which decremented the current counter value of number of users would not work.

The next thing I have to do is prepare for this presentation on Friday.

For my project I still have to deal with minor error handling, the timer thing if Pankratz thinks it would be a better idea to do it that way, more documentation. 

 

April 11, 2005

On Friday I had the poster presentation in the Campus Center where I displayed my project.  That went well and I realized I have to add one thing to my project dependency list to make sure that when I put my project on a remote computer it will allow people to add new users.  Today I did that fix as well as my error handling.  To do this I had to add custom validation controls to the textboxes that allow input.  Then it calls JavaScript functions to make sure that there are only numbers that are entered.

 

April 19, 2005

This weekend was full of computer problems.  I ended up having to format my computer and reinstall everything.  I was really scared at first about screwing up my senior project but I knew I had to do this so I did it anyways.  When all was said and done, I moved my project folders to the appropriate locations and well it all worked (after reconfiguring IIS and a few little things).  So all in all it ended up being a good thing as I was able to learn of a second way to move my project to a remote computer.  So now I have both copy and paste as well as the .exe file.

After class today I finished up my documentation (well for now).  I think I may still have a little more on the main page but it is just so long that I get tracked away. But it should be done.  I also made a new log of usage.  Now when the user logs in his username is stored as well as the time and day that he came onto the system.  So that was a big plus.  2 logs.  One which is from the Dorgem program and one which I wrote myself. Mine is much better by the way! That is because the other one every page refresh puts a new entry in, and I have that page refreshing every second.  So mine is much much better.  Also, that one stores the IP address where mine stores the user name!

Today I also set up more web page instructions to guide through the process of deploying my web program as well as modifying it.

April 26, 2005

In the past week I got everything ready for my presentation today and have the binder completed.  I have all files uploaded onto compsci, and made all fixes to account for folders that were previously used.  I also have the cd ready to burn.  So now to print out the journal page for my binder...