UNIVERSITY OF CINCINNATIceas.uc.edu/content/dam/ceas/documents/UC Center for Robotics...UNIVERSITY...
Transcript of UNIVERSITY OF CINCINNATIceas.uc.edu/content/dam/ceas/documents/UC Center for Robotics...UNIVERSITY...
UNIVERSITY OF CINCINNATI
November 25______ , 20 03___
I,__Dinesh-Kumar Dhamodarasamy________________,hereby submit this as part of the requirements for thedegree of:
Masters of Science________________________________
in:
Industrial Engineering____________________________
It is entitled:
Web Control of an Autonomous guided vehicle using _
Java Servlets & JNI______________________________
_______________________________________________
_______________________________________________
Approved by:Ernest L Hall____________Richard L Shell__________Ronald L Huston_________________________________________________________
Web Control of an Autonomous Guided Vehicle using Java Servlets & JNI.
A thesis submitted to the division of
Graduate Studies and Advanced Research
of the University of Cincinnati
in partial fulfillment of the
requirements for the degree of
MASTERS OF SCIENCE
in the Department of Mechanical, Industrial and Nuclear Engineering
of the College of Engineering
2003
By
Dinesh-Kumar Dhamodarasamy
B.S Mechanical Engineering, Anna University, 1999. M.S Industrial Engineering, University of Cincinnati, 2003
Thesis Advisor and Committee Chair: Dr. Ernest L. Hall
Abstract
The field of robotics has benefited enormously from W.W.W (World wide web) – a
technology that has taken the world by storm and changed the very way information is perceived
& processed. Human – mobile robot interactions can always pose a serious threat to the
person(s) operating the robot. The University of Cincinnati robot team apparently faces difficulties
when it takes the robot out for either a test-drive or for contest/presentations. Bearcat III is
presently controlled by a C++ algorithm invoked from keyboard commands. Sometimes, robot
speed builds up with continuous keystrokes (forward/reverse) and the robot suddenly jerks,
posing threat to the person(s) operating. This work aims to implement a web control system of
Bearcat III that will minimize man-machine interactions.
A web interface was developed to control the robot from the internet. This interface
consists of a portable java web application that communicates with the already existing C++ code
(Heart of Bearcat III). The application is accessible by means of front-end JSP pages to any
computer connected to the internet. This JSP front end communicates with Java servlets (server
side java programs), which in turn invoke the C++ programs through JNI (Java Native Interface).
This application will rely on live video streaming of the Bearcat III robot in space. The robot will be
relayed live on a JSP page, so that a web user can use the appropriate controls on the web page
and move the robot. The result is, everything can be controlled from this web interface and
probably from a remote computer without manually typing keys in the robot's computer.
This application will greatly minimize the human interaction with robot. Also, since Java
has the capability to interface with native languages like C++ & C, various other systems of the
robot can also be configured & controlled from web. The application will open new avenues for
other functions on the robot's system to be controlled from web.
Acknowledgement
1. 5 years of involvement in the U.C robotics Team with a tech savvy & creative technical
group and mentor has indeed helped me progress tremendously both in my personal and
professional life. With sincere gratitude, I put forward this acknowledgement.
First and foremost, I would like to thank my academic advisor and guru, Dr Ernest L. Hall
for his constant appreciation and positive criticisms throughout my graduate studies at the
University of Cincinnati. Without his support this work would not have been possible. His
suggestions, criticism and feedback greatly refined my work.
I would like to thank Dr. Richard L. Shell and Dr. Ronald L. Huston for agreeing to serve
on the defense committee. I would also like to thank them for their valuable comments and
feedbacks.
Last but not the least, I would like to thank my family, friends and U.C robot team
members for encouraging me during my graduate study and thesis work.
1
Table of Contents
Chapter 1 INTRODUCTION. Page Number
1.1 Objective. 5 1.2 Organization of Thesis. 5
1.3 Bearcat III Systems. 6
1.3.1 Vision system. 6 1.3.2 Electrical system. 8 1.3.3 Mechanical system. 81.3.4 Global Positioning System (G.P.S). 9
Chapter 2 MANUAL DRIVE SYSTEM.
2.1 System and it’s functioning 11 2.2 Disadvantages 13 Chapter 3 JAVA SERVER PAGES (JSP).
3.1 JSP Architecture 14
3.1.1 Object Scopes 15 3.1.2 Forwarding requests 16
3.2 How do JSP Pages work? 17 3.3 JSP Advantages 18 Chapter 4 JAVA SERVLETS.
4.1 The servlet Life Cycle 21 4.2 Installing servlets 23 4.3 Using Servletrunner 23
Chapter 5 JDBC.
2
5.1 Basic JDBC Architecture 24
5.2 Connecting to the Database 26
5.2.1 Loading the JDBC Driver 26 5.2.2 Connecting to a data source. 27
5.3 Interacting with a Database 28
5.3.1 Statements 28
Chapter 6 JAVA NATIVE INTERFACE.
6.1 Writing a Java Program with Native Methods 32 Chapter 7 VIDEO STREAMING.
7.1 Technology 39
7.1.1 Streaming techniques 40 7.2 How it works? 42
7.3 Streaming requirements 42 Chapter 8 WEB APPLICATION DEVELOPMENT. 8.1 BEARCAT Drive Login JSP interface. 43
8.2 New User Registration J.S.P interface 44 8.3 Main Drive Interface 46 8.4 Web Interface Lay out 47 Chapter 9 CONCLUSION & RECOMMENDATIONS. 49 References 50 Appendix A Programs related to web control of Bearcat III.
3
List of figures
Chapter Number Page number
1.1 Front View of Bearcat III 10
2.1 Bearcat III menu options. 11
2.2 Bearcat III Manual Drive options. 12
3.1 JSP Translation Phase 15
3.2 Object scopes 16
3.3 Web request processing 17
3.4 Request/Response flow calling a JSP page 18
5.1 Basic JDBC Architecture 25
6.1 Java & C Language gluing with JNI 32
6.2 Hello World JNI Implementation 33
7.1 Web Casting schematics 40 7.2 Popular streaming techniques 41 7.3 Schematic depiction of Live Streaming 41
8.1 Bearcat III Login page 44 8.2 Web Registration form. 45
8.3 Bear cat III Web Interface. 47
4
Chapter 1: Introduction
The Center of robotics research at the University of Cincinnati has been a participant at
the international ground vehicle competition (IGVC) for over 11 years. The robot team is also
involved in several outreach activities like seminars and presentations. The BEARCAT III has to
be tested in periodic intervals of time to fine tune performance and detect any problems. More
often, the robot must be driven manually when it is to be taken out of the lab or when it is to be
taken in crowded areas. Currently, this is done through the use of a C++ menu driven interface on
the robot’s computer.
This menu instructs the person to press keys to control the robot. For example, for
forward speed increase to the robot, number 8 in the keyboard should be pressed. Sometimes,
due to synchronization problems between the motion control system and the C++ application, any
key pressed is not instantaneously transformed into the appropriate robot action and when the
user repeatedly presses a key, all the key actions accumulate and suddenly render the robot a
jerk motion due to the sudden increase of speed.
This poses a safety problem to the person operating the robot, and to the robot as well.
Therefore, a new application is required to be devised to minimize this human interaction. With
the rich technology of W.W.W, the robot can be controlled from a remote computer. Now, this
presents us with 2 options –
♣ To control the robot from a remote computer in the vicinity of the robot.
♣ To control the robot from a remote computer miles away from the robot.
Option 1 is straightforward; there should be a web application that resides in the robot
computer (to be made the web server) and this application should be accessible from any remote
5
computer with internet access. The robot will be controlled from a computer other than the one in
the robot, while the user also parallely sees and moves along with the robot.
Option 2 requires the same capabilities as option 1, but facilitates robot control from a
distant computer, without the user directly seeing the robot. Here, the robot will be web cast live
through the use of live video streaming technology. The robot will be viewed at the left side of the
web application interface, while the user controls exist toward the right.
Option 2 is studied in this work, which will also be applicable to Option 1 under any
circumstance.
1.1 Objective
The objective of this work is to develop a web based control system of Bearcat III. This
application will provide for robot control from web, without manually requiring to type keys in the
robot computer. To ensure safety & reliability when operating from a remote computer, the robot’s
motion in space will be web-cast live through the use of live video streaming technology. Also,
any user to this application will be authenticated through the use of a database. Java was chosen
to be the development tool due to its portability and ability to interact with the already existing
C++ systems. The ultimate features of this web-based application are
♣ Functionality to check for user authentication.
♣ A user-friendly JSP interface that controls the robot movement.
♣ Capability to enroll new users.
1.2 Organization of Thesis.
6
This thesis is organized into several chapters to document the ideas and technologies
used. As an introduction, section 1.3 describes the various systems & components of BEARCAT
III. Next, the current C++ system used to manual drive the robot is explained and disadvantages
brought out in Chapter 2. Two options of web control of robot are being discussed. Chapters 3
through 6 discuss the various java technologies that were used to design and develop this web-
based application.
Chapter 7 talks about the video streaming technology and vendors in the market. Chapter
8 describes the proposed web control system; it’s functioning and brings out its advantages over
the current manual robot-driving scheme. Chapter 9 concludes the work and provides
recommendations for future improvements.
1.3 BEARCAT III SYSTEMS
Bearcat III is an autonomous guided vehicle designed & built by the University of
Cincinnati robotics team. This robot is equipped with features like obstacle avoidance & line
following. Navigation capability of this A.G.V is achieved using the global positioning system
(G.P.S). It looks similar to an automated grocery cart.
The main components of the Bearcat III robot are (1) electrical system, (2) vision system,
(3) mechanical system, (4) GPS system, (5) object tracking system, and (6) steering/motion
control system. All these components are integrated and work in synchronization, controlled by a
DOS operating system CPU.
1.3.1 Vision system
The vision system of Bearcat III is primarily vested with line following and pot hole detection
capabilities. The system comprises of a pothole detection camera atop the robot, and 2 digital
cameras mounted on either side of the robot for line following. A switching unit is entrusted to
7
switch vision between these 2 cameras. ISCAN tracker is used to process the image of the line;
the tracker finds the centroid of the brightest or darkest region in a captured image. The three
dimensional world coordinates are reduced to two dimensional image coordinates using
transformations between the ground plane and the image plane.
Vision calibration technique is used to reorganize 3 dimensional images and map it into 2
dimensional co-ordinates. The objective of the vision system is to make the robot follow a line
using a camera. At any given instance the Bearcat tracks only one line, either right or left. If track
is lost from one side, then the central controller through a video switch changes to the other
camera.
Object detection system
The 2 systems in place for obstacle detection are
♣ Rotating sonar sensor, and
♣ Laser scanner system.
Sonar system
The rotating sonar mounted in front of the robot senses the obstacle. With the width of
space occupied by the obstacle and its distance from the robot, the obstacle is navigated around.
The two main components of the ultrasonic ranging system are the transducers and the drive
electronics. The sonar sensor is mounted on a brushless DC servomotor for rotation in different
directions. Sonar system is powered by a 12V DC, 0.5 amps power source.
The SONAR transmits sound waves towards the target, detects an echo, and measures
the time elapsed between start of the transmit pulse and the reception of echo pulse. Adjusting
the system parameters of the Polaroid and synchronizing them with motor motion helps
8
measurement of distance at known angles with respect to the centroid of the robot. The range of
the system is 40 feet.
Laser Scanner
This is a new enhancement for obstacle avoidance. With Laser beam, the width of the
light sent out can be much narrow than the sound from sonar. Also, the velocity of light beam will
be faster than the sound wave from Sonar. The Bearcat III uses the SICK Optics laser scanner
for sensing obstacles in the path. For the robot, a range of 8 meters with a resolution of 1deg has
been selected. The scanner data is used to get information about the distance of the obstacle
from the robot. This ultimately is used to calculate the size of the obstacle. The CPU software
C++ performs the obstacle avoidance logic, and integration with the motion control and Line
following systems.
1.3.2 Electrical system
The electrical system has the following specifics.
♣ 36 Volts DC, 4680 Amp hours (Three 12-Volt DC, 130 Amp hours, deep-cycle marine
batteries connected in series) power source.
♣ An AC power system accomplished through an inverter (36 Volt, DC input, 600-Watt).
The inverter supplies AC electrical power for all AC systems including the main
computer & cameras.
♣ A UPS that provides 3 minutes of emergency power to the main computer during AC
power system interruptions.
1.3.3 Mechanical system
9
The mechanical system of BEARCAT III has the following components & features.
♣ Includes a 40:1 reduction gearbox, two pairs of flexible couplings, two 36 volts
servomotors and two sets of wheels with shafts, couplings and keys.
♣ Designed to carry a payload of 100 pounds.
♣ Front wheel drive. The rear wheel is a castor, allowing for zero turn radius.
♣ Worm gears with a ratio of 40:1.They are used to transmit power to the wheels
through a mechanical coupling.
♣ Worm gears are self-locking and therefore the robot does not require a
dedicated braking system.
1.3.4 Global Positioning System (G.P.S)
BEARCAT III features the following G.P.S characteristics.
♣ Equipped with a differential G.P.S that provides for autonomous travel from a starting
point to a number of target destinations and return to home base, avoiding obstacles in
the course.
♣ Garmin GPS 76 is the unit that provides GPS navigational ability to the robot.
♣ The physical implementation of GPS navigation feedback control loop consists of the
Garmin 76 GPS unit, the robot motion control system, laser scanner, and the robot
computer.
♣ The robot computer handles the communications interface with the Garmin 76, laser
scanner, and motion control system devices. It is also responsible for running the digital
feedback control algorithm code and sending the correction commands to the robot
motion control system.
10
Figure 1.1 Front View of BEARCAT III
11
Chapter 2 Manual Drive system.
2.1 System and it’s functioning Currently, the Bearcat III runs with C++ software controlling the various systems. The
present robot system has various functionalities like running the robot manually; running it in auto
mode, testing/calibrating the systems, kill motor options etc. All these systems are driven by a
menu interface that appears in the DOS environment menu.
The screen shots below depict the current menu interface for Bearcat III.
Figure 2.1 Bearcat III menu options.
12
Figure 2.2 Bearcat III Manual Drive options.
The manual drive option (<1> Move cart manually), when selected from the main menu (Figure),
throws the following options for robot movement.
Menu option Purpose/robot action Key to be pressed
F - LEFT For forward left turn. Number key 7
F - RIGHT For forward right turn Number key 9
B – LEFT For backward left turn Number key 1
B – RIGHT For backward right turn. Number key 3
13
INCREASE Forward speed increase. Number key 8
DECREASE Reverse speed increase. Number key 2
ZTR – L Left Zero turn radius Number key 4
ZTR – R Right Zero turn radius Number key 6
SOFT STOP Soft stopping the robot. Number key 5
HARD E – STOP Emergency stop Key +
These keys are to be pressed by the person operating the robot.
2.2 Disadvantages
The current system has inherent disadvantages, a few of them listed below.
1. First, the menu interface is not user friendly. A translation has to be made by the person
operating the robot by first reading the options from the menu and then use the
appropriate keys. On the other hand, a web-based interface is very user friendly - Control
is achieved by simple mouse clicks on self-explanatory images that directly describe
corresponding robot action.
2. The robot computer resides on the rear top of the robot – Accessibility to the keys on the
keyboard is an issue, especially when the robot is in motion.
3. Safety is a major issue. As explained earlier, sometimes the robot speed could build up
resulting in sudden jerk motion posing safety threat to the person(s) operating the robot.
4. The entire application is deployed in DOS O/S, which does not compare in scalability &
reliability to Unix/Linux operating systems.
A web based control system (explained in chapter 8) is a replacement to this DOS operating
software piece. This thesis work aims to implement the same.
14
Chapter 3 Java Server Pages (JSP)
JavaServer Pages technology can be used to rapidly develop and easily maintain information-
rich, dynamic web pages that leverage existing business systems. While there are numerous
technologies for building web applications that serve dynamic content, JavaServer Pages (JSP).
has really caught the attention of many developers. JSP not only enjoys cross-platform and
cross-Web-server support, but effectively melds the power of server-side Java technology with
the WYSIWYG (what you see is what you get) features of static HTML pages.
JSP pages typically comprise of:
♣ Static HTML/XML components.
♣ Special JSP tags
♣ Optionally, snippets of code written in the Java programming language called
"scriptlets."
The JSP specification is a standard extension defined on top of the Java Servlet API (Application
programming Interface). Thus, it leverages all of a developer’s experience with servlets.
There are significant differences between JSP and servlet technology. Unlike servlets, which is a
programmatic technology requiring significant developer expertise, JSP appeals to a much wider
audience. It can be used not only by developers, but also by page designers, who can now play a
more direct role in the development life cycle.
3.1 JSP Architecture
The purpose of JSP is to provide a declarative, presentation-centric method of developing
servlets. The JSP specification itself is defined as a standard extension on top the Servlet API.
Consequently, under the covers, servlets and JSP pages have a lot in common.
15
Typically, JSP pages are subject to a translation phase and a request-processing phase. The
translation phase is carried out only once, unless the JSP page changes, in which case it is
repeated. Assuming there were no syntax errors within the page, the result is a JSP page
implementation class file that implements the Servlet interface, as shown below.
Figure 3.1 JSP Translation Phase
The JSP engine itself typically carries out the translation phase, when it receives an incoming
request for the JSP page for the first time.
3.1.1 Object Scopes
The scope or visibility of Java objects within JSP pages that are processing a request is
important. Objects may be created implicitly using JSP directives, explicitly through actions, or, in
rare cases, directly using scripting code. The instantiated objects can be associated with a scope
attribute defining where there is a reference to the object and when that reference is removed.
The following diagram indicates the various scopes that can be associated with a newly created
object:
16
Figure 3.2 Object scopes
3.1.2 Forwarding Requests
With the <jsp: forward> tag, we can redirect the request to any JSP, servlet, or static HTML page
within the same context as the invoking page. This effectively halts processing of the current
page at the point where the redirection occurs, although all processing up to that point still takes
place:
<jsp:forward page="somePage.jsp" />
The invoking page can also pass the target resource bean parameters by placing them into the
request, as shown in the diagram:
17
Figure 3.3 Web request processing
A <jsp:forward> tag may also have jsp:param subelements that can provide values for some
elements in the request used in the forwarding:
<jsp:forward page="<%= somePage %>" >
<jsp:param name="name1" value="value1" />
<jsp:param name="name2" value="value2" />
</jsp:forward>
3.2 How Do JSP Pages Work?
A JSP page is basically a web page with traditional HTML and bits of Java code. The file
extension of a JSP page is .jsp rather than .html or .htm, which tells the server that this page
requires special handling that will be accomplished by a server extension or a plug-in.
When a JSP page is called, it will be compiled (by the JSP engine) into a Java servlet. At this
point the servlet is handled by the servlet engine, just like any other servlet. The servlet engine
then loads the servlet class (using a class loader) and executes it to create dynamic HTML to be
sent to the browser, as shown in Figure . The servlet creates any necessary object, and writes
any object as a string to an output stream to the browser.
18
Figure 3.4: Request/Response flow calling a JSP page
The next time the page is requested, the JSP engine executes the already-loaded servlet unless
the JSP page has changed, in which case it is automatically recompiled into a servlet and
executed.
3.3 JSP Advantages
• Separation of static from dynamic content: With JSP, the logic to generate the
dynamic content is kept separate from the static presentation templates by
encapsulating it within external JavaBeans components. These are then created and
used by the JSP page using special tags and scriptlets.
• Write Once Run Anywhere: JSP technology brings the "Write Once, Run Anywhere"
paradigm to interactive Web pages. JSP pages can be moved easily across platforms,
and across web servers, without any changes.
• Dynamic content can be served in a variety of formats: There is nothing that
mandates the static template data within a JSP page to be of a certain format.
Consequently, JSP can service a diverse clientele ranging from conventional browsers
using HTML/DHTML, to handheld wireless devices like mobile phones and PDAs using
WML, to other B2B applications using XML.
19
• Completely leverages the Servlet API: A servlet developer has very little to "unlearn"
to move over to JSP. In fact, servlet developers are at a distinct advantage because
JSP is nothing but a high-level abstraction of servlets. Almost anything that can be
done with servlets can also be done using JSP--but more easily!
20
Chapter 4 Java Servlets.
Servlets are pieces of Java source code that add functionality to a web server in a manner similar
to the way applets add functionality to a browser. Servlets are designed to support a
request/response computing model that is commonly used in web servers. In a request/response
model, a client sends a request message to a server and the server responds by sending back a
reply message.
From the Java Servlet Development Kit (JSDK), the Java Servlet API is used to create servlets
for responding to requests from clients. These servlets can do many tasks, like
♣ Process HTML forms with a custom servlet or
♣ Manage middle-tier processing to connect to existing data sources behind a
corporate firewall.
♣ In addition, servlets can maintain services, like database sessions, between
requests to manage resources better than Common Gateway Interface (CGI)
technologies.
Servlets are designed to work within a request/response processing model. In a request/response
model, a client sends a request message to a server and the server responds by sending back a
reply message. Requests can come in the form of an
HTTP, URL, FTP, URL or a custom protocol.
The request and the corresponding response reflect the state of the client and the server at the
time of the request. Normally, the state of the client/server connection cannot be maintained
across different request/response pairs.
The Java Servlet API includes several Java interfaces and fully defines the link between a hosting
server and servlets. The Servlet API is defined as an extension to the standard JDK (Java
21
development kit). JDK extensions are packaged under javax--the root of the Java extension
library tree. The Java Servlet API contains the following packages:
• Package javax.servlet
• Package javax.servlet.http
Servlets are a powerful addition to the Java environment. They are fast, safe, reliable, and 100%
pure Java. Because servlets plug into an existing server, they leverage a lot of existing code and
technology. The server handles the network connections, protocol negotiation, class loading, and
more; all of this work does not need to be replicated! And, because servlets are located at the
middle tier, they are positioned to add a lot of value and flexibility to a system.
4.1 The Servlet Life Cycle
Servlets run on the web server platform as part of the same process as the web server itself. The
web server is responsible for initializing, invoking, and destroying each servlet instance.
A web server communicates with a servlet through a simple interface, javax.servlet.Servlet. This
interface consists of three main methods:
• init()
• service()
• destroy()
and two ancillary methods:
• getServletConfig()
• getServletInfo()
Servlets are to web servers what applets are to web browsers. An applet runs in a web browser,
performing actions it requests through a specific interface. A servlet does the same, running in
the web server.
22
The init() Method
When a servlet is first loaded, its init() method is invoked. This allows the servlet to perform any
setup processing such as opening files or establishing connections to their servers. If a servlet
has been permanently installed in a server, it loads when the server starts to run. Otherwise, the
server activates a servlet when it receives the first client request for the services provided by the
servlet.
The init() method is guaranteed to finish before any other calls are made to the servlet--such as a
call to the service() method. The init() method takes one argument, a reference to a ServletConfig
object that provides initialization arguments for the servlet. This object has a method
getServletContext() that returns a ServletContext object containing information about the servlet's
environment.
The service() Method
The service() method is the heart of the servlet. Each request message from a client results in a
single call to the servlet's service() method. The service() method reads the request and
produces the response message from its two parameters:
♣ A ServletRequest object with data from the client. The data consists of name/value pairs
of parameters and an InputStream. Several methods are provided that return the client's
parameter information. The InputStream from the client can be obtained via the
getInputStream() method. This method returns a ServletInputStream, which can be used
to get additional data from the client. If we are interested in processing character-level
data instead of byte-level data, we can get a BufferedReader instead with getReader().
♣ A ServletResponse represents the servlet's reply back to the client. When preparing a
response, the method setContentType() is called first to set the MIME type of the reply.
Next, the method getOutputStream() or getWriter() can be used to obtain a
ServletOutputStream or PrintWriter, respectively, to send data back to the client.
23
The service () method's job is conceptually simple--it creates a response for each client request
sent to it from the host server. However, it is important to realize that there can be multiple
service requests being processed at once. If the service method requires any outside resources,
such as files, databases, or some external data, we must ensure that resource access is thread-
safe.
The destroy () Method
The destroy () method is called to allow the servlet to clean up any resources (such as open files
or database connections) before it is unloaded. If we do not require any clean-up operations, this
can be an empty method.
The server waits to call the destroy() method until either all service calls are complete, or a
certain amount of time has passed. This means that the destroy() method can be called while
some longer-running service() methods are still running. It is important that the destroy() method
is written to avoid closing any necessary resources until all service() calls have completed.
4.2 Installing Servlets
Servlets are not run in the same sense as applets and applications. Servlets provide functionality
that extends a server. In order to test a servlet, two steps are required:
1. Install the servlet in a hosting server
2. Request a servlet's service via a client request
There are many web servers that support servlets. Example IBM Websphere, Jbuilder etc.
4.3 Using Servletrunner
For both JDK 1.1 and the Java 2 platform, we need to install the Java Servlet Development Kit
(JSDK). Servlet Runner is a lightweight tool that can be used to run and test servlets. To use
servletrunner, we must make sure the PATH environment variable points to its directory. For the
JSDK 2.0 installed with all default options, that location is: c:\jsdk2.0\bin on a Windows platform.
24
To make sure that servletrunner has access to the Java servlet packages, we should check that
the CLASSPATH environment variable is pointing to the correct JAR file, c:\jsdk2.0\lib\jsdk.jar on
a Windows platform. With the environment set up, we run the servletrunner program from the
command line. The parameters are:
Usage: servletrunner [options]
Options:
-p port the port number to listen on
-b backlog the listen backlog
-m max maximum number of connection handlers
-t timeout connection timeout in milliseconds
-d dir servlet directory
-s filename servlet property file name
The most common way to run this utility is to move to the directory that contains servlets and run
servletrunner from that location. However, that doesn't automatically configure the tool to load the
servlets from the current directory.
25
Chapter 5 Java Database Connectivity (JDBC) JDBC is a Java API (Application Programming Interface) that documents a standard framework
for dealing with tabular and, generally, relational data. It provides cross-DBMS connectivity to a
wide range of SQL databases, and now, with the new JDBC API, it also provides access to other
tabular data sources, such as spreadsheets or flat files.
5.1 Basic JDBC Architecture
The JDBC, when used to connect a server or servlet component with a DBMS, may be configured
as shown below.
Figure 5.1 Basic JDBC Architecture
Controller
The controller is a component that includes function to determine the action to be performed.
Thus, for a database application, it might determine whether the user or client application intends
to add, search, update, or delete. It would then call the appropriate method in the Mapper object.
Mapper
The Mapper maps between Java objects and DBMS "objects." More specifically, it maps
between Java objects and SQL statements "going in" and "coming out" from specialized Java
26
objects that directly mirror DBMS tables and meta-information and Java databeans or other more
general Java objects.
Driver
Drivers are utility programs written by vendors that map between Java programs and some
DBMS. The drivers are platform specific.
DBMS
DBMS is a collection of programs that enables us to store, modify, and extract information from a
database. There are many different types of DBMS’s, ranging from small systems that run on
personal computers to huge systems that run on mainframes. In short, these are Vendor-supplied
systems that provide general support for multiple database applications.
DB
The data maintained by a DBMS for a particular database application. A
database is a collection of meaningful data for specific business purposes.
Connecting to the Database
Any standard relational database can be accessed by JDBC to facilitate web based data access
from Java servlets/JSP modules. Common relational databases include Oracle, MSAccess, DB2
etc. Let’s assume we have already created a simple MSAccess database.
There are always two steps to making a database connection using the DriverManager: 1. Loading
the driver and 2. Making the connection.
5.2.1 Loading the JDBC driver.
A driver that enables the JDBC classes to communicate with a data source must be
loaded. The standard method for dynamically loading a driver is:
27
Class.forName( DriverClassName);
If, for example, we want to use the JDBC-ODBC Bridge driver, the following code will
load it.
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
There is no need to create an instance of the driver and register it with the Driver
Manager because calling Class.forName will do that automatically. When a driver is
loaded, it is available for making a connection with a DBMS.
5.2.2 Connecting to a data source.
The driver supplies methods to make a Connection, but requires a specific type of URL,
which uses the jdbc protocol. The generalized form is jdbc:<subprotocol>:<subname>.
One obvious point that is often taken for granted: the use of URLs means that JDBC
applications are more or less automatically network and internet enabled.
The standard form of the Connection request is as below:
Connection con = DriverManager.getConnection(URL, Username, Password );
This form is best for portability even in cases where Username and Password are empty
strings (“ “) due to a database default or, say, text files acting as ODBC data sources,
which cannot make use of such attributes.
If the JDBC-ODBC Bridge driver is used, the JDBC URL will start with jdbc:odbc: . The
rest of the URL is generally the data source name or database system. So, if ODBC is
used to access an ODBC data source called " MS Access DB " for example, the JDBC
URL could be jdbc:odbc: MS Access DB. If one of the drivers loaded recognizes the
JDBC URL supplied to the method DriverManager.getConnection, that driver will
establish a connection to the DBMS specified in the JDBC URL. The Driver Manager
class manages all of the details of establishing the connection behind the scenes. The
28
connection returned by the method DriverManager.getConnection is an open connection
that can be used to create JDBC statements that pass SQL statements to the DBMS.
5.3 Interacting with a Database
5.3.1 Statements
A Statement object is a container or transport mechanism to send/execute SQL statements and
retrieve any results via its associated Connection. There are three types of Statements, including
Prepared Statements and Callable Statements, both of which are subinterfaces of Statement.
Statement stmt = con.createStatement(); - this snippet creates a statement object “stmt”
The execute series are the most often used of Statement's methods:
• executeQuery() is used to execute SQL statements that return a single ResultSet.
• executeUpdate() is used to execute SQL statements that modify a table or values of
columns in a table and return the number of rows affected (which is zero in the case of
DDL statements).
• execute() can be used to execute any type of SQL statement, but is intended for those
that can return multiple results or values.
A Statement should automatically be closed when the Connection is garbage collected, but the
developer has to close it himself as soon as it is no longer needed. The JDBC recommendation is
to always close the Statement explicitly.
Executing statements
There are 2 methods for SQL statement execution – executeUpdate & executeQuery.
executeUpdate() method
29
The method executeUpdate is used for SQL statements that are DDL (data definition language)
type. Statements that create a table, alter a table, or drop a table are all examples of DDL
statements and are executed with the method executeUpdate. The method executeUpdate is
also used to execute SQL statements that update a table. In practice, executeUpdate is used far
more often to update tables than it is to create them because a table is created once but may be
updated many times. The following code is an example for an update action.
stmt.executeUpdate("INSERT INTO RobotteamTable VALUES (‘Dinesh’, ‘Dhamodarasamy’,
‘2645 Clifton avenue’….);
executeQuery() method
This method is used to execute SELECT statements, which comprise the vast majority of SQL
statements retrieving values from Result Sets. The following is an example of a SELECT
statement.
ResultSet rs = stmt.executeQuery (“SELECT User_Id, Last Name FROM
RobotTeamTable");
Chapter 6 Java Native Interface.
The Java Native Interface (JNI) is the native programming interface for Java that is part of the JDK.
By writing programs using the JNI, we can ensure that our code is completely portable across all
platforms.
30
The JNI allows Java code that runs within a Java Virtual Machine (VM) to operate with applications
and libraries written in other languages, such as C, C++, and assembly. In addition, the Invocation
API allows us to embed the Java Virtual Machine into native applications. JNI can be used to write
native methods to handle those situations when an application cannot be written entirely in the Java
programming language. For example, the native methods and the JNI can be used in the following
situations:
♣ The standard Java class library may not support the platform-dependent features needed
by our application.
♣ We may already have a library or application written in another programming language
and we wish to make it accessible to Java applications.
♣ We may want to implement a small portion of time-critical code in a lower-level
programming language, such as assembly, and then have our Java application call these
functions.
Programming through the JNI framework lets us use native methods to do many operations. Native
methods may represent legacy applications or they may be written explicitly to solve a problem that
is best handled outside of the Java programming environment. The JNI framework lets native
methods utilize Java objects in the same way that Java code uses these objects. A native method
can create Java objects, including arrays and strings, and then inspect and use these objects to
perform its tasks. A native method can also inspect and use objects created by Java application
code. A native method can even update Java objects that it created or that were passed to it, and
these updated objects are available to the Java application. Thus, both the native language side
and the Java side of an application can create, update, and access Java objects and then share
these objects between them.
The JNI enables us to use the advantages of the Java programming language from native methods.
In particular, we can catch and throw exceptions from the native method and have these exceptions
handled in the Java application. Native methods can also get information about Java classes. By
31
calling special JNI functions, native methods can load Java classes and obtain class information.
Finally, native methods can use the JNI to perform runtime type checking.
For example, the following figure shows how a legacy C program can use the JNI to link with Java
libraries, call Java methods, use Java classes etc.
The below figure illustrates calling native language functions from a Java application. This diagram
shows the many possibilities for utilizing the JNI from a Java program, including calling C routines,
using C++ classes, calling assembler routines, and so on.
It is easy to see that the JNI serves as the glue between Java and native applications. The
following figure shows how the JNI ties the C side of an application to the Java side.
32
Figure 6.1 Java & C Language gluing by JNI
6.1 Writing Java Programs with Native Methods
Writing native methods for Java programs is a multi-step process.
1. First the Java program (class) is written that declares the native method; this class
contains the declaration or signature for the native method. It also includes a main
method that calls the native method.
2. Then the Java class that declares the native method and the main method is compiled.
3. A header file is generated for the native method using javah with the native interface flag
-jni. Once the header file is generated, we have the formal signature for the native
method.
4. The implementation of the native method can then be written in the programming
language of our choice, such as C or C++.
5. The header and implementation files are then compiled into a shared library file.
6. The Java program is finally run.
The following figure illustrates these steps for the Hello World program:
33
Figure 6.2 Hello World JNI Implementation
Step 1: Writing the Java Code
The following Javacode segment defines a class named HelloWorld. This class declares one
native method, implements a main method, and has a static code segment.
34
class HelloWorld { public native void displayHelloWorld(); static { System.loadLibrary("hello"); } public static void main(String[] args) { new HelloWorld().displayHelloWorld(); } }
Declaring a Native Method
When a method implementation is written in a language other than Java, the keyword native as
part of the method's definition within the Java class must be included. The native keyword signals to the Java compiler that the function is a native language function.
public native void displayHelloWorld();
Loading the Library
The native language code that implements displayHelloWorld is compiled into a shared library. The runtime system later loads the shared library into the Java class that requires it. Loading
the library into the Java class maps the implementation of the native method to its declaration.
The HelloWorld class uses the System.loadLibrary method. The System.loadLibrary method
loads the shared library that will be created when we compile the implementation code. This
method must be placed within a static initializer. The argument to System.loadLibrary is the shared library name. This can be any name that we choose. The system uses a standard, but
platform-specific, approach to convert the library name to a native library name. For example,
the Solaris system converts the library name "hello" to libhello.so, while a Microsoft Windows
system converts the same name to hello.dll.
The following static initializer from the HelloWorld class loads the appropriate library, named
hello. The runtime system executes a class's static initializer when it loads the class.
static { System.loadLibrary("hello"); }
Writing the Main Method
The HelloWorld class, because it is an application, also includes a main method to instantiate
the class and call the native method. The main method instantiates HelloWorld and calls the
displayHelloWorld native method.
35
public static void main(String[] args) { new HelloWorld().displayHelloWorld(); }
A native method can be called in the same manner as a regular method.
Step 2: Compiling the Java Code.
Java compiler is used to compile the class that was created in the previous step. The
command to compile any java class is:
javac HelloWorld.java
Step 3: Creating the .h File
The javah utility program is used to generate a header file (a .h file) from the HelloWorld
class. The header file provides a C function signature for the implementation of the native
method displayHelloWorld defined in that class.
The javah has to be run now on the HelloWorld class that was created in the previous
steps.
DOS shell (Windows 95/NT) C:\> javah -jni HelloWorld
The name of the header file is the Java class name with a .h appended to the end. For
example, the command shown above will generate a file named HelloWorld.h.
By default, javah places the new .h file in the same directory as the. class file. The -d option
should be used to instruct javah to place the header files in a different directory.
The Function Definition The header file HelloWorld.h. created as above will have the following lines of code.
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
36
* Method: displayHelloWorld
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
The Java_HelloWorld_displayHelloWorld function provides the implementation for the HelloWorld class's native method displayHelloWorld. The same function signature must be used when the
implementation for the native method is written.
The name of the native language function that implements the native method consists of the
prefix Java_, the package name, the class name, and the name of the native method. Between
each name component is an underscore "_" separator. Graphically, this looks as follows:
The native method displayHelloWorld within the HelloWorld class becomes
Java_HelloWorld_displayHelloWorld. The implementation of the native function accepts two
parameters even though, in its definition on the Java side, it accepts no parameters. The JNI
requires every native method to have these two parameters.
The first parameter for every native method is a JNIEnv interface pointer. It is through this pointer that the native code accesses parameters and objects passed to it from the Java application. The
second parameter is jobject, which references the current object itself. In a sense, the jobject
parameter can be thought of as the "this" variable in Java.
37
Step 4: Writing the Native Method Implementation
The implementation for the native method can be written in a language other than Java. The
function that is written must have the same function signature as the one generated by javah in
the HelloWorld.h file. The function signature generated for the HelloWorld class's
displayHelloWorld native method will look like this:
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *, jobject);
The C language implementation for the native method Java_HelloWorld_displayHelloWorld is
shown below. This implementation is in the file named HelloWorldImp.c.
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}
The implementation for Java_HelloWorld_displayHelloWorld is straightforward. The function uses the printf function to display the string "Hello World!" and then returns.
Step 5: Creating a Shared Library
The C file above has the implementation for the displayHelloWorld native method. The
native method was saved in the file HelloWorldImp.c. The HelloWorldImp.c must be compiled into a shared library, which should be named hello to match the library name
used in the System.loadLibrary method.
On Solaris, a shared library will be created, while on Windows 95/NT a dynamic link
library (DLL) is created. The path or paths to all necessary header files must be specified.
On Solaris, the following command builds a shared library libhello.so:
cc -G -I/usr/local/java/include -I/usr/local/java/include/solaris \
HelloWorldImp.c -o libhello.so
38
On Microsoft Windows, the following command builds a dynamic link library hello.dll
using Microsoft Visual C++ 4.0:
cl -Ic:\java\include -Ic:\java\include\win32 -LD HelloWorldImp.c -Fehello.dll
Of course, the include path that corresponds to the setup on a particular machine must
be specified as appropriate.
Step 6: Running the Program
The Java application (the HelloWorld class) is run with the Java interpreter as follows:
java HelloWorld
The following output should be seen:
Hello World!
The JNI technology is used for this work as it has the capability to make the Java web interface
talk to the existing C++ programs of Bearcat III. Native methods were declared in the Java
servlets for the C++ routine that performs the various functions like forward speed increase,
reverse speed increase, emergency stop etc. These java servlet methods are in turn invoked
from the JSP front-end web application through mouse clicks on respective image/buttons.
39
Chapter 7 Video Streaming
Ideally, video and audio are streamed across the Internet from the server to the client in
response to a client request for a web page containing embedded videos. The client plays the
incoming multimedia stream in real time as the data is received. Quite a few video streamers are
starting to appear and many pseudo-streaming technologies and other potential solutions are
also in the pipeline.
There are basically 2 types of video streaming events – Live & Stored.
♣ Live – ‘ real time’ and synchronous.
♣ Stored – ‘ recorded ‘ & asynchronous.
7.1 Technology
Web-casting live allows us to broadcast sound or video encoded in one of the main
popular formats for RealPlayer, Windows Media or MP3. This format is highly compressed to
deliver the best possible sound/picture over a limited-bandwidth connection. Users receive video
programming over the internet with popular media players like RealOne, Windows Media or
Winamp, already installed on most PCs. This player then interprets the data it receives over the
internet and presents it to the listener or viewer in a format everyone can enjoy. By far the most
popular players installed on most PCs worldwide are the 'RealOne' player by RealNetworks,
'Windows Media' player by Microsoft, and 'Winamp' by Nullsoft. Another webcasting format is the
universal MP3 audio format. Webcasting using the system that utilizes these players insures
maximum audiences are reached. High transmission reliability, broadcast scalability and flexible
modes of delivery have made the RealNetworks and Windows Media webcasting systems market
leaders for professional live and on-demand streaming media on the internet. Adding the live
webcast to an existing website is simple – Just a link to the URL address that the streamer gives
should be added, that's it.
In choosing a stream provider, an examination of their high-speed servers & their
availability is necessary. We simply encode our audio/video on our PC at our location with the
40
encoder software provided, which sends it thru any standard ISP internet account (any reputable
ISP in our locality) to the streamer’s high-speed servers. From there, our broadcast is streamed
out live worldwide from our streaming server in the format we require. Our webcast can be
accessed by anyone, and be easily integrated into any website by adding a simple URL link.
Most streamers usually provide the software for our PC free and guide us through setup.
Given below is a schematic diagram depicting how the technology works.
Figure 7.1 Web Casting schematics
7.1.1 Streaming techniques
Popular streaming techniques include support for
♣ An audio-visual window.
♣ Interactive text chat window
♣ Text or graphic window (May be used to present instructional information
in .gif format)
Popular streaming techniques.
41
Figure 7.2 Popular streaming techniques
Schematic depiction of Live Streaming.
Figure 7.3 Schematic depiction of Live Streaming.
42
7.2 How it works?
Video source (typically, a camera) will be fed to the robot server PC via the video card, and is
encoded live with any encoder software. The video is sent by internet connection to the local ISP,
then to the streaming server, and streamed to the world live. A link is created on the Web control
Interface (explained in next chapter) so that the robot motion is viewed live to control the robot.
This is brought out as a left side panel on Windows media player in the web control interface for
the robot.
7.3 Streaming requirements
The following minimum computer requirements should be satisfied for successful streaming.
♣ Windows 95 or higher, 100 MHZ, 32MB RAM.
♣ Sound card and or external speakers; 28.8K Modem,
♣ Microsoft internet explorer 4.0.1 or higher, or Netscape 4.5 or higher.
♣ Streaming players like Windows Media Player.
♣ Client ISP provider should be able to provide streaming @specific geographical
location.
43
Chapter 8 Web application development.
A robot control system that resides in a web server was developed. Therefore, this
application will remain accessible to any computer that has internet access. The application is
developed entirely with java technology, which has the capability to communicate with native
C++ programs through the Java Native interface. This leverages usage of the existing C++
code for the robot control systems. The application’s front end was developed with java server
pages technology (JSP). Access to the application is restricted to registered robot team
members, which typically include current students/faculty/alumni of the U.C robotics team.
The application contains a Login page, and if a user wishes to become a member of
the U.C robotics team, there’s a User registration interface. All information is maintained by
means of a database. Considering the size of data, an MSAccess database was chosen.
User will be required to login first to gain access to the control interface. Provided
below is the login page to the application.
8.1 BEARCAT Drive Login JSP interface.
This interface performs authentication of a valid user. This is accomplished by way of an
authenticationServlet, which communicates with the Robot team database through JDBC (Java
Database connectivity). If the application determines a user to be valid, then he will be
presented with the RobotDrive interface. (Application with controls like Left-turn, E-Stop etc.). If
login is unsuccessful, then users also have the option to get registered with the U.C Robotics
team. (But they should be a UC Student/alumni/faculty to get approved).
44
Figure 8.1: Bearcat III Login page.
8.2 New User Registration J.S.P interface
The application also has provisions for a user to get registered with the U.C robotics
team. The user information is captured in a database. The database is accessed through Java
database connectivity from a servlet. The user-id and password information is consequently
checked during every login attempt made in the previous screen. This interface facilitates new
user registration. For final approval, a user is required to be a UC Student/alumni/faculty. This
interface communicates with robot team database through JDBC and inserts a new record for
every new member registration. The link to this page resides in the main (previous login page)
page.
45
Figure 8.2: Web Registration form.
46
contd…. Figure: Web Registration form.
8.3 Main Drive Interface
This is the heart of the application. After a successful login, the user is presented with the
control interface. This application has all controls that typically appear in the g-cart application
(existing C++ system in Bearcat III) manual mode application. This interface facilitates robot
movement from web. This greatly reduces human-robot interaction while taking the robot out.
This application communicates with the C++ code (which currently drives the robot) and does the
same function from web.
47
This application would use the live video streaming technology to capture the robot
motion in space. As it will be relayed live on this J.S.P interface (where the robot controls exist), it
will give a clear idea of how to control the robot.
Figure 8.3: Bear cat III Web Interface.
8.4 Web Interface Lay out
The control interface is designed to facilitate ease of use. This interface essentially contains 2
frames as explained below.
48
♣ Live video streaming of the robot in motion at the left. This is made possible through
the use of video streaming setup/procedure as explained in chapter 8.
♣ The control panel at the right. The control panel is designed to be user friendly. The
symbols are self-explanatory and control is achieved by simple mouse clicks. The user
will be able to assess the robot motion and simultaneously move the robot. Mouse
clicks on this interface are transformed into the appropriate robot action. Internally, the
JSP page communicates the mouse click event to the respective java class handler.
For example, when the Increase button in the above interface is clicked, the request
will be passed to the ForwardDriver.java program. This program has the capability to
pass on the request to the C++ module, man_move.cpp required for forward speed
increase. All this is accomplished through the Java native Interface. Similarly, all
requests are handled and appropriate robot action achieved.
49
Chapter 10 Conclusion and recommendations.
The web control application is built and will be integrated into the robotics sun web
server. Once in place, the system will facilitate online motion control of Bearcat III. Safety is a major
factor that forced the use of W.W.W. Also the new application interface is user-friendlier than the
existing C++ menu interface in a DOS environment. The web application will be deployed in the
robot computer, which will also be configured to serve as the web server.
The Java application that has been developed can be deployed on any platform provided
it has the Java Virtual Machine built into it. This allows us to go for robust operating systems like
Linux/Unix for the robot operation. Video streaming may or may not actually be implemented for this
system. If the use of the system is primarily for taking the robot out of the lab, then probably there
need not be a video stream panel. On the other hand, if the robot should be controlled from a
remote place, then live video streaming of the robot is imperative.
W.W.W is the order of the day, and no wonder it is taking the robotics world in its stride.
This application will serve as an eye opener for other robot systems to be controlled from web.
Possible areas include, but are not limited to
♣ Online calibration of the systems,
♣ Online testing of the health of various systems, &
♣ Online control of the GPS system etc.
50
References
Text
1. Marty Hall, “Core Servlets and JavaServer Pages”, Second Edition, Prentice Hall, New
Jersey, 2000.
2. Jason Hunter, “Java Servlet Programming”, Second edition, O'Reilly & Associates, Sebastopol, 2001.
3. Duane K. Fields and Mark A. Kolb, “Web Development with JavaServer Pages”, Second
Edition, Manning Publications, Greenwich, 2000.
4. David M. Geary, “Advanced JavaServer Pages”, First edition, Pearson Higher Education, Harlow, 2001.
5. Gregory Speegle, “JDBC: Practical Guide for Java Programmers”, First edition, Morgan
Kaufmann, 2001.
6. Art Taylor, “JDBC: Database Programming with J2ee”, First edition, Prentice Hall PTR,
New Jersey, 2002.
7. Rob Gordon, “Essential JNI: Java Native Interface”, First edition, Prentice Hall, New Jersey, 1998.
8. Sheng Liang, “Java(TM) Native Interface: Programmer's Guide and Specification”, First
edition, Addison-Wesley, Boston, 1999.
9. David Austerberry, Gavin Starks, “The Technology of Video and Audio Streaming”, First edition, Focal Press, Burlington, 2002.
10. Eyal Menin, “The Streaming Media Handbook”, First edition, Prentice Hall PTR, New
Jersey, 2002.
11. Ken Goldberg and Roland Siegwart, “Beyond Webcams: An Introduction to Online
Robots”, First Edition, MIT Press, 2001.
Web
12. www.robotics.uc.edu
13. www.java.sun.com
51
14. http://developer.java.sun.com/
15. Sachin Modi, “http://reeses.mie.uc.edu/theses/theses2002/sachinthesis_ver2.pdf”, Master’s Thesis, 2002.
52
Appendix List of Programs
1. Login JSP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>UC BearCat 3 Drive Login</title>
<link rel="stylesheet" href="include/normal.css" type="text/css">
<meta name="Microsoft Theme" content="expeditn 011">
</head>
<body>
<div align="center">
<center>
<table border="1" width="866" height="250">
<tr>
<td width="866" height="250">
<table height=5 cellspacing=0 cellpadding=0 width=573 border=0 cellspan="0">
<tr >
<td class="unnamed1" width="102" align="center" valign="middle" height="15"></td>
<td class="unnamed1" width="50" align="left" valign="baseline" height="15">
<a href="http://www.robotics.uc.edu" class="unnamed1">Home</a> </td>
<td class="unnamed1" width="69" align="left" valign="baseline" height="15" ><a href="http://www.robotics.uc.edu/overview.htm" class="unnamed1">Overview
</a></td>
<td class="unnamed1" width="71" align="left" valign="baseline" height="15" ><a href="http://www.robotics.uc.edu/research.htm" class="unnamed1">Research</a></td>
<td class="unnamed1" width="51" align="left" valign="baseline" height="15" >
<a href="http://www.robotics.uc.edu/people.htm" class="unnamed1">People</a>
</td>
<td class="unnamed1" width="70" align="left" valign="baseline" height="15" ><a href="http://www.robotics.uc.edu/sponsor.htm" class="unnamed1">Sponsors</a></td>
<td class="unnamed1" width="66" align="left" valign="baseline" height="15" >
53
<div align="left"><a href="http://www.robotics.uc.edu/treasure.htm" class="unnamed1">Treasures</a></div>
</td>
<td class="unnamed1" width="55" align="left" valign="baseline" height="15" >
<p align="center"><a href="http://www.robotics.uc.edu/papers.htm" class="unnamed1">Papers</a></p>
</td>
<td class="unnamed1" width="39" align="left" valign="baseline" height="15" >
<p align="right"><a href="http://www.robotics.uc.edu/links.htm" class="unnamed1">Links</a>
</td>
</tr>
</table>
<table width="610" border="0">
<tr>
<td>
<h3 align="center"><font color="#800000"><b><i>
UC BEARCAT 3 DRIVE LOGIN!</i></b></font> </h3>
<p align="center">
<b><u><font color="#808000">Access restricted to authorized users only.</font></u></b>
</p>
<form action="login.jsp" method="post">
<div align="center">
<table border="0" cellspacing="2" cellpadding="2" bgcolor="#333399" width="233">
<tr>
<td align="right" width="63">
<span class="logintext">User ID:</span>
</td>
54
<td align="left" width="152">
<input name="userid" type="text" size="18" maxlength="10">
</td>
</tr>
<tr>
<td align="right" width="63">
<span class="logintext">Password:</span>
</td>
<td align="left" width="152">
<input name="password" type="password" size="18" maxlength="16">
</td>
</tr>
<tr>
<td colspan="2" align="center" width="223">
<input type="submit" name="submit" value="Log In">
</td>
</tr>
</table>
</div>
</form>
<p align="center">
Note: User IDs are not case-sensitive. Passwords <b>are</b> case-sensitive.
</p>
<p align="center">
If you have forgotten your password, we can <a href="accountdetailsmail.jsp">mail</a> it to you.
</p>
</td>
</tr>
</table>
<table width="396" border="0">
<tr>
55
<td width="388">
<br>
<img border="0" src="file:///C:/Bearcat3.bmp" width="380" height="294">
<p class="small">
</p>
</td>
</tr>
</table>
<p> </td>
</tr>
</table>
</center>
</div>
</body>
</html>
2. NewUserSignUp.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> U.C Robotics New User Registration </title>
<META NAME="keywords" CONTENT="ROBOTICS REGISTRATION">
<META NAME="description" CONTENT="ROBOTICS REGISTRATION">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache" />
<link rel="stylesheet" href="/css/default.css" />
<meta name="Microsoft Theme" content="boldstri 011">
</head>
<!--stopindex-->
56
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" background="bstrbk.gif" bgcolor="#FFFFFF" text="#000000" link="#990000" vlink="#336699" alink="#666666">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<a name="top"></a>
<!-- BEGIN GLOBAL NAVIGATION TOOLBAR -->
<p align="center"><br />
<b><font color="#008000" size="4">NEW TEAM MEMBER REGISTRATION FORM</font></b>
</p>
<p><font color="#660066" size="3"><b> Sign up with the <i>University of Cincinnati Robotics
team</i>.
Note: To
register with us, you need to be either a current U.C student/Faculty/Alumni.
Please allow us 2-3 business days to evaluate your information and update you as an authorized
user. Please supply us with the following information. </b></font><!-- END BREADCRUMB --><!-- BEGIN PAGETITLE ONE LINE -->
</p>
<DIV style="margin:10px 10px 20px 10px">
<!--mstheme--></font>
<table border="0" cellpadding="0" cellspacing="10" width="100%">
<tr><td width="100%" valign="top">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
<TABLE width="375" cellpadding="0" cellspacing="0" border="0">
<TR valign="top">
<TD>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<FORM NAME="main" METHOD="POST" ACTION="http://localhost:8080/servlet/UserRegistrationServlet">
<!--mstheme--></font>
<TABLE CELLPADDING="4" CELLSPACING="0" WIDTH="864" BORDER="0">
<TR>
<TD width="854">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
<TABLE CELLPADDING="4" CELLSPACING="0" WIDTH="100%" BORDER="0">
<TR>
57
<TD>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
<H2><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica" color="#000000"><font color="#008000"><b>Personal Information</b></font><!--mstheme--></font></H2>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
</TD> </TR> <TR> <TD class="text">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<font color="#008000"><b>
To ensure that we receive your correct e-mail address, please enter it in
both fields. * Indicates required fields to complete the download transaction.</b></font>
<!--mstheme--></font>
</TD>
</TR>
</TABLE>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
</TD>
</TR>
<TR>
<TD width="854">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
<TABLE CELLPADDING="4" CELLSPACING="0" WIDTH="854" BORDER="0">
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* E-mail address .</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="email" SIZE="30" MAXLENGTH="50" ></b></font><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* E-mail address (again).</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="email2" SIZE="30" MAXLENGTH="50" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
58
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Desired Password.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><input type="password" name="password" size="20"><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* First Name.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="first_name" SIZE="30" MAXLENGTH="50" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Last Name.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="last_name" SIZE="30" MAXLENGTH="50" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Daytime Phone (with area code).</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="phone" SIZE="20" MAXLENGTH="20" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Select one of the
following.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b> <input type="radio" value="UCStudent" checked name="R1">
U.C Student <input type="radio" name="UCFaculty" value="UCFaculty"> U.C
Faculty <input type="radio" name="UCAlumni" value="UCAlumni">
U.C
Alumni</b></font><!--mstheme--></font></TD>
59
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><b><font color="#008000"> Education</font></b><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><input type="text" name="education" size="20"><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b> Major</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><input type="text" name="major" size="20"><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Address.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><input type="text" name="Address" size="30"><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* City.</b></font><!--mstheme--></font></TD>
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="city" SIZE="30" MAXLENGTH="32" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* State/Province(US/Canada).</b></font><!--mstheme--></font></TD>
<TD width="427">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<font color="#008000"><b>
<SELECT NAME="state">
<OPTION VALUE="N/A" SELECTED>Select Your State </OPTION>
60
<OPTION VALUE="AL" >
Alabama</OPTION>
<OPTION VALUE="AK" >
Alaska</OPTION>
<OPTION VALUE="AB" >
Alberta</OPTION>
<OPTION VALUE="AS" >
American Samoa</OPTION>
<OPTION VALUE="AZ" >
Arizona</OPTION>
<OPTION VALUE="AR" >
Arkansas</OPTION>
<OPTION VALUE="AE" >
Armed Forces Europe</OPTION>
<OPTION VALUE="AP" >
Armed Forces Pacific</OPTION>
<OPTION VALUE="AA" >
Armed Forces the Americas</OPTION>
<OPTION VALUE="BC" >
British Columbia</OPTION>
<OPTION VALUE="CA" >
California</OPTION>
<OPTION VALUE="CO" >
Colorado</OPTION>
<OPTION VALUE="CT" >
Connecticut</OPTION>
<OPTION VALUE="DE" >
Delaware</OPTION>
<OPTION VALUE="DC" >
District of Columbia</OPTION>
<OPTION VALUE="FM" >
Fed. States of Micronesia</OPTION>
61
<OPTION VALUE="FL" >
Florida</OPTION>
<OPTION VALUE="GA" >
Georgia</OPTION>
<OPTION VALUE="GU" >
Guam</OPTION>
<OPTION VALUE="HI" >
Hawaii</OPTION>
<OPTION VALUE="ID" >
Idaho</OPTION>
<OPTION VALUE="IL" >
Illinois</OPTION>
<OPTION VALUE="IN" >
Indiana</OPTION>
<OPTION VALUE="IA" >
Iowa</OPTION>
<OPTION VALUE="KS" >
Kansas</OPTION>
<OPTION VALUE="KY" >
Kentucky</OPTION>
<OPTION VALUE="LA" >
Louisiana</OPTION>
<OPTION VALUE="ME" >
Maine</OPTION>
<OPTION VALUE="MB" >
Manitoba</OPTION>
<OPTION VALUE="MH" >
Marshall Islands</OPTION>
<OPTION VALUE="MD" >
Maryland</OPTION>
62
<OPTION VALUE="MA" >
Massachusetts</OPTION>
<OPTION VALUE="MI" >
Michigan</OPTION>
<OPTION VALUE="MN" >
Minnesota</OPTION>
<OPTION VALUE="MS" >
Mississippi</OPTION>
<OPTION VALUE="MO" >
Missouri</OPTION>
<OPTION VALUE="MT" >
Montana</OPTION>
<OPTION VALUE="NE" >
Nebraska</OPTION>
<OPTION VALUE="NV" >
Nevada</OPTION>
<OPTION VALUE="NB" >
New Brunswick</OPTION>
<OPTION VALUE="NH" >
New Hampshire</OPTION>
<OPTION VALUE="NJ" >
New Jersey</OPTION>
<OPTION VALUE="NM" >
New Mexico</OPTION>
<OPTION VALUE="NY" >
New York</OPTION>
<OPTION VALUE="NF" >
Newfoundland</OPTION>
<OPTION VALUE="NC" >
North Carolina</OPTION>
<OPTION VALUE="ND" >
North Dakota</OPTION>
63
<OPTION VALUE="MP" >
Northern Mariana Islands</OPTION>
<OPTION VALUE="NT" >
Northwest Territories</OPTION>
<OPTION VALUE="NS" >
Nova Scotia</OPTION>
<OPTION VALUE="OH" >
Ohio</OPTION>
<OPTION VALUE="OK" >
Oklahoma</OPTION>
<OPTION VALUE="ON" >
Ontario</OPTION>
<OPTION VALUE="OR" >
Oregon</OPTION>
<OPTION VALUE="PW" >
Palau</OPTION>
<OPTION VALUE="PA" >
Pennsylvania</OPTION>
<OPTION VALUE="PE" >
Prince Edward Island</OPTION>
<OPTION VALUE="PR" >
Puerto Rico</OPTION>
<OPTION VALUE="PQ" >
Quebec</OPTION>
<OPTION VALUE="RI" >
Rhode Island</OPTION>
<OPTION VALUE="SK" >
Saskatchewan</OPTION>
<OPTION VALUE="SC" >
South Carolina</OPTION>
64
<OPTION VALUE="SD" >
South Dakota</OPTION>
<OPTION VALUE="TN" >
Tennessee</OPTION>
<OPTION VALUE="TX" >
Texas</OPTION>
<OPTION VALUE="UT" >
Utah</OPTION>
<OPTION VALUE="VT" >
Vermont</OPTION>
<OPTION VALUE="VI" >
Virgin Islands</OPTION>
<OPTION VALUE="VA" >
Virginia</OPTION>
<OPTION VALUE="WA" >
Washington</OPTION>
<OPTION VALUE="WV" >
West Virginia</OPTION>
<OPTION VALUE="WI" >
Wisconsin</OPTION>
<OPTION VALUE="WY" >
Wyoming</OPTION>
<OPTION VALUE="YT" >
Yukon Territory</OPTION>
</SELECT>
</b></font>
<!--mstheme--></font>
</TD>
</TR>
<TR>
<TD width="407"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b>* Zip or Postal Code.</b></font><!--mstheme--></font></TD>
65
<TD width="427"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><font color="#008000"><b><INPUT TYPE="TEXT" NAME="zip" SIZE="10" MAXLENGTH="10" VALUE=""></b></font><!--mstheme--></font></TD>
</TR>
</TABLE>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
</TD>
</TR>
<INPUT TYPE="HIDDEN" NAME="developer_opt_in" VALUE="Z">
<TR>
<TD width="854">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<p align="center">
<font color="#008000"><b>
If you have any questions about this form, please refer to</b></font> <a href="mailto:[email protected]"><font color="#0000FF">[email protected]</font></a>
</p>
<!--mstheme--></font>
</TD>
</TR>
<TR>
<TD width="854">
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<p align="center">
<INPUT TYPE="SUBMIT" VALUE="Register with U.C Robotics Team">
<INPUT TYPE="RESET" VALUE="Clear">
</p>
<!--mstheme--></font>
</TD>
</TR>
</TABLE>
66
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
</FORM>
<!--mstheme--></font>
</TD>
</TR>
</TABLE>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<!-- =================== -->
<!-- END OF MAIN CONTENT -->
<!-- =================== -->
<!--stopindex-->
<!-- END CENTER COLUMN COMPONENTS -->
<!--mstheme--></font>
</td><td valign="top" width=200>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
</td></tr>
</table>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<!-- END WRAPPER TABLE, 2 COLUMN, MAIN/RIGHT -->
</DIV>
<!-- END WRAPPER DIV FOR APP TEMPLATES -->
<!-- BEGIN GLOBAL FOOTER -->
<div class="sitelinks" align="center" style="width: 260; height: 38">
</div>
<!--mstheme--></font>
</body>
</html>
67
3. RobotDriveLogin.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-
html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>UC BearCat 3 Drive Login</title>
<link rel="stylesheet" href="include/normal.css" type="text/css">
<meta name="Microsoft Theme" content="expeditn 011">
</head>
<body background="exptextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#993300" vlink="#666600" alink="#CC3300">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<div align="center">
<center><!--mstheme--></font>
<table border="1" width="774" height="105" bordercolorlight="#CC9966" bordercolordark="#660000">
<tr>
<td width="774" height="105"><!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><!--mstheme--></font>
<table height=5 cellspacing=0 cellpadding=0 width=766 border=0
cellspan="0">
<tr >
<td class="unnamed1" width="79" align="left" valign="baseline" height="15">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><font color="#333399"><font face="Arial Black">
</font>
<a href="http://www.robotics.uc.edu" class="unnamed1"><font face="Arial Black" color="#333399">Home</font></a> </font><!--mstheme--></font> </td>
<td class="unnamed1" width="94" align="left" valign="baseline" height="15" ><!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><font color="#333399"><font face="Arial Black"> </font><a href="http://www.robotics.uc.edu/overview.htm" class="unnamed1"><font face="Arial Black" color="#333399">Overview</font>
</a></font><!--mstheme--></font></td>
<td class="unnamed1" width="90" align="left" valign="baseline" height="15" ><!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><font color="#333399"><font face="Arial
68
Black"> </font><a href="http://www.robotics.uc.edu/research.htm" class="unnamed1"><font face="Arial Black" color="#333399">Research</font></a></font><!--mstheme--></font></td>
<td class="unnamed1" width="76" align="left" valign="baseline" height="15" >
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><font color="#333399"><font face="Arial Black">
</font>
<a href="http://www.robotics.uc.edu/people.htm" class="unnamed1"><font face="Arial Black" color="#333399">People</font></a>
</font><!--mstheme--></font>
</td>
<td class="unnamed1" width="94" align="left" valign="baseline" height="15" ><!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><font color="#333399"><font face="Arial Black"> </font><a href="http://www.robotics.uc.edu/sponsor.htm" class="unnamed1"><font face="Arial Black" color="#333399">Sponsors</font></a><font face="Arial Black"> </font></font><!--mstheme--></font></td>
<td class="unnamed1" width="85" align="left" valign="baseline" height="15" >
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<div align="left"><a href="http://www.robotics.uc.edu/treasure.htm" class="unnamed1"><font face="Arial Black" color="#333399">Treasures</font></a></div>
<!--mstheme--></font>
</td>
</center>
<td class="unnamed1" width="85" align="left" valign="baseline" height="15" >
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<p><font color="#333399"><font face="Arial Black"> </font><a href="http://www.robotics.uc.edu/papers.htm" class="unnamed1"><font face="Arial Black" color="#333399">Papers</font></a></font></p>
<!--mstheme--></font>
</td>
<center>
<td class="unnamed1" width="86" align="left" valign="baseline" height="15" >
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<p align="center"><font color="#333399"><font face="Arial Black"> </font><a href="http://www.robotics.uc.edu/links.htm" class="unnamed1"><font face="Arial Black" color="#333399">Links</font></a>
</font><!--mstheme--></font>
</td>
</tr>
69
</table>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"></center><!--mstheme--></font>
<table width="744" border="0" height="308">
<tr>
<td width="736" height="304">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><!--mstheme--></font>
<h3 align="left"><!--mstheme--><font face="Book Antiqua, Times New Roman, Times" color="#660033"><b><i><font color="#800080">
</font></i><font face="Blackadder ITC" size="5" color="#000000">This
page allows authenticated users to control the Robot from WWW.
Please login below to access the web interface of the Bearcat 3
Robot built at the University of Cincinnati. </font><i><font color="#FF0000">Access restricted to authorized users only.
</font></i></b><a href="file:///C:/Documents%20and%20Settings/Keerthi/Thesis/FrontPage/NewUsersignup.htm"><font size="2" face="Arial Narrow" color="#333399"><i>New
User? Sign up with UC Robotics team.(Note: Only U.C
students/Alumni/Faculty will be approved).</i></font></a><!--mstheme--></font> </h3>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><!--mstheme--></font>
<h3 align="left"><!--mstheme--><font face="Book Antiqua, Times New Roman, Times" color="#660033"><center><font size="3"><i><font color="#006600">UC BEARCAT 3 DRIVE LOGIN!</font></i> </font> <!--mstheme--></font> </h3>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<form action="http://localhost:8080/servlet/AuthenticationServlet" method="post">
<div align="center">
<!--mstheme--></font>
<table border="0" cellspacing="2" cellpadding="2" bgcolor="#333399" width="233">
<tr>
<td align="right" width="63" bgcolor="#808080">
70
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<span class="logintext"><b>User ID:</b></span>
<!--mstheme--></font>
</td>
<td align="left" width="152" bgcolor="#808080">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<input name="userid" type="text" size="18" maxlength="10">
<!--mstheme--></font>
</td>
</tr>
<tr>
<td align="right" width="63" bgcolor="#808080">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<span class="logintext"><b>Password:</b></span>
<!--mstheme--></font>
</td>
<td align="left" width="152" bgcolor="#808080">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<input name="password" type="password" size="18" maxlength="16">
<!--mstheme--></font>
</td>
</tr>
<tr>
<td colspan="2" align="center" width="223" bgcolor="#808080">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<input type="submit" name="submit" value="Log In">
<!--mstheme--></font>
</td>
</tr>
</table>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
</div>
71
</form>
<p align="center">
Note: User IDs are not case-sensitive. Passwords <b>are</b> case-sensitive.
</p>
</center><!--mstheme--></font>
</td>
</tr>
</table>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><!--mstheme--></font>
<table width="637" border="0" height="190">
<tr>
<td width="315" height="186">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><img border="0" src="../../../../Bearcat3.bmp" width="281" height="190"><!--mstheme--></font>
</td>
<td width="314" height="186">
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
<p align="left">The U. C Robotics team's current robot, called the
Bearcat 3, has the ability to drive itself down a highway while
detecting obstacles, potholes and lane specifications. It looks
similar to an automated grocery cart. The robot has various
systems like G.P.S, Laser, Sonar and Vision. These integrate and
render the robot A. G. V(Automated guided vehicle) properties.<!--mstheme--></font>
</td>
</tr>
</table>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times"><!--mstheme--></font></td>
</tr>
</table>
<!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
</div>
<!--mstheme--></font>
72
</body>
</html>
4. MainDrive.jsp <%@ page import="java.util.*"%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>This application lets you to eDrive the robot</title>
<script type="text/javascript">
function forwardDriver() {
alert("Working fine..Increasing Bearcat's Forward speed!")
}
function ReverseDriver() {
alert("Working fine..Decreasing Bearcat's speed - Enabling Reverse Drive!")
}
function RightTurnDriver() {
alert("Working fine..Turning Bearcat right!")
}
function LeftTurnDriver() {
alert("Working fine..Turning Bearcat left!")
}
function ZeroTurnRadiusDriver() {
alert("Working fine..Achieving Zero Turn!")
}
function SoftStop() {
alert("Working fine..Soft Stopping the Bearcat!")
}
73
//document.write("Hello World!")
</script>
</head>
<body>
<p align="center"><b><font size="3" face="Arial Narrow" color="#008000"><img border="0" src="coollogo_com_1485434.jpg" width="722" height="47"></font></b></p>
<p align="center"><img border="0" src="Head.jpg" width="801" height="117"></p>
<div align="center">
<center>
<table border="1" width="346" height="112" bgcolor="#336699">
<tr>
<td width="431" height="112" align="right">
<p align="center"><a href="javascript:forwardDriver()"><img border="0" src="Forward.gif" width="58" height="96"></a>
</p>
<p align="center"><a href="javascript:LeftTurnDriver()"><img border="0" src="Left.gif" align="left" width="96" height="58"></a><a href="javascript:RightTurnDriver()"><img border="0" src="Right.gif" align="right" width="96" height="58"></a>
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center"><a href="javascript:ReverseDriver()"><img border="0" src="Reverse.gif" width="96" height="58"></a>
</p>
<p align="center">__________________________________________
</p>
<p align="center"><b><i><u>Soft Stop</u></i></b><a href="javascript:SoftStop()"><img border="0" src="Soft-Stop.gif" width="44" height="44"></a>
</p>
<p align="center"> &n
74
bsp;
</p>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
5. AuthenticationServlet.java
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class AuthenticationServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean authorizedUser = false; response.setContentType("text/html"); PrintWriter out = response.getWriter(); // Enumeration e = request.getParameterNames(); String WebUserId = request.getParameter("userid"); String WebPassword = request.getParameter("password"); String url = "jdbc:odbc:MS Access Database"; Connection con;
String query = "Select User_Id, Password FROM RoboticsUsers " ; Statement stmt; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(java.lang.ClassNotFoundException e) { out.println("ClassNotFoundException: "); out.println(e.getMessage()); } try {
75
con = DriverManager.getConnection (url, "", ""); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String User_Id = rs.getString(1); String Password = rs.getString(2);
if ((User_Id.equals(WebUserId)) && (Password.equals(WebPassword))) { authorizedUser = true; out.print("Welcome - Successful Login!"); response.sendRedirect("http://localhost:8000/MainDrive.jsp"); break; } } stmt.close(); con.close(); } catch(SQLException ex) { out.println("SQLException: "); out.println(ex.getMessage()); } if (authorizedUser == false ) { out.println("<b> Either your user-id/Password is invalid. Please use the browser's BACK button to relogin.<b>"); } out.close(); } }
6. UserRegistrationServlet.java
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class UserRegistrationServlet extends HttpServlet {
76
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String WebEmailId = request.getParameter("email"); String WebPassword = request.getParameter("password"); String WebFirstName = request.getParameter("first_name"); String WebLastName = request.getParameter("last_name"); String WebPhone = request.getParameter("phone"); String WebRadio = request.getParameter("R1"); String WebEducation = request.getParameter("education"); String WebMajor = request.getParameter("major"); String WebAddress = request.getParameter("Address"); String WebCity = request.getParameter("city"); String WebState = request.getParameter("state"); String WebZip = request.getParameter("zip"); String url = "jdbc:odbc:MS Access Database"; Connection con; String query = "Select User_Id, Password FROM RoboticsUsers " ; Statement stmt; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(java.lang.ClassNotFoundException e) { out.println("ClassNotFoundException: "); out.println(e.getMessage()); } try { con = DriverManager.getConnection (url, "", ""); stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet uprs = stmt.executeQuery("SELECT * FROM RoboticsUsers"); uprs.moveToInsertRow(); uprs.updateString("User_Id", WebEmailId); uprs.updateString("Password",WebPassword ); uprs.updateString("First Name", WebFirstName); uprs.updateString("Last Name", WebLastName); uprs.updateString("Phone", WebPhone); uprs.updateString("TypeOfUser", WebRadio); uprs.insertRow(); uprs.beforeFirst(); uprs.close(); stmt.close(); con.close();
77
} catch(SQLException ex) { out.println("SQLException: "); out.println(ex.getMessage()); } out.close(); } } 7. ForwardDriver.java import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ForwardDriver extends HttpServlet { char webselection; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { public native void manual_move(char webselection); response.setContentType("text/html"); PrintWriter out = response.getWriter(); static { System.loadLibrary("manualmove"); } webselection = request.getParameter("userid").charAt(0); new ForwardDriver().manual_move(webselection); out.close(); } }
78
8. Man_move.cpp /********** man_move.cpp Author : Dinesh-Kumar Dhamodarasamy. Modifying BearCat III man_move.cpp program for accessibility to JavaBean classes through the use of Java Native Interface. This program will be part of a .dll that the Java classes would use. ********/ // man_move.cpp //#include <constrea.h> #include <dos.h> #include <iostream.h> #include <conio.h> #include <stdlib.h> #include "car.h" #include "man_move.h" #include "setpid.h" #include "tsonar.h" #include "ManualMove.h" #include <jni.h> float angle=0; void JNIEXPORT void JNICALL Java_ManualMove_manual_1move(JNIEnv *env, jobject obj, jchar WebSelection) { int Dec = 5000; //The Decrement of Stoping as used in Stop int StopBit; // clrscr(); char c; c = WebSelection; // Dinesh. spdx = 0; spdy = 0; startCAR(); while(c!='0'){ system("cls"); // gotoxy(10,7); ///Dinesh cout << " ************************************************************"; // gotoxy(6,9); /* cout << "Use the folowing:\n\n" << "\t7 F-LEFT\t\t8 INCREASE\t\tF-RIGHT 9\n" << "\t4 ZTR-L \t\t5 SOFT STOP\t\t ZTR-R 6 \n" << "\t1 B-LEFT\t\t2 DECREASE\t\tB-RIGHT 3\n" << "\t\t\t\t+ HARD E-STOP\n" << "\t\t\t\t0 TO QUIT\n"; */ clearPC(); clearDMC(); //Dinesh c = getch(); // gotoxy(15,17); //Dinesh cout << "\t Action: "; switch (c) {
79
case '8': // gotoxy (35,17); cout<<"Increase Speed\n\t"; if(spdx+spdy==0) { spdx=ZERO_SPEED; spdy=ZERO_SPEED; speedCARx(spdx); speedCARy(spdy); } else if(spdx>spdy) spdx=spdy; else if(spdx<spdy) spdy=spdx; else if((spdx>=MAX_SPEED)||(spdy>=MAX_SPEED)) { spdx=MAX_SPEED-SPEED_INC; spdy=MAX_SPEED-SPEED_INC; // gotoxy (35,17); // Dinesh cout<<"Maximum Speed \n\t"; } spdx+=SPEED_INC; spdy+=SPEED_INC; speedCARx(spdx); speedCARy(spdy); break; case '2': // gotoxy (35,17); // Dinesh cout<<"Decrease Speed\n\t"; if(spdx+spdy==0) { spdx=ZERO_SPEED; spdy=ZERO_SPEED; } else if((spdx<=MIN_SPEED)||(spdy<=MIN_SPEED)) { spdx=MIN_SPEED; spdy=MIN_SPEED; // gotoxy (35,17); // Dinesh cout<<"Minimum Reversed\n\t"; break; } else if(spdx<spdy) spdx=spdy; else if(spdx>spdy) spdy=spdx; spdx-=SPEED_INC; spdy-=SPEED_INC; speedCARx(spdx); speedCARy(spdy); break; case '5': StopBit = 0;
80
while(StopBit != 1) //This alg. stops the car from { //full stop in 3 seconds // gotoxy (35,17); // Dinesh cout << "Stopping Car \n\t"; if(spdx > Dec) //slow x by Dec {spdx = spdx-Dec;} else {spdx = 0;} //if x is belowe Dec then Stop if(spdy > Dec) {spdy = spdy-Dec;} //slow y by Dec else {spdy = 0;} //if y is below Dec then Stop speedCARx(spdx); //set the x speed speedCARy(spdy); //set the y speed angle=0; //sleep(250); if((spdx == 0) && (spdy == 0)){StopBit = 1;} } break; case '4': // gotoxy (35,17); // Dinesh cout << "ZTR Left Side \n\t"; if(spdx+spdy==0) { spdx-=STEER_INC; spdy+=STEER_INC; speedCARx(spdx); speedCARy(spdy); } else { // gotoxy (35,17); // Dinesh cout << "Stopping Car \n\t"; spdx= -1*STEER_INC; spdy= 1*STEER_INC; speedCARx(spdx); speedCARy(spdy); } break; case '6': // gotoxy (35,17); // Dinesh cout << "ZTR Right Side\n\t"; if(spdx+spdy==0) { spdx+=STEER_INC; spdy-=STEER_INC; speedCARx(spdx); speedCARy(spdy); } else { spdx= 1*STEER_INC; spdy= -1*STEER_INC; speedCARx(spdx); speedCARy(spdy); } break;
81
case '7': // gotoxy (35,17); // Dinesh cout << "Forward Left \n\t"; spdx-=STEER_INC; speedCARx(spdx); break; case '9': // gotoxy (35,17); // Dinesh cout << "Forward Right \n\t"; spdy-=STEER_INC; speedCARy(spdy); break; case '1': // gotoxy (35,17); // Dinesh cout << "Backward Left \n\t"; spdx+=STEER_INC; speedCARx(spdx); break; case '3': // gotoxy (35,17); // Dinesh cout << "Backward Right\n\t"; spdy+=STEER_INC; speedCARy(spdy); break; case '+': //Emergancy Stop in Software // gotoxy (35,17); // Dinesh cout << "SOFT E-STOP!!! \n\t"; spdx = 0; spdy = 0; speedCARx(spdx); speedCARy(spdy); ResetDMC(); initDMC(); NormalSonarControl.InitSonarMotor(); //rotatson.c setpid(); //setpid.c break; default: break; }; // End switch(c) }; // do until '0' is entered // gotoxy (35,17); // Dinesh cout<<"clearing PC\n\t"; stopCAR(); clearPC(); // return(0); }; // End of manual_move()
82
9. man_move.h /********** man_move.h Author : Dinesh-Kumar Dhamodarasamy. Modifying BearCat III g-cart program for accessibility to JavaBean classes through the use of Java Native Interface. This program will be part of a .dll that the Java classes would use. ********/ /* man_move.h Manual Move Functions Permits one to test and drive the golf cart using the keyboard. */ #define MIN_SPEED -35000 #define MAX_SPEED 35000 #define ZERO_SPEED 0 #define MAX_ANGLE 90 #define SPEED_INC 1000 #define STEER_INC 500 extern float angle; int manual_move(char WebSelection); 10. ManualMove.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class ManualMove */ #ifndef _Included_ManualMove #define _Included_ManualMove #ifdef __cplusplus extern "C" { #endif /* * Class: ManualMove * Method: manual_move * Signature: (C)V */ JNIEXPORT void JNICALL Java_ManualMove_manual_1move (JNIEnv *, jobject, jchar); #ifdef __cplusplus } #endif #endif