Robot vb6 PDF
Robot vb6 PDF
Abstract: The purpose of this paper is the provision of information on how to command the robot Roomba Model 4400. Through this
paper will be shown how to command the robot using serial port commands library built for this purpose. The purpose is to show how
the Visual Basic 6.0 and Visual Basic.NET programmers, use the command library to build specific programs that control the robot
mentioned before. This library of commands and functions is intended to make easier and more comfortable commanding the robot.
1. Introduction
iRobot Create is a programmable model of the Roomba
Model 4400, used for educational and scientific purposes.
To command this robot from the PC the use of the serial port
(7 pin Mini-DIN connector) or of the 25 pin port (DB 25 pin
connector) is needed, where the Bluetooth package is
inserted (Fig 1). The built library has a large variety of
commands and functions which realize specific tasks. This
library will serve as a connecting bridge, which means it will
send the proper commands from the user to the robot. In
general the commands put the robot into motion while the
functions bring to the user specific values which are the
parameters of the robot.
‘light LEDS
SetDriveWheelsCreate 0, vMovement ‘Speed of vMovement
Key = 139: objComport.WriteByte (Key) =[0 , 500] mm/s
Key = 25: objComport.WriteByte (Key) SetDriveWheelsCreate vMovement, 0 ‘Speed of vMovement
Key = 0:objComport.WriteByte (Key) =[0 , 500] mm/s
Key = 128:objComport.WriteByte (Key)
' set song Rotation 180 degrees left and right:
Key = 140:objComport.WriteByte (Key)
Key = 1:objComport.WriteByte (Key) SetDriveWheelsCreate - vMovement, vMovement ‘Speed of
Key = 1:objComport.WriteByte (Key)
vMovement =[0 , 500] mm/s
Key = 48:objComport.WriteByte (Key)
Key = 20:objComport.WriteByte (Key):DoSleep 0.05
SetDriveWheelsCreate vMovement, - vMovement ‘Speed of
' sing it vMovement =[0 , 500] mm/s
Key = 141:objComport.WriteByte (Key)
Key = 1:objComport.WriteByte (Key) Knowing the distance between the wheels of the robot and
RoombaInit = True the linear speeds we can obtain rotations of different
Else degrees. For this we will use some simple physic formulas.
MsgBox " Unable to open the communication port .", The problem would be : what must the linear speed of the
vbInformation, App.Title wheels be , when the rotation of the robot with angle is
RoombaInit = False
requested.
End If
End Function
We use popular formulas which connect angular speed with
The function brings back the values True or False in case the linear speed, and linear speed with time:
connection is realized with the robot, or not. v 2v
The movements : forwards, backwards, left and right (with (1)
r d
linear speed chosen for each wheel) are given from :
Set DriveWheels Create Speed Wheel Left, Speed Wheel (2)
Right t
Parameters Speed Wheel Left and Speed Wheel Right chose
the speed of the left and right wheel of the robot (Fig 2). From 1 and 2 we can calculate the linear speed of the wheel
Linear speed of the robot wheels is between the values (-500 for a rotation of degrees through time t .
– 500 mm/s) [2]. 2v t
(3)
d
Where d is distance between the wheels of the robot Fig 3.
Figure 2: Wheels of the iRobot Create and their linear Figure 3: Rotation of iRobot Create
speeds
For both of the commands shown above, values vMovement To realize the command of the robot, the program built in
and vRay are numbers from 16 bit to 4 byte in total. In the Visual Basic 6.0 is composed from a form (window) shown
case speed will be -200 mm/s and the ray 500 mm, the in Fig 5 and from 12 modules, where each contains
information which will be sent is: commands, functions connecting with the communication of
[137] [255] [56] [1] [244] the robot and other helpful functions. The program is easy.
On the window of the communication port (Fig 5) it is
Command [137] puts the wheels of the robot under control chosen the number of the serial port. In case when the PC is
for ans arc movement. connected with the robot through a serial cable, in the
communication port is chosen either COM1 or COM2.
The range above is taken from the calculations that follow When the we have a wireless connection, in the
[7] : communication port we chose COM3 – COM8 (This choice
vMovement = -200 = hex FF38 = [hex FF] [hex 38] = [255] is obtained after the instalation of Bluetooth )
[56]
rRay = 500 = hex 01F4 = [hex 01] [hex F4] = [1] [244]
References
[1] Connection Guide For The Irobot Create.
Http://Portal.Seas.Columbia.Edu/Matlab/
[2] Irobot Command Module Owner’s Manual. ©2007
Irobot Corporation.
[3] Pardue, J., Virtual Serial Port Cookbook.
[4] Activecomport Serial Port Toolkit Manual Pages 1999-
2005 - Activexperts Software
[5] Axelson J, Access Serial Ports With Visual Basic.NET,
Nuts & Volts, April 2008, P60.
[6] Jan Axelson’s Web Site:
Http://Www.Lvr.Com/Serport.Htm
[7] Irobot Create Open Interface (OI) Specification And
Virtual Wall. ©2006 Irobot Corporation.