SlideShare a Scribd company logo
1 of 8
New York City College of Technology
Submitted By:
Frantz St Valliere
SEGWAY NXT
CET4962
Applied Software Technology
FINAL PROJECT PAPER
Due date: May 4, 2012
Submission date: May 4, 2012
Submitted To:
Professor C. Sher-Decusatis
Frantz St Valliere
CET 4962
Professor Carolyn J. Sher DeCusatis
4/29/12
Segway NXT Robot
Legos, the king of building blocks, have made it possible for children to enjoy
building and creating cars, boats, or even people using building blocks. In fact, they have
become so famous; they even have a Star Wars cartoon show, as well as the game based on the
movie series. But is Lego blocks only for kids? Well of course, Legos made it possible for adults
to join in the fun (technically that is). Legos created the Lego Mindstorms. This package includes
the intelligence brick, which controls every motor or sensor connected to it. The sensors can
include an ultrasonic sensor, which can sense distances between objects. Also included is one
light sensor, which can sense light differences in the room. A push button sensor is utilized to
prevent the robot from bumping into objects near. A microphone sensor is used to test sound in
the room. The Mindstorms also include three motors to rotate wheels or create rotating arms. Of
course Legos have made it possible to give you all the possible pieces that come with the
Mindstorms. The come include with an instructional booklet to create a robot that utilizes all
parts. A creator can make different shapes and forms of the robot, making it endless possibilities.
Of course all the sensors mentioned before are not all. There are many other sensors not included
in the Mindstorms package (which in fact is already two hundred dollars). Some extra sensors
out there feature an IR sensor to sense push button commands on a programmed remote
controller. There is also an accelerometer which can control the robots acceleration and senses
three-axis of the robot. A compass sensor can sense the direction with the earth’s magnetic field.
All sensors can give an output to the user (which is on the LCD screen of the intelligence brick)
so the user can know any changes that need to be made.
One sensor that is notable to this project was the gyroscopic sensor. This sensor
was not created by Legos but by a third party company HiTechnic. This sensor (which was
original one hundred and ten dollars) was the key ingredient to the project because it specializes
in balancing. My project was the Segway.
FIGURE 1 – SEGWAY
Of course the NXT robot did not look exactly like the Segway shown in Figure 1
however the prime purpose to a Segway is balance. A Segway only balances on two wheels but
how? Wouldn’t the Segway fall forward or backward? A gyro sensor is what controls the
balance because it senses the orientation of the sensor, not the robot or the human riding a human
size Segway. The robot is controlled by the readings of the gyroscopic sensor. Whatever readings
provided will control how the motor rotates. In fact the best possible way to control how the
NXT robot moves is to program the NXT robot in Java. Originally, the idea was to use a light
sensor to balance the robot, however it
The NXT robot comes with flash software for kids to easily program how the
robot maneuvers provided by NI LabVIEW. This program is called NXT-G. This software can
optimize how it performs in competitions. The programs uses block by block GUI commands
which features how the robot should do what you want it to do and how long you want to do it.
This GUI base program is great for the younger audience. However, there are many ways to
program the NXT brick. Prior to this project, this class was introduced to Java (different to Java
Script). This programming language is the backbone to how the NXT will function. To write
programming code, we use Eclipse.
FIGURE 2 – ECLIPSE IDE TO CODE JAVA
Eclipse is the best utility to code in Java. However, it was somewhat a headache to get
Eclipse to link the NXT intelligence brick. First, step was to install the Java SDK in order to
compile and run on the NXT using Java. The next step was to download the Fantom drivers in
order for the computer to link the NXT robot to work on USB or Bluetooth. Last step, is to
download the LeJOS NXJ operating system. This operating system lives on Java programming.
Using the LeJOS operating system, we can flash the NXT intelligence brick to work with Java.
This will remove the NXT-G operating system and will be replaced with the LeJOS NXJ.
Flashing the intelligence brick can be done within Eclipse with the right files installed. If
successful, you can test the simplest program “Hello World.”
This will display “Hello World!” on the LCD screen. This result will earn the access
to other programming capabilities which of course will be the Segway program.
The Segway program is not as simple as the Hello World program. In fact we have to
incorporate all the sensors available to make the NXT robot work the way it should. In the
program, the sensors and motors have to be initialized. In the program we have two sensors and
two different motors. The robot uses the ultrasonic sensor to provide protection between the
robot and the item it approaches. To initiate the ultrasonic sensor we need to write this line of
code: UltrasonicSensor us = new UltrasonicSensor(SensorPort.S4);. This will activate the
sensor as well as the port connected to the NXT intelligence brick. The keyword new creates a
class for the ultrasonic sensor. That way in line 20 (if (us.getDistance() < 40)) we can use
the dot operator to manipulate the variable “us”. This is similar to C++ except in C++ we are
forced to created public and private variables in a class. Line 20 controls the distance between
//Lab_0_HelloWorld
import lejos.nxt.*;
public class HelloWorld
{
public static void main (String[]args)
{
System.out.printIn(“Hello World!”); //Displays the string on the screen
Button.waitForPress();//Button press ends the program
}
}
the ultrasonic sensor and an object. If the distance is less than 40cm then it will initiate whatever
is included in the “if” statement.
Line 13 (GyroSensor g = new GyroSensor (SensorPort.S1);), initiates the gyroscopic
sensor class. The GyroSensor class contains all it needs to provide the stability it needs to control
the robot’s balance. Thankfully, the code needed to define the class is already included. Every
add-on (the ultrasonic sensor, the gyroscopic sensor and the two motors) are defined in different
classes. Each one has their own class defined. Once compiled, and tested to ensure there are no
mistakes, the robot will indeed balance and move forward. It will back up and turn when a object
is near, and continue forward until it falls.
Here is the code used to program the robot.
References:
Bagnall, Brian. Intelligence Unleashed: Creating LEGO NXT Robots with Java. Winnipeg,
Manitoba: Variant, 2011. Print.
"Lego Segway Balancing Problem." Http://lejos.sourceforge.net/forum/viewtopic.php?f
=6&t=2965. 28 Oct. 2011. Web. 29 Apr. 2012. <http://lejos.sourceforge.net/forum/
viewtopic.php?f=6&t=2965>

More Related Content

Similar to Final Project

Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Ankita Tiwari
 
System Document (Revised)
System Document (Revised)System Document (Revised)
System Document (Revised)Zeyad Saleh
 
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docxopensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docxhopeaustin33688
 
Aoyagi Lab Colloquium - 2015-05-11
Aoyagi Lab Colloquium - 2015-05-11Aoyagi Lab Colloquium - 2015-05-11
Aoyagi Lab Colloquium - 2015-05-11Michele Bianchi
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docxOmpawar61
 
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...OhSoAwesomeGirl
 
THE THIRD EYE-Presentation
THE THIRD EYE-PresentationTHE THIRD EYE-Presentation
THE THIRD EYE-PresentationRomil Shah
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015Ryan Vanderwerf
 
Google project soli report
Google project soli reportGoogle project soli report
Google project soli reportSunil Havani
 
How I hacked the Google Daydream controller
How I hacked the Google Daydream controllerHow I hacked the Google Daydream controller
How I hacked the Google Daydream controllerMatteo Pisani
 
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web CameraGesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web CameraIJERD Editor
 
IEM ECE Electrovision 2013
IEM ECE Electrovision 2013IEM ECE Electrovision 2013
IEM ECE Electrovision 2013agomoni16
 
Touchless-Touchscreen-Technology-PPT.pptx
Touchless-Touchscreen-Technology-PPT.pptxTouchless-Touchscreen-Technology-PPT.pptx
Touchless-Touchscreen-Technology-PPT.pptxArebuMaruf
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System RequirementsLaura Arrigo
 
google tango technology Seminar report
google tango technology Seminar reportgoogle tango technology Seminar report
google tango technology Seminar reportRUPESHKUMAR633
 

Similar to Final Project (20)

virtual_chess
virtual_chessvirtual_chess
virtual_chess
 
Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.
 
System Document (Revised)
System Document (Revised)System Document (Revised)
System Document (Revised)
 
Report
ReportReport
Report
 
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docxopensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
 
Aoyagi Lab Colloquium - 2015-05-11
Aoyagi Lab Colloquium - 2015-05-11Aoyagi Lab Colloquium - 2015-05-11
Aoyagi Lab Colloquium - 2015-05-11
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docx
 
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
 
MouthMouse
MouthMouseMouthMouse
MouthMouse
 
THE THIRD EYE-Presentation
THE THIRD EYE-PresentationTHE THIRD EYE-Presentation
THE THIRD EYE-Presentation
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015
 
Google project soli report
Google project soli reportGoogle project soli report
Google project soli report
 
How I hacked the Google Daydream controller
How I hacked the Google Daydream controllerHow I hacked the Google Daydream controller
How I hacked the Google Daydream controller
 
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web CameraGesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
 
IEM ECE Electrovision 2013
IEM ECE Electrovision 2013IEM ECE Electrovision 2013
IEM ECE Electrovision 2013
 
Touchless-Touchscreen-Technology-PPT.pptx
Touchless-Touchscreen-Technology-PPT.pptxTouchless-Touchscreen-Technology-PPT.pptx
Touchless-Touchscreen-Technology-PPT.pptx
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System Requirements
 
final paper
final paperfinal paper
final paper
 
google tango technology Seminar report
google tango technology Seminar reportgoogle tango technology Seminar report
google tango technology Seminar report
 

Final Project

  • 1. New York City College of Technology Submitted By: Frantz St Valliere SEGWAY NXT CET4962 Applied Software Technology FINAL PROJECT PAPER Due date: May 4, 2012 Submission date: May 4, 2012 Submitted To: Professor C. Sher-Decusatis
  • 2. Frantz St Valliere CET 4962 Professor Carolyn J. Sher DeCusatis 4/29/12 Segway NXT Robot Legos, the king of building blocks, have made it possible for children to enjoy building and creating cars, boats, or even people using building blocks. In fact, they have become so famous; they even have a Star Wars cartoon show, as well as the game based on the movie series. But is Lego blocks only for kids? Well of course, Legos made it possible for adults to join in the fun (technically that is). Legos created the Lego Mindstorms. This package includes the intelligence brick, which controls every motor or sensor connected to it. The sensors can include an ultrasonic sensor, which can sense distances between objects. Also included is one light sensor, which can sense light differences in the room. A push button sensor is utilized to prevent the robot from bumping into objects near. A microphone sensor is used to test sound in the room. The Mindstorms also include three motors to rotate wheels or create rotating arms. Of course Legos have made it possible to give you all the possible pieces that come with the Mindstorms. The come include with an instructional booklet to create a robot that utilizes all parts. A creator can make different shapes and forms of the robot, making it endless possibilities. Of course all the sensors mentioned before are not all. There are many other sensors not included in the Mindstorms package (which in fact is already two hundred dollars). Some extra sensors out there feature an IR sensor to sense push button commands on a programmed remote controller. There is also an accelerometer which can control the robots acceleration and senses three-axis of the robot. A compass sensor can sense the direction with the earth’s magnetic field.
  • 3. All sensors can give an output to the user (which is on the LCD screen of the intelligence brick) so the user can know any changes that need to be made. One sensor that is notable to this project was the gyroscopic sensor. This sensor was not created by Legos but by a third party company HiTechnic. This sensor (which was original one hundred and ten dollars) was the key ingredient to the project because it specializes in balancing. My project was the Segway. FIGURE 1 – SEGWAY Of course the NXT robot did not look exactly like the Segway shown in Figure 1 however the prime purpose to a Segway is balance. A Segway only balances on two wheels but how? Wouldn’t the Segway fall forward or backward? A gyro sensor is what controls the balance because it senses the orientation of the sensor, not the robot or the human riding a human size Segway. The robot is controlled by the readings of the gyroscopic sensor. Whatever readings provided will control how the motor rotates. In fact the best possible way to control how the
  • 4. NXT robot moves is to program the NXT robot in Java. Originally, the idea was to use a light sensor to balance the robot, however it The NXT robot comes with flash software for kids to easily program how the robot maneuvers provided by NI LabVIEW. This program is called NXT-G. This software can optimize how it performs in competitions. The programs uses block by block GUI commands which features how the robot should do what you want it to do and how long you want to do it. This GUI base program is great for the younger audience. However, there are many ways to program the NXT brick. Prior to this project, this class was introduced to Java (different to Java Script). This programming language is the backbone to how the NXT will function. To write programming code, we use Eclipse. FIGURE 2 – ECLIPSE IDE TO CODE JAVA Eclipse is the best utility to code in Java. However, it was somewhat a headache to get Eclipse to link the NXT intelligence brick. First, step was to install the Java SDK in order to compile and run on the NXT using Java. The next step was to download the Fantom drivers in order for the computer to link the NXT robot to work on USB or Bluetooth. Last step, is to
  • 5. download the LeJOS NXJ operating system. This operating system lives on Java programming. Using the LeJOS operating system, we can flash the NXT intelligence brick to work with Java. This will remove the NXT-G operating system and will be replaced with the LeJOS NXJ. Flashing the intelligence brick can be done within Eclipse with the right files installed. If successful, you can test the simplest program “Hello World.” This will display “Hello World!” on the LCD screen. This result will earn the access to other programming capabilities which of course will be the Segway program. The Segway program is not as simple as the Hello World program. In fact we have to incorporate all the sensors available to make the NXT robot work the way it should. In the program, the sensors and motors have to be initialized. In the program we have two sensors and two different motors. The robot uses the ultrasonic sensor to provide protection between the robot and the item it approaches. To initiate the ultrasonic sensor we need to write this line of code: UltrasonicSensor us = new UltrasonicSensor(SensorPort.S4);. This will activate the sensor as well as the port connected to the NXT intelligence brick. The keyword new creates a class for the ultrasonic sensor. That way in line 20 (if (us.getDistance() < 40)) we can use the dot operator to manipulate the variable “us”. This is similar to C++ except in C++ we are forced to created public and private variables in a class. Line 20 controls the distance between //Lab_0_HelloWorld import lejos.nxt.*; public class HelloWorld { public static void main (String[]args) { System.out.printIn(“Hello World!”); //Displays the string on the screen Button.waitForPress();//Button press ends the program } }
  • 6. the ultrasonic sensor and an object. If the distance is less than 40cm then it will initiate whatever is included in the “if” statement. Line 13 (GyroSensor g = new GyroSensor (SensorPort.S1);), initiates the gyroscopic sensor class. The GyroSensor class contains all it needs to provide the stability it needs to control the robot’s balance. Thankfully, the code needed to define the class is already included. Every add-on (the ultrasonic sensor, the gyroscopic sensor and the two motors) are defined in different classes. Each one has their own class defined. Once compiled, and tested to ensure there are no mistakes, the robot will indeed balance and move forward. It will back up and turn when a object is near, and continue forward until it falls.
  • 7. Here is the code used to program the robot.
  • 8. References: Bagnall, Brian. Intelligence Unleashed: Creating LEGO NXT Robots with Java. Winnipeg, Manitoba: Variant, 2011. Print. "Lego Segway Balancing Problem." Http://lejos.sourceforge.net/forum/viewtopic.php?f =6&t=2965. 28 Oct. 2011. Web. 29 Apr. 2012. <http://lejos.sourceforge.net/forum/ viewtopic.php?f=6&t=2965>