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...


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.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here