Computer Science i need help with a lego mindstorm code nxt v1 code   import lejos.nxt.*; import lejos.robotics.navigation.*; /** * Robot that stops if escape button pressed. */ public class TravelTest { DifferentialPilot pilot; public void go() { pilot.travel(100, true); //100 centimeters pilot.rotate(90.0); //degrees while (pilot.isMoving()) { if (Button.ESCAPE.isPressed()) pilot.stop(); } System.out.println(" " + pilot.getMovement().getAngleTurned()); System.out.println(" " + pilot.getMovement().getDistanceTraveled ()); Button.waitForPress(); } public static void main(String[] args) { TravelTest traveler = new TravelTest(); traveler.pilot = new DifferentialPilot(3.1, 13.5, Motor.A, Motor.C); //parameters in centimeters traveler.go();   63 } } In the above example, we cause the robot to rotate in place by a specified angle by using • void rotate(double degrees) Moreover, we must have accurate values for wheelDiameter and trackWidth for this method to produce accurate results. The diameter is the widest measurement from one side of a circle to the other. In this project, according to my measurement, it is 3.1 centimeters. In order to record accurate rotations when the robot turns, it’s important to know the measurement from wheel to wheel, called the track width. There should be a theoretical point where the wheel touches the ground. Since we use the wheel belt on our robot, its flatness makes it difficult to determine precise track width. Since LEGO tires are symmetrical, the best way is to measure from the center of one tire to the center of the other. In my program, I used 13.5 because it works very well with my robot. You need to find an accurate number for your robot. The final parameters for the DifferentialPilot are the motors for the left and right wheels. In the above example program, the left motor is connected to port A and the right motor is connected to port C.   1. Write a program to create a robot that traces out a square with sides of a predetermined length, which is set to 1 meter in this project. You can refer code of the example in the preparation part of this pr

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Computer Science

i need help with a lego mindstorm code nxt v1 code

 

import lejos.nxt.*;

import lejos.robotics.navigation.*;

/**

* Robot that stops if escape button pressed.

*/

public class TravelTest {

DifferentialPilot pilot;

public void go() {

pilot.travel(100, true); //100 centimeters

pilot.rotate(90.0); //degrees

while (pilot.isMoving()) {

if (Button.ESCAPE.isPressed())

pilot.stop();

}

System.out.println(" " + pilot.getMovement().getAngleTurned());

System.out.println(" " + pilot.getMovement().getDistanceTraveled ());

Button.waitForPress();

}

public static void main(String[] args) {

TravelTest traveler = new TravelTest();

traveler.pilot = new DifferentialPilot(3.1, 13.5, Motor.A,

Motor.C); //parameters in centimeters

traveler.go();

 

63

}

}

In the above example, we cause the robot to rotate in place by a specified angle

by using

• void rotate(double degrees)

Moreover, we must have accurate values for wheelDiameter and trackWidth for

this method to produce accurate results. The diameter is the

widest measurement from one side of a circle to the other. In this project,

according to my measurement, it is 3.1 centimeters. In order to record

accurate rotations when the robot turns, it’s important to know the

measurement from wheel to wheel, called the track width. There should be a

theoretical point where the wheel touches the ground. Since we use the wheel

belt on our robot, its flatness makes it difficult to determine precise track

width. Since LEGO tires are symmetrical, the best way is to measure from the

center of one tire to the center of the other. In my program, I used 13.5 because

it works very well with my robot. You need to find an accurate number for

your robot. The final parameters for the DifferentialPilot are the motors

for the left and right wheels. In the above example program, the left motor

is connected to port A and the right motor is connected to port C.

 

1. Write a program to create a robot that traces out a square with sides of a

predetermined length, which is set to 1 meter in this project. You can

refer code of the example in the preparation part of this project.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY