Task #2 Basic Robot Programming

Ariel Safiya Taylor                                          Robotics: Task 2

Summary: In this task, the objective was to program the robot to move in a closed shape and return to the starting position. We were to use NXT and RobotC to program the movements of the robot to travel in a straight line with a distance of 2 meters. Also we were to add a sensor to the robot and program the robot to respond by moving according to the values given to the sensors.

What you have learned: I learned that although the motors connected to the robot may be set to the same value, they results can differ depending on the power of the individual motors. Trial and error helped find adequate values so that the movement was accurate enough to move in the intended direction.

Challenges:  A challenge I had with this task was getting my sensor to recognize an object so that it can react and move in the programmed direction. In my case, I used the touch sensor which was to detect bumping into an object and move in reverse away from the object. When I ran the code, the sensor hesitated before it would react to the touch of an object.

Constraints:  This was my first task so trying to learn the RobotC language in a short time was a constraint in coding the movement using this language.

Observations:  I realized that testing the codes are very important in finding out the errors within the program. Trial and error help solve these errors as some values need to be adjusted to accommodate to proper movement of robot.

This is a screenshot of the NXT program I used in creating a straight line. I choose to use seconds to determine the duration of the movement. This also helped with getting the robot to travel a distance of 2 meters and stop. I did not want to use full battery power because I thought it would move too fast and stopping would be a bit difficult.

For creating a square shape I used a looping technique because it returns to the starting position precisely. The movement has turns and forward movement with the same value giving the closed shape equal dimension.

The last screenshot of my NXT programs is the touch sensor program that is supposed to move forward in a straight line until it hits an object then it is supposed to move in reverse if the sensor is activated. A very simple program because the touch sensor has only 2 values which are 1 and 0 which represents the state of the button. So while the button is not touched it should keep moving forward.


Task #2 – basic robot programming

Objective 1: Get the robot two move two meters straight
Calculations & measurements:
1 inch  =  2.54cm
100cm = 1 m
1m = 100cm
2m = 200cm
Wheel radius: 2.75cm
Wheel diameter: 5.5cm
2 x (22/7) x r = 17.27875959 radians/sec
Total distance to cover = 200cm; therefore:
->    200 / 17.27875959
->   11.57490495 radians/sec
 Therefore total number of revolutions:
->    11.57490495 x 360 radians/sec
->   4166.965783 radians/sec

Program 1: using the Lego NXT Mindstorms Software
The NXT program was written using the number of revolutions as one the key parameters for the objective. Below are some of the results obtained after the robot was tested using 11 and 12 revolutions:

Continue reading

Task#2: Basic Robot Programing


1. To program a robot to drive 2m in a straight line

2. To program a robot to move in a closed shape

3. To program a robot to perform a task using 2 sensors

Figure 1 - My Robot

To program a robot to drive 2m in a straight line


This task required one to use both the NXT Visual Programming Language and RobotC language to write a program that would get a robot to move 2 meters in a straight line. My initial idea was to keep the power level of my robot’s motors at a constant level e.g. 70, and then get the robot to move for a number of seconds. After that, I’d measure the distance travelled by the robot in order to find the speed. With the calculated speed and the known distance of 2 meters, the following formula:

Continue reading

Task#2: Basic Robot Programing

Robotics, 2nd Semester (Jan-May) 2012
Nii Adjetey Sowah

Task Objectives:
– Build a differential drive robot using parts from the Lego Mindstorm kit.
– Write a program to get my robot to drive 2m in a straight line (using RobotC and NXT visual programing language).
– Write another program to get my robot to drive in a closed shape of my choice (using RobotC and NXT visual programing language).
– Perform a task using sensors from the Lego Mindstorm kit.

This is a report to discuss the completion of the stated objectives above.

Figure1.1 Images of my differential drive robot

Continue reading