3
3DOF drawing robot using LEGO-NXT ´ Akos H´ amori, J´ anos Lengyel, Barna Resk´ o Alba Regia University Center ´ Obuda University, Hungary [email protected] [email protected] [email protected] Abstract— This paper presents a 3 DOF robotic arm used for drawing on a paper sheet. The robotic arm is constructed using LEGO NXT bricks. The purpose of the development was to create a control system of the servo motors for the robot, as well as the inverse kinematics, used for moving the arm. The NXT controller is running LejOS for optimal motor control, while inverse kinematics is being calculated on a PC connected to the NXT via bluetooth. The robotic arm is well applied in education projects about robotics and robot programming. I. I NTRODUCTION The robots play an important role nowadays in the industry, research, and their growing number is due to their wider and more extensive use in different areas. In order to make them tangible for students, they should also be well applied in education in the field of technical and information sciences [1]. This paper deals with a 3DOF robot arm made from the popular LEGO-NXT, which can be controlled remotely via the Internet. The LEGO-NXT robot arm is made up of building blocks, so it can be easily further developed. The arm pivot movement of the servomotors in stock ensure that the positioning ones own software carried out by the inverse- kinematics, Bluetooth and other technologies. In this paper we present a model of a robot arm, which was built out of LEGO- NXT. We designed the structure and the software. The robotic arm can be controlled from a PC, via bluetooth. The coordinate data on the PC side software is sent to the articulation angles of the displacement of the NXT brick. The NXT-Brick in the joint area of engine positioning. Following chapters discuss in detail the background of robotics, LEGO NXT-operation and how we applied our solution to these. The goal of the robot arm is to provide a robotic platform that can draw on a paper sheet, with the purpose of educational use in the field of robotics and robot programming. The rest of the paper is organized as follows. Finally, Section concludes the paper. II. BACKGROUND This sections describes the technologies we applied to build the robot arm. A. Lego NXT Lego NXT [2] is a very popular robotics kit released by the Lego company. It is very easy and intuitive to build robotics hardware with the available lego pieces, and the controller provided gives full control over the actuators and sensors of the kit, allowing fast and efficient software development. The Lego NXT control block has an embedded computer, some buttons, 4 inputs and 3 outputs. The main processor is an Atmel 32-bit ARM processor with 256 KB FLASH, 64 KB RAM, 48 MHz, and there is an Atmel 8-bit AVR co- processor, ATmega48 4 KB FLASH, 512 Byte RAM, 8 MHz. The NXT’s three output ports (A, B, C) allow for attaching motors, while the four input ports allow for attaching sensors and a USB port to download programs from your computer to the NXT. A wireless Bluetooth connection is also available for for uploading, downloading programs, as well as for real-time data communication and control. The programming of an NXT brick can be done in many ways. The simplest way is to use the LabView extension of the software that comes with the kit. For advanced users, a c-like language with an extensive API is also available, called NXC. LejOS is an alternative operating system on the NXT brick, which allows development in Java. No matter which language is used, the NXT can be applied to implement robotics tasks from beginners to advanced software developers. The bluetooth connection of the NXT opens the gate for higher levels of intelligent autonomous behavior, which can run on a remote PC, controlling the NXT via a wireless link. The advantages above were the main reasons why the Lego NXT kit was applied in the implementation of the robot discussed in this paper. B. Inverse kinematics The inverse kinematics problem is simply stated as, ”Given the desired position of the robot’s hand, what must be the angles at all of the robot’s joints?” This is in contrast to the forward kinematics problem, which is, ”Given the angles at all of the robot’s joints, what is the position of the hand?” When moving their hands, or even typing this paper, humans constantly solve the inverse kinematics problem without any conscious effort. The positioning problem is illustrated in Figure 1. Kinematics is the formal description of motion. One of the goals of rudimentary mechanics is to identify forces on a point object and then apply kinematics to determine the motion of the object. Ideally the position of the object at all times can be determined. For an extended object, (rigid body or other), along with linear kinematics, rotational motion can be applied to achieve the same objective: Identify the forces, develop the equations of motion, find the position – 293 – INES 2011 • 15th International Conference on Intelligent Engineering Systems • June 23–25, 2011, Poprad, Slovakia 978-1-4244-8956-5/11/$26.00 ©2011 IEEE

[IEEE 2011 15th IEEE International Conference on Intelligent Engineering Systems (INES) - Poprad, Slovakia (2011.06.23-2011.06.25)] 2011 15th IEEE International Conference on Intelligent

  • Upload
    barna

  • View
    213

  • Download
    1

Embed Size (px)

Citation preview

Page 1: [IEEE 2011 15th IEEE International Conference on Intelligent Engineering Systems (INES) - Poprad, Slovakia (2011.06.23-2011.06.25)] 2011 15th IEEE International Conference on Intelligent

3DOF drawing robot using LEGO-NXTAkos Hamori, Janos Lengyel, Barna Resko

Alba Regia University CenterObuda University, Hungary

[email protected]@[email protected]

Abstract— This paper presents a 3 DOF robotic arm used fordrawing on a paper sheet. The robotic arm is constructed usingLEGO NXT bricks. The purpose of the development was tocreate a control system of the servo motors for the robot, aswell as the inverse kinematics, used for moving the arm. TheNXT controller is running LejOS for optimal motor control,while inverse kinematics is being calculated on a PC connectedto the NXT via bluetooth. The robotic arm is well applied ineducation projects about robotics and robot programming.

I. INTRODUCTION

The robots play an important role nowadays in the industry,research, and their growing number is due to their wider andmore extensive use in different areas. In order to make themtangible for students, they should also be well applied ineducation in the field of technical and information sciences[1]. This paper deals with a 3DOF robot arm made fromthe popular LEGO-NXT, which can be controlled remotelyvia the Internet. The LEGO-NXT robot arm is made up ofbuilding blocks, so it can be easily further developed. Thearm pivot movement of the servomotors in stock ensure thatthe positioning ones own software carried out by the inverse-kinematics, Bluetooth and other technologies. In this paper wepresent a model of a robot arm, which was built out of LEGO-NXT. We designed the structure and the software. The roboticarm can be controlled from a PC, via bluetooth. The coordinatedata on the PC side software is sent to the articulation anglesof the displacement of the NXT brick. The NXT-Brick in thejoint area of engine positioning. Following chapters discussin detail the background of robotics, LEGO NXT-operationand how we applied our solution to these. The goal of therobot arm is to provide a robotic platform that can draw on apaper sheet, with the purpose of educational use in the fieldof robotics and robot programming. The rest of the paper isorganized as follows. Finally, Section concludes the paper.

II. BACKGROUND

This sections describes the technologies we applied to buildthe robot arm.

A. Lego NXT

Lego NXT [2] is a very popular robotics kit released by theLego company. It is very easy and intuitive to build roboticshardware with the available lego pieces, and the controllerprovided gives full control over the actuators and sensors ofthe kit, allowing fast and efficient software development.

The Lego NXT control block has an embedded computer,some buttons, 4 inputs and 3 outputs. The main processor isan Atmel 32-bit ARM processor with 256 KB FLASH, 64KB RAM, 48 MHz, and there is an Atmel 8-bit AVR co-processor, ATmega48 4 KB FLASH, 512 Byte RAM, 8 MHz.The NXT’s three output ports (A, B, C) allow for attachingmotors, while the four input ports allow for attaching sensorsand a USB port to download programs from your computer tothe NXT. A wireless Bluetooth connection is also available forfor uploading, downloading programs, as well as for real-timedata communication and control.

The programming of an NXT brick can be done in manyways. The simplest way is to use the LabView extension ofthe software that comes with the kit. For advanced users,a c-like language with an extensive API is also available,called NXC. LejOS is an alternative operating system on theNXT brick, which allows development in Java. No matterwhich language is used, the NXT can be applied to implementrobotics tasks from beginners to advanced software developers.The bluetooth connection of the NXT opens the gate for higherlevels of intelligent autonomous behavior, which can run on aremote PC, controlling the NXT via a wireless link.

The advantages above were the main reasons why the LegoNXT kit was applied in the implementation of the robotdiscussed in this paper.

B. Inverse kinematics

The inverse kinematics problem is simply stated as, ”Giventhe desired position of the robot’s hand, what must be theangles at all of the robot’s joints?” This is in contrast to theforward kinematics problem, which is, ”Given the angles atall of the robot’s joints, what is the position of the hand?”When moving their hands, or even typing this paper, humansconstantly solve the inverse kinematics problem without anyconscious effort. The positioning problem is illustrated inFigure 1.

Kinematics is the formal description of motion. One ofthe goals of rudimentary mechanics is to identify forces ona point object and then apply kinematics to determine themotion of the object. Ideally the position of the object atall times can be determined. For an extended object, (rigidbody or other), along with linear kinematics, rotational motioncan be applied to achieve the same objective: Identify theforces, develop the equations of motion, find the position

– 293 –

INES 2011 • 15th International Conference on Intelligent Engineering Systems • June 23–25, 2011, Poprad, Slovakia

978-1-4244-8956-5/11/$26.00 ©2011 IEEE

Page 2: [IEEE 2011 15th IEEE International Conference on Intelligent Engineering Systems (INES) - Poprad, Slovakia (2011.06.23-2011.06.25)] 2011 15th IEEE International Conference on Intelligent

Fig. 1. Positioning problem

of center of mass and the orientation of the object at alltimes. An articulated figure consists of a set of rigid segmentsconnected with joints. Varying angles of the joints yieldsan indefinite number of configurations. The solution to thedifficult inverse kinematics problem is to find the joint anglesgiven the desired configuration of the figure (i.e., end effectoror pen). In the general case there is no analytic solution forthe inverse kinematics problem. However, inverse kinematicsmay be solved via nonlinear programming techniques. Certainspecial kinematic chains - those with a spherical wrist - permitkinematic decoupling. This treats the end effector’s orientationand position independently and permits an efficient closed-form solution. In our Lego NXT robot, there are three joints,and one horizontal rotation axis. These we can move with thenxt and positioning the end effector to the desired position.

We introduce equations that enable us to calculate the jointangles

(𝜃1, 𝜃2) from the position of the end effector (x, y ) . (x, y) has a geometric relation with (𝜃1, 𝜃2) as follows:

𝑥 = 𝑙1𝑐𝑜𝑠𝜃1 + 𝑙2𝑐𝑜𝑠(𝜃1 + 𝜃2)𝑦 = 𝑙1𝑠𝑖𝑛𝜃1 + 𝑙2𝑠𝑖𝑛(𝜃1 + 𝜃2)

The three degrees of links make these equations [3]:𝜃1 = 𝑎𝑡𝑎𝑛2(𝑦, 𝑥)−𝑎𝑡𝑎𝑛2(

√4𝑙21(𝑥

2 + 𝑦2)− (𝑥2 + 𝑦2 + 𝑙21 − 𝑙22)2, 𝑥2 + 𝑦2 − 𝑙21 − 𝑙22)

𝜃2 = 𝑎𝑡𝑎𝑛2(√

4𝑙21𝑙22 − (𝑥2 + 𝑦2 − 𝑙21 − 𝑙22)

2, 𝑥2 + 𝑦2 − 𝑙21 − 𝑙22)

𝜃3 = 360𝑜 − 90𝑜 − 𝜃1 − 𝜃2

Fig. 2. End effector

(the third joint must be oriented perpendicular to X axis).These equations only describe the motion of the end effectorin 2D.

Expanding these equations in the 3D coordinate systemmust add a horizontal movement:

Calculate real length between the axis and the end effector.𝑋 =

√𝑥2 + 𝑧2, 𝜂 = 𝑎𝑡𝑎𝑛2(𝑧,𝑋) : calculate the real X point.

The inverse kinematics equations are illustrated in Figure 2.

III. DESIGN OF THE ROBOT HARDWARE

In this section we give an overview about the design issues(software and hardware) related to the robotic arm.

A. Hardware design of the robotic arm

Robot arms, grippers and end-effectors (devices that attach tothe end of an arm such as electromagnets, etc.) are the best waysfor a robot to interact with the environment it is exploring. Simplerobot arms can have just one motion, while more complex arms canhave a dozen or more unique degrees of freedom [4]. Using theLego Mindstorms robot kit is one of the best and easiest way tobuild robotics hardware. It is packed with the latest technologies,includes servo motors, microcontrolled computational power, andremote controllers. The most important advantages of using LegoMindstorms lego elements provides a simple way to rebuild thearchitecture in the development phase, anytime. We have built ourrobot arm using LEGO-NXT. Two LEGO-NXT bricks are used tohandle the motors and connect to PC over bluetooth and USB cable.Four servo motors work together to position the endpoint of therobotic arm. Because we must have four motors, we must use twolego bricks, and synchronize them. Six batteries can provide theenergy for each NXT Brick, but if using batteries, they dischargein a few minutes. For this reason, we developed a better solutionto continuously keep the power on the maximum. Batteries werereplaced with a DC power supply.

The operating system that runs on the NXT brick is of highimportance, because some special services are required during imple-mentation. Besides the default NXT firmware we investigated manyunofficial Lego NXT Brick Firmwares. We chose LejOS because ofit’s advantages, mainly because it supports floating point values andoperations, and motor positioning is more accurate than that of itscounterparts. We used a programming library called NXT.Net forcontrolling NXT Bricks so we decided to create a PC side softwarein .Net Framework.

Á. Hámori et al. • 3DOF Drawing Robot Using LEGO-NXT

– 294 –

Page 3: [IEEE 2011 15th IEEE International Conference on Intelligent Engineering Systems (INES) - Poprad, Slovakia (2011.06.23-2011.06.25)] 2011 15th IEEE International Conference on Intelligent

Fig. 3. The robot arm ready for operation.

B. Software design

The program that we created to control the robot arm using inversekinematics includes the NXT.Net library (NxtNet.DesktopLib.dll), theInverseKinematics library (IKLib.dll) and the host program (nxt.exe).NXT.NET is a .NET library written in C# 3.0 that enables hostapplications to control the LEGO Mindstorms NXT from managedcode via Bluetooth connection. NXT.NET contains a desktop anda mobile library and sample desktop Windows Forms and WindowsMobile Pocket PC applications. It is created by the Hungarian MSDNCompetence Center. NXT.NET contains the following components:

∙ NxtNet.DesktopLib and NxtNet.MobileLib are two class li-braries with the same feature set compiled as a desktop and asa mobile component. The library enables the host applicationto control a LEGO Mindstorms NXT robot via a Bluetoothconnection.

∙ NxtNet.DesktopApp is a .NET Windows Forms desktop appli-cation that is built using the NxtNet.DesktopLib component andenables the user to test the library features and remotely controla LEGO Mindstorms NXT robot from a PC.

∙ NxtNet.MobileApp is a .NET Compact Framework mobileapplication that is built using the NxtNet.MobileLib componentand enables the user to test the library features and remotelycontrol a LEGO Mindstorms NXT robot from a WindowsMobile 5.0 Pocket PC.

NXT.Net library (NxtNet.DesktopLib.dll) enables the host to con-nect to the NXT, query general parameters (brick name, version,Bluetooth address, free flash memory, battery level, keep alive time),initialize sensors and query sensor values. The program module ofcontrolling the robot arm (IKLib.dll) uses trigonometric functionswhich computes the 𝛼, 𝛽, 𝛾 and 𝜂 degrees from the specified (𝑥, 𝑦, 𝑧)coordinates for the motors. 𝛼, 𝛽 and 𝜂 degrees are used for verticaland horizontal movement, while 𝛾 is used for positioning the end-effector.

We built our own three degree of freedom robot arm that usesour software developed for inverse kinematics, so it can position theend-effector, which is in turn can be used for drawing purposes.

IV. RESULTS

After the thorough design of the robot hardware, we obtained astructure that was statically and dynamically stable. On Figure 3the robot is in default position, holding the arm straight, withoutcollapsing. The joints were stable enough to draw a straight line, andthey had enough torque to push the pencil to the paper so that theline is well visible, as shown in Figure 4. This achievement using theimprecise building blocks of Lego can be considered outstanding.

Fig. 4. The robot arm is drawing a rectangle.

V. CONCLUSION

Special gear compositions were developed to make the rotationprecise while keeping high torques. A wormgear was found to be thebest solution for satisfying those requirements.

The use of the LejOS firmware instead of the default operatingsystem of the NXT was a good choice, since it allowed to convertthe motor degrees to more precise tacho values.

We used NXT.Net to solve the problem to connect multiple Bricksto one PC at the same time.

Using Lego NXT to build our robot arm had many advantages:easy hardware and software development, hardware variability, Blue-tooth support, highly accurate motor control. Working on this projectwe have gained experience in robotics, including hardware andsoftware, and we developed a robot platform that can be used ineducation for teaching robotics related subjects.

REFERENCES

[1] M. Tokic, W. Ertel, and J. Fessler, “The crawler, a class room demon-strator for reinforcement learning,” 2009.

[2] O. L. website, “About lego nxt,” On the web, 2010.[3] Y. Yamamoto, “Nxt scara model-based design - control of two link planar

robot arm built with lego mindstorms nxt,” http://www.mathworks.de/,2009.

[4] J. A. B. Moral, “Develop lejos programs step by step,”www.juanantonio.info, 2009.

– 295 –

INES 2011 • 15th International Conference on Intelligent Engineering Systems • June 23–25, 2011, Poprad, Slovakia