Artificial Intelligence And Building A Lego Robot Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

This experiment, we will focus on making a Lego robot. The robots and sensors through the use of the code, can avoid obstacles themselves. The robot so that we understand the knowledge of artificial intelligence.

What is AI?

"Artificial intelligence" the novels from the writings of Hugo Rees Degas <The Artilect War>. "Artificial intelligence" is first learned in 1956 raised Dartmouth. Since then, researchers have developed many theories and principles, also will expand the concept of artificial intelligence. AI is a challenging science, in this work must understand computer knowledge, psychology and philosophy. Artificial intelligence is very broad, including science, it is composed by different fields, such as machine learning, computer vision, and so, in general, a major goal of artificial intelligence research is to enable the machine usually requires a number of competent human intelligence to complete complex work. But different times, different people on this "complex work" understanding is different. For example, scientific and engineering computing heavy dignitaries brain could have been borne, and now the computer is not only able to complete this calculation, and can do it faster than the human brain, more accurately, consequent to modern people no longer see this calculation as a "human intelligence needed to complete the complex task", the definition of complex work can be seen as the era of robots with artificial intelligence, hair

The progress of development and changes in technology, artificial intelligence, the specific objectives of this science is also changing with the times of natural development. On the one hand to gain new progress, on the one hand and turned to more meaningful and more difficult goals. Now can be used to study artificial intelligence and the ability to achieve key material means the machine is the computer artificial intelligence, artificial intelligence and computer history is the history of science and technology linked. In addition to outside computer science, artificial intelligence also involves information theory, cybernetics, automation, bionics, biology, psychology and mathematical logic, linguistics, medicine and philosophy and other disciplines. The main subject of artificial intelligence include: knowledge representation, automated reasoning and search methods, machine learning and knowledge acquisition, knowledge processing systems, natural language understanding, computer vision, intelligent robot, automatic program design.

Practical application

Machine Vision: fingerprint identification, face recognition, retina recognition, iris recognition, palmprint recognition, expert systems, intelligent search, theorem proving, game, automatic programming, as well as aerospace applications.

Subject areas

Edge artificial intelligence is a discipline, a natural science and social science of the cross.

Related subjects

 Philosophy and cognitive science, mathematics, neurophysiology, psychology, computer science, information theory, control theory, uncertainty theory, bionics,

Research Areas

 Natural language processing, knowledge representation, intelligent search, reasoning, planning, machine learning, knowledge acquisition, combined scheduling problems, perception problems, pattern recognition, logic programming, soft computing, the management of imprecise and uncertain, artificial life, neural networks , complex systems, genetic algorithms the way humans think


Intelligent control, expert systems, robotics, language and image understanding, genetic programming robot factory

Security issues

Study of artificial intelligence is still present, but some scholars believe that the computer to have IQ is very dangerous, it may against humanity. The hidden dangers also occurred in many films.

About the robot

The robot is assembled with parts made of Lego! We can see the robot with two motors to connect the host to receiving and processing of operational information. Even with two front crash sensor. When the joint activities to any one of the collision sensor, the sensor will send a signal to the host! At this time, the host will be set by the original method of good code and issued a directive allowing the robot motors around obstacles. In fact, the method used in this robot seems like ANN, neural network

ANN, Neural network.

ANN algorithm is derived from the nervous system of living organisms, in order to facilitate follow-up note, to everyone on a screenshot:

Figure 1

According to the work of the nervous system of biological process, we can probably understand this map to express the following meanings:

Figure 2

We can imagine such a situation: the cold winter, we reach out to the fire warming himself, and slowly, you feel like going to sleep, this time, suddenly found himself stretched out the hand of the fire special too hot pain, and then immediately Will hand back out. This is the work of a neural network example, the temperature of the fire generated opponents Figure 2 is the input layer (Input), while scaling back or not scaling back output layer is shown in Figure 2 (Output). But scaling back the temperature only in the hands only occur up to a certain extent, for example 40 degrees.

Represented in Figure 2, the situation described above:

X1 = temperature of the fire generated for hand.

w1 = fire rivals the weight of the temperature generated (generated for hands for the fire to enlarge or reduce the temperature, we let the value of 1)

Activation function (Active Function) = if x1 * w1> 40 activation (scaling back), or inhibition (not scaling back)

This is a single-input, and if there are multiple input, the output is f (x1 * w1 + x2 * w2 + x3 * w3 ...)

Where, f (x) as activation function.

Below, we look at more input neural network images:


x1= First input


Activation function f(x)

x2= Second input


AND operation:

f (x) =

If (x> = 2) return 1;

Else return 0;

Threshold is 2

We can use this structure to test it is correct:

X1 = 0, x2 = 0, x = x1 * w1 + x2 * w2 = 0 f (x) = 0; correct

X1 = 0, x2 = 1, x = x1 * w1 + x2 * w2 = 1 f (x) = 0; correct

X1 = 1, x2 = 0, x = x1 * w1 + x2 * w2 = 1 f (x) = 0; correct

X1 = 1, x2 = 1, x = x1 * w1 + x2 * w2 = 2 f (x) = 0; correct

OR Operation

f (x) =

If (x> = 1) return 1;

Else return 0;

Threshold is 1

We can use this structure to test it is correct:

X1 = 0, x2 = 0, x = x1 * w1 + x2 * w2 = 0 f (x) = 0; correct

X1 = 0, x2 = 1, x = x1 * w1 + x2 * w2 = 1 f (x) = 1; correct

X1 = 1, x2 = 0, x = x1 * w1 + x2 * w2 = 1 f (x) = 1; correct

X1 = 1, x2 = 1, x = x1 * w1 + x2 * w2 = 2 f (x) = 1; correct

About the Code

I will show one part code of this robot. This part is control the robot when the sensor is hitting the wall. Then it will stop one of the motor.








import josx.robotics.*;

import josx.platform.rcx.*;

public class HitWall implements Behavior


public boolean takeControl()


return Sensor.S2.readBooleanValue();


public void suppress()





public void action()




try{Thread.sleep(1000);}catch(Exception e){}


try{Thread.sleep(300);}catch(Exception e){}




About the shortcomings

Although this robot can run smoothly and to judge, but still has shortcomings can't be ignored. First, the robot itself needs to be fully complete access to the sensed obstacle. If it can do a similar imitation of the sound waves to determine the biological, may be able to solve this problem. Second, the robot is no logical way of thinking. This is important, not logical thinking, every time when access to the obstacle, the robot will only be set in accordance with the method is repeated each time to judge! That is not logic, if the set is to determine the left and the right after the judge. So next time the robot to judge only by this method. It will increase the response time. Third, the robot itself does not have memory function. This is a very important module. Robots have no memory feature, when faced with the same route when the last time because there is no saving the best route, so the robot encountered the same obstacles and the first time was the same as when walking, continue to use the original method to determine.