Friday, December 02, 2005





Abstract

The purpose of this project was to design and implement an experimental robot, which could determine its current position in a room and can go to the desired coordinate location. The motivations for this were two-fold. The first being that robotics is an excellent synthesis of hardware & software technology. Secondly the integration of Electronics Hardware coupled with high-level object oriented programming languages like JAVA & the fusion of basic fundamentals of mechanics & automation overall provide one the finest viewer-experience of a robotic device. A possible extension to this robot can prove to be very useful in enhancing the role of automation & software into the industry & common world around us.

The targeted design goal of this project is to construct a portable, reusable & multipurpose robotic device that is capable of guiding a visually impaired person around a room and help in transfer of material from one location to another

Vagabond

The purpose of Project Vagabond is a robot that after determining its current coordinates in a room travels to the desired coordinate location. The robot meets its objective as per the following:

· Establishing its current coordinates using three light sources attached to the wall of a room and a light sensor installed on the robot.
· Calculate the inclination and distance between its current and desired location.
· Move towards the desired coordinates.
· Constantly check its general direction of approach and make the required changes in its trajectory.

The Vagabond is useful in a wide range of applications such as:

Ø To guide a visually impaired person to a particular location in a room
Ø To perform ambulatory functions on behalf of a motor disabled person.
Ø To carry miscellaneous articles for bed ridden patients.
Ø To help in transfer of materials from one work station to another




Features of Vagabond:

Þ On-line determination of its current location

Þ Uses only three light sources attached to the wall

Þ Only one light sensor sufficient to detect the light sources.

Þ Independent motors for rotary and linear motions

Þ Needs only one rotation sensor to calculate its angle of rotation and linear distance traveled.

Þ The robot can calculate the coordinates of each location and the information can be stored in a database for future use.

Þ The RCX is separate from the robot and the destination coordinates can be fed from the database via the InfraRed


Hardware Used
RCX

2 Motors
Motor A-Controlling the rotational movement of the Vagabond
Motor B- Controlling the linear movement of the robot


Light Sensor: To detect the light sources and calculate its current coordinates.
Rotation Sensor-It is used to the angle of rotation and linear distance covered by the robot.

· Differential Gear

2 Worm Gears

Slip Clutch (24 teeth)

Bevel and Crown Gears

Spur Gears

Lego Building Blocks

Step-by-Step Approach
Approach / Problem Faced and Solution

· A mechanism should enable the robot to move in a perfectly straight trajectory.

PF:Two independent motors were used to drive each wheel, but they never produced the same speed and hence the robot never moved completely straight.

Soln: Both the wheels had to be connected to a single shaft driven by a single motor.


· A rotation mechanism should enable the robot to rotate while detecting the light
sources and also to incline itself at the desired angle.

Soln: One wheel of the robot was kept stationery while the other was rotated.

PF: The friction resulted in the rotation of the other wheel thus precluding the possibility of a single axis of rotation.

PF: Another problem was that the wheels were connected to the same shaft and thus it was impossible for them to rotate in opposite directions need rotation.

Soln: The wheels had to be connected to two different shafts.

· The wheels should move in opposite direction but with the same speed.

Soln: The only possibility was to use a differential gear. The characteristic of a differential gear is that the angular speedof its main body is the average of angular speeds of the two shafts connected at its end.

PF: The robot was constantly changing its axis of rotation as the speed of the two shafts connected to the differential and the main body of the differential could not be controlled.

Soln: The main body of the differential had to be kept stationery. As a result when one shaft of the differential gear was rotated at a particular speed, the other rotated at the same speed but in opposite direction as required.


PF: The body of the differential had to kept stationery during the rotation but had to be given motion when the robot moves linearly.

Soln: A motor short-circuited port and a gear combination was used. The purpose of short-circuiting the port was to make it difficult to rotate and thus serve the function of stopping the main body of the differential gear while the robot is rotating.

PF: The mechanism didn’t completely removed the possibility of the rotationof the main body of the differential

.
Soln: A Worm gear was used that has the property which enables it to allow the transfer of power in only one direction, thus during the rotary motion, the worm gear prevented the movement of the main body of the differential gear, while during
the linear motion the worm gear itself drives the differential gear.

. The robot has to move straight with the two wheels connected to different shafts.

PF: Only one rotation sensor was available which had to measure both the rotary and linear motions of the robot.

Soln: the same motor using the same gear ratio drove the two shafts connected to the two wheels. The worm gear meshing with the main body of the differential resulted in a gear ratio of 1:24. Thus the other shaft also had to be driven by the same gear ratio (1:24)
using a second worm gear.

PF: The presence of second worm gear precludes the possibility of the rotation of the shaft during the rotation of the robot.

Soln: A slip clutch was used which allows the rotation of the shaft passing through it without its own rotation. (Once the torque exceeded 2.5-5Nm) The slip clutch was prevented from rotating due to the presence of worm gear, which in turn rotated the slip clutch having 24 teeth and thus maintaining the same gear ratio of 1:24


How It Runs
The 3 light sources are fixed on the wall at known distances and are switched on. The Vagabond is placed at any position in the room and the program is run. Vagabond rotates on its central axis, records the intensity at each count of rotation and communicates this information to the PC via the Infra Red. The PC in turn calculates the angle between the light sources, the current coordinates of the robot and prompts the user to input the destination coordinates. The PC calculates the rotational and linear counts of the rotational sensor to reach the desired coordinates, which is passed on to the robot again via the Infra Red, which. then travels the required distance.
· The light sources are fixed at known distances on the wall and switched on.

· The linear distance moved by the robot per count of rotation is measured and is
termed as Linear Count

· The Vagabond is placed at any position in the room.

· Now the Vagabond rotates on its central axis completing more than 720 degrees

· The light sensor mounted on the robot records the intensity of light at each count of the
rotation sensor.

· After completion of the rotations the recorded intensities are communicated to the PC via
the Infra Red.

· The Vagabond continues its rotation till it reaches the first light source. This is
necessary in order to align the robot according to the new X,Y coordinate
system.

· An algorithm running at the PC calculates the average values of five successive readings
staring from the third reading to reduce the chances of error.

· A sudden increase in the intensity is detected as peak and the corresponding value of the
rotation sensor is noted.

· The process is continued for the first six peaks thus obtaining two peaks for each light
source encountered once in every rotation.

· The difference of the first and fourth peak, second and fifth peak and the third and the
sixth peak is noted as each represents the number of rotations corresponding to 360
degrees.

· The averages of the differences are calculated . We divide 360 degrees by the
average of the differences to get the Least Count which represents the
degree of rotation for each count of the rotation sensor.

· The user is prompted to input the destination coordinates

· The computer aligns the new X,Y coordinate according to the current inclination of
the Vagabond and calculates the linear distances required in new X,Y coordinate
system to reach the destination.

· The number of counts of the rotation sensor required to move the desired
distances is calculated by dividing the distances by Linear Count.

· The number of counts required to move 90 degrees is also calculated by dividing it by
Least Count

· The three counts are fed back to the RCX via the Infra Red

· The robot moves the number of rotations in the X axis, rotates by 90 degrees and again
moves the required distance in Y axis








Calculation of Current Coordinates



Sin(a) /len 1 = Sin (q+a) / r

Sin(a+b) / (len 1+len 2) = Sin(a+b+q) / r

Current X coordinate = r * Cos ( q )

Current Y coordinate = r* Sin ( q )



Transformation of Axis

X1 = Current X-Coordinate ( w.r.t. Original Coordinate System),
Y1 = Current Y-Coordinate ( w.r.t. Original Coordinate System),
X2 = Destination X-Coordinate ( w.r.t. Original Coordinate System),
Y2 = Destination Y-Coordinate( w.r.t. Original Coordinate System)
X = X-Coordinate in New Coordinate System
Y = Y-Coordinate in New Coordinate System
deltay=Y2-Y1
deltax=X2-X1
ratio = (X1 / Y1)
angle = tan-1(ratio)
X = deltax * cos(angle) – deltay * sin(angle)
Y = deltax * sin(angle) + deltay * cos(angle)

Program:
The Program consists of two parts:
Part I : The software running at the PC end.

Part II: The software running at the robot end.

Part I:
import java.io.*;
import josx.rcxcomm.*;
import java.lang.*;

public class DetectPC
{
RCXPort port;// Port to send and receive data from RCX
int[] value;
int[] diff;
double[] rot;//stores the value of 3 max light sources
double alpha,beta,theta,thetad;
double mfactor;//overall mfactor
double first;//stores the value of the light source at the origin
double mfactor1;//mfactor for first light source used to send robot to origin
double y1,y2,x1,x2;
InputStreamReader stdin;//input stream from console i.e the user input
BufferedReader console;//converts the inputstream from console
to BufferReader
int move;//counts the number of count to move to reach approx the origin;
int moveToXaxis;//counts to align along X axis
int moveToYaxis;
int moveY;//number of counts to move along Y axis
int moveX;// number of counts to move along X axis

DataOutputStream out;

public DetectPC()
{
value=new int[240];
diff=new int[239];
rot=new double[6];
try
{
port=new RCXPort();
this.stdin =new InputStreamReader(System.in);
this.console =new BufferedReader(this.stdin);
}catch(IOException ie){}

}

public static void main(String[] args)
{
DetectPC pc=new DetectPC();
pc.receive();
pc.difference();
pc.detect();
pc.calculateMFactor();//calculates the multiplying factor
pc.calculateAngle();
pc.display();
pc.currentXY();
pc.targetXY();//input from the user the destination x,y coordinate
pc.sendOrigin();
pc.getTransform();//shifts origin to the current x,y coordinates & calculates
//target x,y according to the new coordinate axis
pc.getY();//calculates the count along Y axis
pc.getX();//calculates the count along X axis
pc.sendRCX();
}


private void receive()
{
DataInputStream dis;
dis=new DataInputStream(port.getInputStream());
try
{
for(int i=0;i<240;i++)>

{

value[i]=dis.readInt();

System.out.println(value[i]);

} }catch(IOException ie){} }

private void difference()

{ System.out.println("Diffences in magnitude:");

int j;

for(j=0;j<=238;j++)

{

diff[j]=value[j+1]-value[j];

} }

private void detect()

{ int count=0; int i=0; int j,num=1; int temp; boolean detect;//checks whether any difference is more than 1 or not

float sum,avg;

while((count<6)&&((i+5)<239))>

{ detect=false;

sum=0;

for(j=0;j<5;j++)>

sum+=(float)(value[i+j]);

avg=sum/5; //System.out.println("Average at "+i+" is :"+avg);

if((value[i+1]>(avg+1.5))(value[i+2]>(avg+1.5))(value[i+3]>(avg+1.5)))
{
//detect=true;
//rot[count]=i+1;
if(value[i+2]>=value[i+1])
{
rot[count]=i+2;
detect=true;
}
if((value[i+3]>=value[i+2])&&amp;amp;amp;(value[i+3]>=value[i+1]))
{
rot[count]=i+3;
detect=true;
}
if((value[i+4]>=value[i+3])&&(value[i+4]>=value[i+1])&&(value[i+4]>=value[i+2]))//(value[i+5]>value[i+3])&&(value[i+5]>=value[i+1])&&(value[i+5]>=value[i+2])&&(value[i+5]>=value[i+4]))
detect=false;
if(detect)
{
if(count!=0)
{
if((rot[count]==rot[count-1])(rot[count]==rot[count-1]+1)(rot[count]==rot[count-1]-1))//(rot[count]==rot[count-1]+2)(rot[count]==rot[count-1]-2))
--count;
}
++count;
}
}
++i;
}




}

private void display()
{
for(int i=0;i<6;i++)>

{ System.out.println("Light at:"+rot[i]); }

System.out.println("Alpha:"+alpha); System.out.println("Beta:"+beta); System.out.println("Theta:"+theta); }

private void calculateAngle() { if(((rot[1]-rot[0])*mfactor)>180)
{
alpha=(float)(rot[2]-rot[1])*mfactor;
theta=(float)(rot[1]-rot[0])*mfactor;
beta=360-alpha-theta;
first=rot[4];
mfactor1=(float)(360/(rot[4]-rot[1]));
}
else
{
if(((rot[2]-rot[1])*mfactor)>180)
{
beta=(float)(rot[1]-rot[0])*mfactor;
theta=(float)(rot[2]-rot[1])*mfactor;
alpha=360-theta-beta;
first=rot[5];
mfactor1=(float)(360/(rot[5]-rot[2]));
}
else
{
if(((rot[3]-rot[2])*mfactor)>180)
{
alpha=(float)(rot[1]-rot[0])*mfactor;
beta=(float)(rot[2]-rot[1])*mfactor;
theta=360-alpha-beta;
first=rot[3];
mfactor1=(float)(360/(rot[3]-rot[0]));
}
}
}
}

private void calculateMFactor()
{
float temp=0;
for(int i=0;i<1;i++)>

temp+=(float)(360/(rot[i+3]-rot[i]));

mfactor=temp;

System.out.println("Mfactor:"+mfactor); }

private void currentXY()

{ double len1=0,len2=0,radius; double temp,tant; double thetar; double alphar=Math.toRadians(alpha);

double betar=Math.toRadians(beta);

System.out.println(" Alpha in radians ="+alphar);

System.out.println(" Beta in radians ="+betar);

String s;

try { System.out.println("Enter length one:");

s=console.readLine();

len1=Double.parseDouble(s);

System.out.println(" length one ="+len1);

System.out.println("Enter lenght two:");

s=console.readLine();

len2=Double.parseDouble(s);

System.out.println(" length two ="+len2);

}catch(IOException ioex) { System.out.println("Input error"); System.exit(1); } temp=(Math.sin(alphar+betar)*len1)/((len1+len2)*Math.sin(alphar)); System.out.println("value of const :"+temp);

tant=(Math.sin(alphar+betar)-temp*Math.sin(alphar))/(temp*Math.cos(alphar)-Math.cos(alphar+betar));

System.out.println("The value of Tan theta: "+tant);

thetar=Math.atan(tant);

System.out.println("The value of theta in radians: "+thetar); thetad=Math.toDegrees(thetar);

System.out.println("The value of theta in degrees :"+thetad);

radius=(len1*Math.sin(thetar+alphar))/Math.sin(alphar);

System.out.println("The value of radius is :"+radius);

x1=radius*Math.cos(thetar);

y1=radius*Math.sin(thetar);

System.out.println("Current x:"+x1);

System.out.println("Current y:"+y1); } private void targetXY()// User input

function to input Target value of x,y

{

String s2;

try {

System.out.println("Enter the Target x coordinate:");

s2=console.readLine();

x2=Double.parseDouble(s2);

System.out.println(" target x coordinate ="+x2);

System.out.println("Enter the target y coordinate:");

s2=console.readLine();

y2=Double.parseDouble(s2);

System.out.println(" target y coordinate ="+y2);

console.close();

} catch(IOException ioex) { System.out.println("Input error"); System.exit(1); } }

private void getTransform()// Calculates the angle between the current and target point in Radians

{ double deltay=y2-y1; double deltax=x2-x1; double ratio=(x1/y1); System.out.println(" Ratio of ^x/^y: ="+ratio);

double angle=Math.atan(ratio);

System.out.println("angle:"+angle);

double degree=Math.toDegrees(angle);

System.out.println("Angle in degrees :"+degree);

x2=deltax*Math.cos(angle)-deltay*Math.sin(angle);

y2=deltax*Math.sin(angle)+deltay*Math.cos(angle);

System.out.println("New X coordinate:"+x2);

System.out.println("New Y coordinate:"+y2); }

private void getY()

{double deltay=y2-y1;

double countd=y2/0.383858268;//Where 19.5cm = 20counts 39cm=40 counts Long countl=new Long(Math.round(countd));//converts from double to rounded long moveY=0-countl.intValue();

if(moveY>0)
{
countd=(float)(0/mfactor);
countl=new Long(Math.round(countd));//converts from double to rounded long
moveToYaxis=countl.intValue();
System.out.println("No. of rotation to reach new Y axis:"+moveToYaxis);
}
else
{
countd=(float)(180/mfactor);
countl=new Long(Math.round(countd));//converts from double to rounded long
moveToYaxis=countl.intValue();
System.out.println("No. of rotation to reach new Y axis:"+moveToYaxis);
moveY=0-moveY;
}
System.out.println("Counts to reach target Y coordinate:"+moveY);

}

private void getX()
{
//double deltax=x2-x1;
double countd=x2/0.383858268;//Where 19.5cm = 20counts 39cm=40 counts
Long countl=new Long(Math.round(countd));//converts from double to rounded long
moveX=countl.intValue();
if((x2>=0)&&amp;amp;amp;(y2<=0)) countd=(float)(90/mfactor); else { if((x2<=0)&&amp;amp;amp;(y2>=0))
{
countd=(float)(90/mfactor);
moveX=0-moveX;
}
else
{
if((x2>=0)&&amp;amp;amp;(y2>=0))
{
countd=(float)(270/mfactor);
}
else
{
countd=(float)(270/mfactor);
moveX=0-moveX;
}
}
}

System.out.println("Counts to reach target X coordinate:"+moveX);
countl=new Long(Math.round(countd));//converts from double to rounded long
moveToXaxis=countl.intValue();
System.out.println("No. of rotation to reach new X axis:"+moveToXaxis);

}

private void sendOrigin()
{
while((first+(360/mfactor1))<240)>

first+=360/mfactor1;

System.out.println("Mfactor for Ist light source"+mfactor1);

System.out.println("First light source at:"+first);

double countd=first+(float)(360/mfactor1)-15-240;//sending it approx to the first light source

Long countl=new Long(Math.round(countd));//converts from double to rounded long move=countl.intValue();

if(move<1) move="0;">

System.out.println("No. of rotation to move for approximation i.e (move-15):"+move);

out=new DataOutputStream(port.getOutputStream());

}

private void sendRCX()

{

try

{ out.writeInt(move);

out.writeInt(moveToYaxis);

out.writeInt(moveToXaxis);

out.writeInt(moveY);

out.writeInt(moveX);

}catch(IOException ie){} } }

Part II:

import josx.platform.rcx.*;

import josx.rcxcomm.*;

import josx.robotics.*;

import java.io.*;

class Rotate

{ static int counter;// keeps an account of the number of array entries Servo servo;

public Rotate()

{ RCX.value=new int[240];

Rotate.counter=-1;

RCX.rcom=true;

Sensor.S1.setPreviousValue(0);

servo=new Servo(Sensor.S1,Motor.A);

action();

}

private void action()

{ boolean check=false;

while(check==false)

{ check=servo.rotateTo(240); } } }

class Send {

DataOutputStream out;

public Send() {

out=new DataOutputStream(RCX.port.getOutputStream());

action(); }

private void action() {

int j=0;

LCD.showNumber(1111);

while(RCX.move==false) {

//LCD.showNumber(RCX.value[i]);

try {

LCD.showNumber(j);

out.writeInt(RCX.value[j++]);

}catch(IOException ie){}

if(j==240)

RCX.move=true; } } }

class Move {

DataInputStream in;

private int angle,dist;//angle calculates the count for angle & dist for distance boolean isCountToY,isCountToX,isCountToXaxis,isCountToOrigin,isCountToYaxis;//checks whether angle or distance has been moved or not Servo servo; static int light1,light2;//light1 stores the value of previous light source & light2 second int origin,Ymove,Xmove,Xaxis,Yaxis;//takes the count for origin,count of movement on Y,x & to reach Y axis static boolean move,negative;// checks whether move function is running boolean check;

public Move() {

servo=new Servo(Sensor.S1,Motor.A);

in=new DataInputStream(RCX.port.getInputStream());

isCountToY=false;

isCountToX=false;

isCountToXaxis=false;

isCountToOrigin=false;

isCountToYaxis=false;

origin=-1; Ymove=-1; Xmove=-1; Xaxis=-1; Move.negative=false; action(); }

private void action() {

check=false; int dist=0; LCD.showNumber(5000);

Sensor.S1.setPreviousValue(0);

rcxoperation();

moveToOrigin();

try { Thread.sleep(5000); }catch(InterruptedException ie){}

reachOrigin();

Move.move=false;

try { Thread.sleep(5000); }catch(InterruptedException ie){}

operation();//once all the inputs are read from the PC begin their execution }

private void reachOrigin() {

check=false;

Move.move=true;

while(check==false) {

Move.light1=Sensor.S3.readValue(); servo.rotateTo(1);

if((Move.light2-Move.light1)>=2)
check=true;
Sensor.S1.setPreviousValue(0);
//Motor.A.backward();
}
Motor.A.stop();
}

private void rcxoperation()
{
try
{
while(!(isCountToOrigin))// the while loop scans the input stream & calls the
// appropriate function after getting all the values
{
origin=in.readInt();
if(origin>-1)
isCountToOrigin=true;
}

while(!(isCountToYaxis))// the while loop scans the input stream & calls the
// appropriate function after getting all the values
{
Yaxis=in.readInt();
if(Yaxis>-1)
isCountToYaxis=true;
}

while(!(isCountToXaxis))// the while loop scans the input stream & calls the
// appropriate function after getting all the values
{
Xaxis=in.readInt();
if(Xaxis>-1)
isCountToXaxis=true;
}

while(!(isCountToY))
{
Ymove=in.readInt();
//if(Ymove>-1)
isCountToY=true;
}

while(!(isCountToX))
{
Xmove=in.readInt();
//if(Xmove>-1)
isCountToX=true;
}

}catch(IOException ie)
{
LCD.showNumber(8888);
}
try
{
in.close();
}catch(IOException ie){}
}

private void operation()
{

try
{
Button.RUN.waitForPressAndRelease();
}catch(InterruptedException e) {}

moveToYaxis();//sets along new Y axis
moveY();// moves along new y axis;

try
{
Thread.sleep(5000);
}catch(InterruptedException ie){}

moveToXaxis();//sets along new x axis
try
{
Thread.sleep(5000);
}catch(InterruptedException ie){}

moveX();//moves along new X axis
}

private void moveToOrigin()
{
Motor.A.setPower(0);
Sensor.S1.setPreviousValue(0);
check=false;
while(check==false)
{
check=servo.rotateTo(origin);
}
}

private void moveToYaxis()
{
Motor.A.setPower(0);
Sensor.S1.setPreviousValue(0);
check=false;
while(check==false)
{
check=servo.rotateTo(Yaxis);
}
}

private void moveToXaxis()
{
Motor.A.setPower(0);
Sensor.S1.setPreviousValue(0);
check=false;
while(check==false)
{
check=servo.rotateTo(Xaxis);
}
}

private void moveY()
{
boolean check=false;
Sensor.S1.setPreviousValue(0);
Motor.C.setPower(7);
Servo servo3=new Servo(Sensor.S1,Motor.C);
if(Ymove<0) negative="true;">

while(check==false) {

check=servo3.rotateTo(Ymove); }

Move.negative=false;

}

private void moveX()

{ boolean check=false;

Sensor.S1.setPreviousValue(0);

Motor.C.setPower(7);

Servo servo3=new Servo(Sensor.S1,Motor.C);

if(Xmove<0)>

Move.negative=true;

while(check==false)

{ check=servo3.rotateTo(Xmove); } } }

public class RCX {

static boolean rcom;//keeps track whether rotation has finished before rcx sends array to computer true means still under rotation static boolean move;//value is false while robot is rotating & true when robot moves linear distance

static int value[];// an array which stores the value of light sensor static RCXPort port;

public static void main(String[] args) {

try {

RCX.port = new RCXPort(); }catch(IOException ie){}

Move.move=false;

Slistener slist=new Slistener();

Rotate r = new Rotate();

Send s = new Send();

Move m = new Move(); } }

class Slistener implements SensorListener { public Slistener() {

RCX.rcom=true;

Sensor.S1.setTypeAndMode(SensorConstants.SENSOR_TYPE_ROT,SensorConstants.SENSOR_MODE_ANGLE); Motor.A.setPower(0); Sensor.S3.setTypeAndMode(SensorConstants.SENSOR_TYPE_LIGHT,SensorConstants.SENSOR_MODE_PCT); Sensor.S3.activate(); Sensor.S1.addSensorListener(this); } public void stateChanged(Sensor aSource,int Old,int New) { if(RCX.rcom) { LCD.showNumber(Sensor.S1.readValue());

if(aSource==Sensor.S1) RCX.value[++Rotate.counter]=Sensor.S3.readValue();

if(Rotate.counter==239) RCX.rcom=false; }

else if(Move.move==true) {

Move.light2=Sensor.S3.readValue();

LCD.showNumber(Sensor.S3.readValue()); }

else { if(Move.negative==true) LCD.showNumber(1000+New);

else LCD.showNumber(New); }

//LCD.showNumber(New); }}

SAMPLE READING

Actual Location X: 90
Actual Location Y: 65
Diffences in magnitude:
Mfactor:3.076923131942749
Light at:12.0
Light at:100.0
Light at:112.0
Light at:129.0
Light at:221.0
Light at:233.0
Alpha:36.92307758331299
Beta:52.3076868057251
Theta:270.7692356109619
Alpha in radians =0.6444292737981225
Beta in radians =0.9129413588618984
Enter length one:
72
length one =72.0
Enter lenght two:
72
length two =72.0
value of const :0.8322286618682035
The value of Tan theta: 0.7669268728062841
The value of theta in radians: 0.6542465845289498
The value of theta in degrees :37.485568054357884
The value of radius is :115.44156079086733
Current x:91.60364651744949
Current y:70.2532981612798
Enter the Target x coordinate: 50
target x coordinate =50.0
Enter the target y coordinate:40
target y coordinate =40.0
Ratio of ^x/^y: =1.3039052815307817
angle:0.9165497422659469
Angle in degrees :52.51443194564212
New X coordinate:-1.3121873231462189
New Y coordinate:-51.423765105378635
Mfactor for Ist light source2.9752066135406494
First light source at:221.0
No. of rotation to move for approximation i.e (move-15):77
Counts to reach target Y coordinate:134
Counts to reach target X coordinate:-3
No. of rotation to reach X axis:29



Friday, September 30, 2005




MULTIPURPOSE ROBOTIC DEVICE

The targeted design goal of this project is to construct a multipurpose robotic device that is capable of performing the following functions:

· a software controlled Disk Launcher which can be used in the field of Defense & Sports

· Object Sorter based on different colors which can be used in Food processing & Packaging industry and many more.

This robot uses touch and light sensors, Infrared Remote Control, infrared tower control via PC, Bluetooth Control to guide & control the Robot.

The Multipurpose Robot is able to perform a number of tasks with just a change in the software program. The “Multipurpose Robot” developed & coded has forward & backward movement control of a conveyer belt, left & right control of a turntable from 0 to 180 degree & a clockwise/anticlockwise rotating motor providing its torque to 2 tyres one moving at a higher speed than the other.

Features of Multipurpose Robot:
· Efficient speed & direction control mechanisms
· Direction control via use of a Turntable to enable the robot to move from 0 to 180 degree
· Forward/Backward movement making use of conveyers to provide a medium for transfer of objects
· Touch Sensor Control for efficient response to the user command
· Light Sensor Control for efficient response to the change in wavelength of light depending on the different objects that pass through the sensor
· IR control via IR Remote
· IR control via USB IR Tower attached to PC
· Manless Control thus providing feature of Automation


Hardware Used:

RCX

3 Motors
Motor A-Controlling the clockwise/anticlockwise movement within an angular range of 180 degrees
Motor B- Controlling the movement of conveyer belt in forward/backward direction
Motor C- Controlling the clockwise/anticlockwise speed of the tyres attached at the front
Wheels

Touch Sensor-It is used to count the number of rotation the turntable has taken & accordingly is used to change the angular position

·Light Sensor- It is used to detect changes in color of the object that passes below the sensor

Turn Table

Worm Gear

Gears

Treads and hubs

Lego Building Blocks

Step-by-Step Approach
Approach / Problem Faced and Solution

The mechanism should be able to rotate to the desired angle with sufficient level of accuracy.

Soln: The entire structure was mounted on a turntable and rotated using a worm gear. The high reduction in the gear ratio provided the required accuracy.

PF: Absence of a rotation sensor which could calculate the angle of rotation

Soln: A combination of a touch sensor and a CAM was used to work as a rotation sensor.

Design of the Feeding Mechanism enabling loading of only one disc at a time.

PF: To lift only one disc at a time entailed usage of two independent motors (one to raise the disc and the other to move it)

Soln: A conveyor belt mechanism with low clearance was used, which allowed passage of only one disc at a time

Design of the Shooting Mechanism with a satisfactory Shooting range.

PF: The disc should be shot at a high speed and should have a high range.

Soln: A conveyor belt was used to move the the disc to the point from where it was shot. At the point where it is thrown, a couple of tyres were placed and rotated in opposite directions. The traveling disc on coming in contact with these wheels is shot from the robot at a very high speed

A mechanism to differentiate between the discs which enables the robot to count the number of disc while shooting and also to determine the type of disc and thus the different discs can be segregated

Soln: A light sensor was used at the top of the conveyor belt. The purpose of the light sensor was to detect the number of disc passed below it (by detecting the change in the intensity of light received.) Also different colours reflect different amount of light which can be detected by the light Sensor and thus they can be segregated on the basis of their colour

Special Features:

The following features were added in the robot to make it more flexible and to be able to fulfill its purpose better:

Variation of the Range: changing the speed of the motors controlling the rotation of the wheels can vary the distance covered by the disc. An increase in the speed leads to an increase in the range covered and correspondingly a decrease in the speed reduces the range.

PC Control: A number of parameters can be fed to the robot from the PC thus making it a more versatile machine. The parameters are:
The frequency at which the missiles are shot that is controlled by the speed of the conveyor on which the discs move.
The speed of the wheels that controls the range of the disc shot.
The direction at which the missile is shot.

Feedback from Robot to PC: the Robot provides on-line feedback to the PC, regarding the number of disc passed below the light sensor.

Sorting Mechanism: A predefined position is allotted for each different type of disc. On encountering a particular type of disc, the object sorter moves to the desired angle before shooting the disc.




Chronological Order of Events

The user is prompted to enter the following parameters on the PC:
§ Frequency at which missiles are fired
§ The speed at which the missile is fired
§ The direction and angle at which the missile is fired.

The PC opens a establishes a connection with the robot (using data streams) and sends the above information in the form of bytes to the robot.

On obtaining the frequency, speed and the desired angle the robot rotates to the specific angle (using a feedback from the touch sensor and CAM). It then adjusts the speed of the conveyor and the wheels according to the bytes received from the PC.

The light sensor is activated as soon the robot starts its motion. .The light sensor enables the robot to count the number of disc and to identify the type of disc.

The above information is sent back to the PC via another data stream.

In case of object sorter, the robot moves to the preset angle as soon it detects the particular type of disc before shooting the disc.



Communications

Communications is a key element in robotics. Sending data from the RCX to your PC, PC to RCX and from RCX to RCX is key. We are already communicating between PC and RCX every time we download a program.
Java programs use streams to communicate. Stream is a conceptual word and defining it is difficult. One definition is a stream is a connection between two independent entities used to transfer data or information. Think about sitting with another person and having a conversation. Our spoken words are a word stream. For most people, the mouth is an output device and the ear is an input device. Streams are based upon connections and have only one direction; mouths can’t hear and ears can’t speak.

Java has an extensive set of packages that deal with communications. The designers of Java generalized the idea of streams to include things that you would not expect. Virtually all communications, with the major exception of graphic user interfaces, GUI, between a program and the real world is based upon streams. Examples include surfing the web, saving a file on a hard drive, typing in the console window, and using a modem. The most basic streams are InputStream and OutputStream.

While people use word streams to communicate, computers use byte streams & data streams. A byte is the smallest primitive data type in Java. As it happens, ASCII characters, letters and numerals, are stored in single bytes. So each ASCII character is sent as one byte in a byte stream. Integers take four bytes so they get sent through the stream as four consecutive bytes. So if a program is on the receiving end of a data stream how can it tell the difference between an int, a byte, a float or whatever? Simple answer is that it can’t. A byte is a byte. What a user has to do is create a protocol.
A protocol is the rules for a conversation that the sender and receiver agree to follow. Protocols are designed to make communication easier. Think about the protocol for using a telephone. The rule of the telephone protocol is that you pick up the phone when it rings.






Applications

I. Disk Shooter-The above robot can be used as a Disk Shooter, which can be used in the field of “Shooting” in sports. It emulates the working of a disk-shooting machine, which can throw the disk in the air with different speeds & trajectories. A user can set various parameters on his PC & then send them to the robot via IR Tower which beams the instruction to the IR receiver in the RCX. According to the kind of instruction received by the RCX the various motors & sensors perform their respective task of moving the turntable, movement of the disk’s & the shooting mechanisms provided by the wheels of different speed. Industry application of this robot is in the field of Sports.

II Missile Shooter- The above robot can be used as a Missile Shooter, which can be used in the field of “Defense & Warfare” . It emulates the working of a missile-shooting machine, which can target the missile at a particular angle & then load the missile & fires it. A user setting in a control station can set the various missile coordinates & no of missiles to be launched with various other related parameters on his PC & then send them to the robot via IR Tower or IR Remote which beams the instruction to the IR receiver in the RCX. According to the kind of instruction received by the RCX the various motors & sensors perform their respective task of moving the turntable, movement of the disk’s & the shooting mechanisms provided by the tyres of different speed. Thus the same robot can now be used in warfare with a minor modification in the software. Further GPS technology can be used to provide the robot with the exact coordinates of the target.


III. Object Sorter- The multipurpose robot can be used for sorting of different items in the field of “Industrial & Mechanical Engineering” which involve joining of huge assemblies but sorting out different components & then assembling them based on the net product.” Food Processing & Packaging” extensively involves separating of various food items for example candies to be packed can be sorted out into different containers using this robot which makes use of a light sensor to detect the kind of object passing beneath it by change in the wavelength & frequency detected.


IV. Ball Spinner & Shooter-This robot can be used to train the sportsman & is extensively used in sports like “Baseball”,” Cricket” & many other sports. A slight modification in the mechanical components of the robot can produce a “Ball Spinner & Shooter Robot”.

A large number of applications are possible with this single robot thus providing it multiple dimensions of usage in different field.


Limitations


· The height of feeding mechanism of disks is high so it needs a separate person or machine to feed in the disks or missiles

· IR communication limits the usage of this robot due to its feature of Line of Sight which can cause the robot to respond late or to loose some instructions if its out of the range of the IR Tower


Future Technology Implementation

· Bluetooth Control- Currently the robot can be controlled by a mobile device, which supports HID. This feature provides the user with keyboard mapping feature.

· SMS Control-An SMS control for the robot can be easily made whereby the PC reads the SMS sent to the control phone attached to the PC. As soon as the PC reads this SMS an appropriate command based on the contents of the SMS can be sent to the Robot via IR tower.

· Remote Location Control via Internet – This feature can provide a revolutionary control to the robot whereby a user sitting in New York can send commands to a PC in India & control the Robot.



Program:

The Program consists of two parts:

Part I : The software running at the PC end.

Part II: The software running at the robot end.

Part I:

import java.io.*;
import josx.rcxcomm.*;
public class MissileSend
{
RCXPort port;// Port to send and receive data from RCX
InputStreamReader stdin;//input stream from console i.e the user input
BufferedReader console;//converts the inputstream from console to BufferReader
int[] data=new int[4];// four data bytes are sent 0 for time; 1 for direction;2 for
frequency;3 for power;
//constructor called to initialize values
public void MissileSend()
{
}

public static void main(String[] args)
{
MissileSend ms=new MissileSend();
ms.missilesend();
}

/* frequency is setting the power for setting the speed of the conveyor belt
power sets the power at which disc is shot i.e Tyres
time is setting the time for which motor is run to obtain the direction
decide sets east or west
direction is input by the user to set the direction
calculate is calculated by compiler by divinding it by 360 & taking that it takes
9 secs for 360
*/



private void missilesend()
{
/* Three functions take input from the user to set the value of
frequency(Motor.C), Power (Motor.B)
&amp;amp; Direction (Motor.A).
For Motor C & B we only get Power
For Motor A we get time & direction i.e Clockwise/ Anticlockwise
After obtaining all the inputs from the user it is send to RCX via the
rcxsend function
*/
getFrequency();
getPower();
getDirection();
rcxsend();
rcxreceive();
}

private void getFrequency()// User input function to input frequency
{
int frequency=0;
String s1;
stdin =new InputStreamReader(System.in);
console =new BufferedReader(stdin);
try
{
System.out.println("Enter the freqeuncy power");
s1 = console.readLine();
frequency = Integer.parseInt(s1);
System.out.println("Power entered ="+frequency);
data[2]=frequency;
}
catch(IOException ioex)
{
System.out.println("Input error");
System.exit(1);
}
}

private void getPower()// User input function to input power
{
int power=0;
String s2;
stdin =new InputStreamReader(System.in);
console =new BufferedReader(stdin);
try
{
System.out.println("Enter the power");
s2 = console.readLine();
power = Integer.parseInt(s2);
System.out.println("Power entered ="+power);
data[3]=power;
}
catch(IOException ioex)
{
System.out.println("Input error");
System.exit(1);
}
}

private void getDirection()// User input function for direction
{
stdin =new InputStreamReader(System.in);
console =new BufferedReader(stdin);
int time,decide;
float direction=0,calculate;
String s3,s4;
try
{
System.out.println("Enter the direction :1 for E/2 for W");
s3 = console.readLine();
decide = Integer.parseInt(s3);
System.out.println("Enter the direction angle");
s4 = console.readLine();
direction = Float.parseFloat(s4);
System.out.println("direction entered ="+direction);
calculate=(direction*18000)/360;//18 seconds for each revolution i.e
360 hence calcuates for user input angle
System.out.println("Calucalted direction="+calculate);
time=(int)calculate;//converting float calculate to integer time
System.out.println("Time send to RCX : "+time);
data[1]=decide;//direction send as 1st element
data[0]=time;//time send as second element
}
catch(IOException ioex)
{
System.out.println("Input error");
System.exit(1);
}
}

private void rcxsend()
{
try
{
port=new RCXPort();
OutputStream os=port.getOutputStream();
DataOutputStream dos=new DataOutputStream(os);
for(int idx=0;idx<=3;idx++)

{
dos.writeInt(data[idx]);// 4 integers send by compiler 1st for direction,2nd for time,3rd for
frequency,4 for power
dos.flush();
}
}catch(IOException e) { System.err.println(e);
}
}
private void rcxreceive()
{
DataInputStream dis;
dis=new DataInputStream(port.getInputStream());
try
{
while(true)
{
System.out.println("Number fired:"+dis.readInt());
}
}catch(IOException ie){}
}
}

Part II:
import josx.platform.rcx.*;
import josx.rcxcomm.*;
import java.io.*;

public class Missile implements SensorListener
{
RCXPort port;
DataInputStream in;
DataOutputStream out;
private int time=0,direction=0,frequency=0,power=0;//time for Motor.A ,direction 1/2 for E/W, frequency for Motor.C and power for Motor.B
private int number;// to count the number of missile fired private boolean detect;// to detect the presence of missile below the light sensor

public Missile()
{ /* the following code Initializes the input stream i.e from Pc TO rCX*/
try
{
port=new RCXPort();
in=new DataInputStream(port.getInputStream()); //
out=new DataOutputStream(port.getOutputStream());
}catch(IOException ie){}
}

public static void main(String[] args)
{
Missile missile=new Missile();
missile.rcxoperation();
}
private void rcxoperation()
{
int number=0;
try
{
while(true)// the while loop scans the input stream & calls the appropriate function after getting all the values
{
if(number==0)//first integer sets the time based on the angle entered
{
time=in.readInt(); number++;
}
else if(number==1)// second integer sets time and move motor A i.e set direction
{
direction=in.readInt();
number++;
}
else if(number==2)// 3rd integer set frequency
{
int frequency=in.readInt();
Motor.C.setPower(frequency);
number++;
}
else if(number==3)//4th integer sets power
{
int power=in.readInt();
Motor.B.setPower(power);
number++; operation();//once all the inputs are read from PC begin their execution
}
else if(number==4)
{
feedbackRCX();//CALLS the feedback from RCX and sends the info to computer
number=0;//resets the number to zero and again waits for command from computer
}
}
}catch(IOException ie) { LCD.showNumber(8888); }
}

private void operation()
{
direction();//sets the required direction
fire();// fires the missile by switching on the conveyor belt and the wheels
}

private void direction()
{
boolean dirnach=false;//checks whether required direction has been achieved or not
Motor.A.setPower(7);
if(!dirnach)// if required direction has not been achieved then continue till we obtain and then
move to moving motor B & C
{
if(direction==1)//if user inputs 1 then take the time calculated
{
Motor.A.forward();
}
else if(direction==2)//if user inputs 2 then add some time to time calculated as motor runs slow
in other direction
{
Motor.A.backward();
time+=1500;//time added as time uneven
}
try
{
Thread.sleep(time);//motor runs for specified time
}catch(InterruptedException e){}
Motor.A.stop(); dirnach=true;
}
}

private void fire()
{
Sensor.S2.setTypeAndMode(SensorConstants.SENSOR_TYPE_LIGHT,SensorC onstants.SENSOR_MODE_PCT);
Sensor.S2.addSensorListener(this);
Sensor.S2.activate();
Motor.B.backward();
Motor.C.forward();
try
{
Thread.sleep(10000);// assuming it takes 10 secs to fire
}
catch(InterruptedException e){}
Motor.C.stop();
Motor.B.stop();
}

private void feedbackRCX()
{
detect=false;
number=0;
out=new DataOutputStream(port.getOutputStream());
while(true)
{
Motor.B.backward();
Motor.C.forward();
}
}

public void stateChanged(Sensor aSource,int Old,int New)
{
if((New>=35)&&amp;(!detect))
{
detect=true;
number++;
LCD.showNumber(New);
try
{
out.writeInt(number);
}catch(IOException ie)
{
LCD.showNumber(8888);
}
}
else
if(New<=32)

{
LCD.showNumber(New);
detect=false;
}
}
}

Screen Shots:

Saturday, September 17, 2005



Robotic Crane

A crane is a tower or derrick equipped with cables and pulleys that is used to lift and lower materials. Cranes are commonly used in the construction industry and in manufacturing heavy equipment. A Crane is a day-to-day machine used in the construction industry to pick up drop heavy loads at specified places. The “Robotic Crane” developed & coded has forward &amp;amp;amp;amp; backward movement control, left & right control of a turntable from 0 to 180 degree & a string up/down control with load attached to a hook.

Advantages/Features of Robotic Crane:
· Efficient String Control mechanism,
· Automated control via use of Java Threads
· Direction control via use of a Turntable to enable the crane to move from 0 to 180 degree
· Forward/Backward movement making use of conveyers to provide stability to the heavy structure
· Touch Sensor Control
· IR control via IR Remote
· IR control via USB IR Tower attached to PC
· Manless Control thus providing feature of automation


Emulating the exact functioning of an actual field Crane is the aim of this robot thus serving as a prototype application before actually manufacturing a huge machine requiring a large amount of finance.

Hardware Used

RCX

4 Motors
Motor A : Controlling the forward/backward movement of left & right conveyer’s simultaneously(Two Motors were connected to this port as the number of motors were more than the number of ports available)
Motor B : Controlling the movement of turntable from 0 to 180 degree freedom
Motor C:
Controlling the up/down of the string to lift up & drop the load hung to it
Turn Table

Slip Clutch

Gears

Treads and hubs

· Lego Building Blocks

· Small piece of nylon thread

· Iron Hook

Step-by-Step Approach
Approach / Problem Faced and Solution

A Crane is subjected to tremendous pressure and thus the body of the crane has to be stable and capable of enduring great pressure


PF: The wheels were not able to provide the required stability

Soln: Threads and Hubs were used to add to the stability

The long slanting jib (or working arm),which is the portion of the crane that carries the load, of the crane should be able to turn (independently) as required

Soln: A Turntable was used driven by a separate motor. The power was transmitted by using a combination of two bevel gears.

A replica of a jib was made with a number of straight beams connected in series and parallel. This jib(which carries the load) has to be rotated gradually to different angles( depending on
the desired position) so that the load can be picked and dropped at the exact location

Soln: The angle of rotation was controlled using the RCX which could be manually controlled to get the desired angle.

The nylon thread and the hook (responsible for carrying the load) should have an independent drive (up and down)

Soln: Another motor was used to drive the assembly of the nylon thread and the hook. Again a combination of bevel gears was used.

In case of excessive pressure the Jib should be allowed to rotate to ease the pressure and prevent any damage to the setup

Soln: A slip clutch was used which allows the shaft (passing through the slip clutch)to rotate(in case when torque exceeds 2.5nm-5.0nm) without letting the slip clutch itself to rotate

Chronological Order of Events

The Crane is moved to the desired location using its to and fro motion.

The jib is rotated to the desired angle.

The nylon thread and the hook are lowered. The crane is loaded and the hook is retracted to its initial position.

The crane is taken to the point where the load has to be dropped.

Again the jib is rotated to achieve the desired angle where it has to be unloaded.

The hook is lowered and the load is unloaded.

The above procedure is repeated till required.


Program:

import josx.platform.rcx.*;
import josx.robotics.*;

class Drive implements Behavior,ButtonListener
{
private boolean drive,forward,backward; //checks whether we have to go forward
or backward
public Drive()
{
Button.VIEW.addButtonListener(this);
Button.PRGM.addButtonListener(this);
Button.RUN.addButtonListener(this);
drive=true;
forward=false;
backward=false;
}

public boolean takeControl()
{
return drive;
}

public void suppress()
{
Motor.B.stop();
forward=false;
backward=false;
}

public void action()
{
while(drive==true)
{
if(forward==true)
forward();
else
if(backward==true)
backward();
}
}

private void forward()
{
Motor.B.forward();
}

private void backward()
{
Motor.B.backward();
}

public void buttonPressed(Button b)
{
if(b==Button.RUN)
{
backward=false;
forward=true;
drive=true;
}

if(b==Button.PRGM)
{
forward=false;
backward=true;
drive=true;
}

if(b==Button.VIEW)
{
drive=false;
Crane.lrcontrol=true;
}
}

public void buttonReleased(Button b){}
}

class Direction implements Behavior,ButtonListener
{
private boolean left,right;

public Direction()
{
Button.VIEW.addButtonListener(this);
Button.PRGM.addButtonListener(this);
Button.RUN.addButtonListener(this);
Motor.C.setPower(0);
left=false;
right=false;
}

public boolean takeControl()
{
return Crane.lrcontrol;
}

public void suppress()
{
Motor.C.stop();
}

public void action()
{
while(Crane.lrcontrol==true)
{
if(left==true)
left();
if(right==true)
right();
}
}

private void left()
{
try
{
Motor.C.forward();
Thread.sleep(1500);
Motor.C.stop();
left=false;
right=false;
}catch(Exception e){}
}

private void right()
{
try
{
Motor.C.backward();
Thread.sleep(1500);
Motor.C.stop();
right=false;
left=false;
}catch(Exception e){}
}


public void buttonPressed(Button b)
{
if(b==Button.RUN)
{
Crane.lrcontrol=false;
}

if(b==Button.PRGM)
{
right=true;
}

if(b==Button.VIEW)
{
left=true;
}
}

public void buttonReleased(Button b)
{}

}

class StringControl implements Behavior,ButtonListener
{
private boolean left,right;

public Direction()
{
Button.VIEW.addButtonListener(this);
Button.PRGM.addButtonListener(this);
Button.RUN.addButtonListener(this);
Motor.C.setPower(0);
left=false;
right=false;
}

public boolean takeControl()
{
return Crane.lrcontrol;
}

public void suppress()
{
Motor.C.stop();
}
public void action()
{
while(Crane.lrcontrol==true)
{
if(left==true)
left();
if(right==true)
right();
}
}

private void left()
{
try
{
Motor.C.forward();
Thread.sleep(1500);
Motor.C.stop();
left=false;
right=false;
}catch(Exception e){}
}

private void right()
{
try
{
Motor.C.backward();
Thread.sleep(1500);
Motor.C.stop();
right=false;
left=false;
}catch(Exception e){}
}


public void buttonPressed(Button b)
{
if(b==Button.RUN)
{
Crane.lrcontrol=false;
}
if(b==Button.PRGM)
{
right=true;
}
if(b==Button.VIEW)
{
left=true;
}

}
public void buttonReleased(Button b)
{}

}
public class Crane
{
public static volatile boolean lrcontrol;//goes true to give control to turntable

public static void main(String[] args)
{
Crane.lrcontrol=false;
Behavior b1=new Drive();
Behavior b2=new Direction();
Behavior[] bArray={b1,b2};
Arbitrator arby=new Arbitrator(bArray);
arby.start();
}
}


Saturday, September 10, 2005

EXCAVATOR

An excavator, also called a 360-degree excavator or digger, sometimes abbreviated simply to a 360, is an engineering vehicle consisting of a backhoe(a piece of excavating equipment consisting of a digging bucket on the end of an articulated arm (also called a stick or dipper) ) and cab mounted on a pivot atop an undercarriage with tracks or wheels.

Excavators are used in many roles:
Digging of trenches, holes,
foundations
Demolition
General grading/landscaping
Heavy lift, e.g. lifting and placing of pipes
River dredging


Advantages/Features of Excavator Robot:
· Multi stage & variable depth digging
· Depth variation via software control
· Direction control similar to a Battle Tank
· Forward/Backward movement making use of conveyers to provide stability to the heavy structure
· IR control via IR Remote
· IR control via USB IR Tower attached to PC
· Automated Control via program stored in the RCX RAM thereby providing man less control of the entire operation process


The objective of this experiment is to make a prototype of an unmanned excavator, programmed to automatically increase its depth of digging in the subsequent steps. The excavator is made to move to and fro with gradual increase in the depth of backhoe and thus it is able to disinter with continuous increase in its depth.


Hardware Used
RCX

3 Motors
Motor A : To give motion to the left track
Motor B : To give motion to the right track
Motor C: To control the motion of
backhoe

24 tooth slip clutch (to prevent slipping of backhoe)

Worm Wheel

Gears

Treads and hubs

Lego Building Blocks



Step-by-Step Approach
Approach /
Problem Faced and Solution

· An Excavator is subjected to

tremendous pressure and thus the
body of the excavator has to
be stable and capable of
enduring great pressure
PF: The wheels were not able to provide the required stability
Soln: Threads and Hubs were used to add to the stability

· The robot should be able to
move in a to and fro motion
and should also be able to turn
as required
Soln: Independent motor drives were used for both threads( by means of gears). For the straight motion both motors are switched on while for turning one motor is switched off and the other is kept on.

· A replica of a
backhoe was made
with a number of angular beams
connected in series on a single
rotating shaft. This shaft has
to be rotated gradually to
different angles( continuously
increasing and decreasing to
varying degrees) so that the
backhoe is able to achieve a
gradual increase of depth while
digging.
Soln: An independent motor was used to drive the shaft. The angle of rotation was controlled using the RCX which was programmed to get the desired angle at the desired speed.

· To achieve the desired accuracy
of angle the shaft should not rotate
on its own due to the weight of the
backhoe. While digging
The backhoe is lowered and the
Excavator is moved backwards
and thus we have to prevent its
lifting.
Soln: For the transmission a worm wheel was used which allows transmission in one direction only and thus prevents the shaft to rotate on its own.

· In case of excessive pressure the shaft should be allowed to rotate to ease the pressure and prevent any damage to the setup
Soln: A slip clutch was used which allows the shaft to rotate without turning the worm wheel(in case when torque exceeds 2.5nm-5.0nm )

Chronological Order of Events
The Excavator is moved to the desired location with its backhoe at the highest position.

The backhoe is lowered upto a certain depth and the Excavator moves backwards with the backhoe fixed at that position and hence it disinters the earth.

Once the Excavator retracts, the backhoe is brought back to the highest position and it again moves forward.

The excavation procedure is repeated but with increasing depth in subsequent cycles.
The Excavator can be programmed as per the requirement and the incremental change in the depth can also be varied along with the final depth. The angle for the rotation of the motor depends upon the incremental depth.



Program:

import josx.platform.rcx.*;
import josx.robotics.*;

class DriveForward implements Behavior,ButtonListener
{
public DriveForward()
{
Button.RUN.addButtonListener(this);
}

public boolean takeControl()
{
return true;
}

public void suppress()
{
Motor.A.stop();
Motor.C.stop();
}

public void action()
{

if(Excavator.buttonpress==false)
{
Motor.A.forward();
Motor.C.forward();
}
}

public void buttonPressed(Button b)
{
if(b==Button.RUN)
Excavator.buttonpress=true;
}

public void buttonReleased(Button b){}
}

class DriveBackward implements Behavior,ButtonListener
{
int time;
TimingNavigator n;
public DriveBackward()
{
time=500;
n = new TimingNavigator(Motor.C, Motor.A, 5.475f, 5.47f);
Button.VIEW.addButtonListener(this);
}

public boolean takeControl()
{
return Excavator.buttonpress;
}

public void suppress()
{
Motor.A.stop();
Motor.C.stop();
}

public void action()
{
while(Excavator.buttonpress==true)
{
try{
if(time<1150)>
{ Motor.B.setPower(1); //low power during paw up
Motor.B.backward(); //bring paw down
Thread.sleep(time);
Motor.B.stop();
n.travel(-10); //fwd
Motor.B.forward(); //brings paw up
Thread.sleep(time);
Motor.B.stop(); n.travel(10); //backward
}
else
{
time=500;
Motor.B.setPower(3); //high power during paw up
Motor.B.forward(); //bring paw up
Thread.sleep(800);
Motor.B.stop();
Motor.B.backward(); //brings paw down
Thread.sleep(time);
Motor.B.stop();
}
time=time+200;
}catch(Exception e){}
}//end of while
}//end action
public void buttonPressed(Button b)
{
if(b==Button.VIEW)
Excavator.buttonpress=false;
}
public void buttonReleased(Button b){}
}
public class Excavator
{
public static boolean buttonpress;
public static void main(String[] args)
{
buttonpress=false;
Behavior b1=new DriveForward();
Behavior b2=new DriveBackward();
Behavior[] bArray={b1,b2};
Arbitrator arby=new Arbitrator(bArray);
arby.start();
}
}
Screen Shots:
















Thursday, September 08, 2005

Focus Problem in Wireless Project
We have been working on the project for quite sometime and have been able to make the modulator andde-modulator circuit. Our biggest problem is to ensurea reliable focus mechanism.We are actually using a 35Khz subcarrier for FMmodulation before modulating the laser's amplitudewith the sub-carrier modulated signal. Hence even pooror nonlinear responce on the part of detector isacceptable but it must work at a considerable speed ofatleast 50kHzWe have tried the following measures:·
Using a single photodiode: The small sensitive areaof the photodiode makes it very difficult to use. Alsothe light has to be parallel to the axis of thephotodiode, failing which it doesn't reach thesensitive area at all·
Using an array of photodiodes: It solved the problemof a small sensitive area but the second problem ( oflight to be parallel) is still not addressed·
Using CCD array: Along with the problem of itsexorbitant cost, it fails to serve our purpose as itis virtually impossible to detect light falling at asingle pixel.· Using LDR (Light Dependent Resistor): Problem withLDR is its response time. Currently we are workingwith a frequency of about 20-30 KHz. The response timeof the LDR is about 35 Hz almost 1/1000th of what we need.
Using a Diffuser: The diffuser is producing anegligible scattering and doesn't serve the purpose.

Tuesday, August 09, 2005

Introduction to Free Space Optic Experiment

Well in short I am going to tell what all we have done till now.

This work was done till end of June.

Circuit
A simple circuit for transmitter and receiver circuit is more or less
two (AC) amplifier circuit which amplifies to about 1-11 or 1-21 times
depending upon the ratio of Rf and Rin (1:10 & 1:20). Op-amp 741 is used
for amplification.
The transmitter amplifies up to 11 times depending upon the preset
value of Rf, the output fed to a key-chain laser.
Similarly the receiver amplifies the signal on the photo-diode to up to
21 times to be feed to a 4ohm (probably 1W or 4W) speaker through a
470uF capacitor.
Some extra small capacitors are used in the circuit. Their main purpose
is to filter out DC component and amplify only the AC signal in
concern.
A npn-pnp BJT with shorted emitters and bases with npn's collector to
Vcc and pnp's collector to ground (or say Vee) is used in the path of
the feedback, i.e. the output of the op-amp fed to the shorted (or
common) base and from the shorted (or common) emitter, signal is passed
through Rf back to the -ve terminal of the op-amp. The exact purpose is not
known but I guess it is for current amplification.
Vcc to Vee/Gnd is about 6V.

Working
This setup worked quite nicely for up to 2-5 meters (considering the
crudeness of the circuit and the low power of the laser).

Audio was quite grainy but just distinguishable at about 10 meters
under well lit room conditions.

Currently we are working to modulate (low freq FM) the voice signal
and then send it to the laser so that the clarity increases.
We are also going to through the problem of finding suitable laser and
on the receiving side photodiode - focusing arrangement.

Tuesday, July 26, 2005

SPECIAL LEGO COMPONENTS






STANDARD LEGO BUILDING BLOCKS







Introdutction To Lego Mindstorms


The LEGO MINDSTORMS RIS KIT

The LEGO MINDSTORMS system is a complete series of products for the development of robots and automation applications in general. The central set of the LEGO robotics line is the RIS, a set of tools that offers us computing power, great ease of use, and versatility. With this kit, one can design a personal robot, build it using ready-to-use pieces, and program it with a specific programming language, and finally test it to see if it matches our expectations—and most important, to rebuild and reprogram it as per our wish. The brain of the system is the RCX microcomputer, initially developed in collaboration with the Massachusetts Institute of Technology (MIT) Media Lab; the kit also contains many other fundamental pieces, including input and output devices (sensors and motors). From this very powerful combination one can make countless completely independent. Robots provide a great way to enhance creativity and imagination and provide hours of great fun & development.



Robot Kit Components

If we were to open a brand new RIS 2.0 box and analyze the contents of the kit in detail, we would find more than 700 pieces, most of which are standard TECHNIC parts, such as Beams, Plates, Gears, Axles, Pulleys, Wheels, Cables and Connectors. Robotics development and represent the heart of the system. They are:
I. The RCX Programmable Microcomputer, Version 2.0
II. 2 Motors (9V)
III. 2 touch sensors
IV. 1 light sensor
V. A USB infrared (IR) transmitter tower
VI. A fiber-optic cable
VII. A printed Constructopedia Manual
VIII. Software on CD-ROM

The RCX can be thought of as the kernel of the entire set. It can read external events through sensors and control movements through motors; and it can be easily programmed with the RCX Code, which is a specific programming language provided on the software CD. The kit contains both Input devices; active (light) and passive (touch) sensors, and output devices (the two motors). These components are fundamental to robotics, as they provide a way for them to interact with the world.

Touch and light sensors can give us robot information on its movements, positioning, and general behavior. Motors are the starting point for every movement and activity; they can control gears, wheels, axles and other moving parts. The black and gray tower find in the set is the component through which LEGO robots communicate with the PC. It is in fact an infrared (IR) transmitter that sends code and information from the computer to the programmable unit. Also, the fiber-optic cable has a very specific function: if connected to the IR tower it allows us to program the Micro Scout (the smallest member of the MINDSTORMS family) through a communication protocol called Visible Light Link (VLL).






Figure 1.1 RCX







RCX: The Robot’s Brain

The Robotics Command Explorer (RCX) is the brain of any MINDSTORMS robot. It is often called the “Programmable Brick” or “Smart Brick” because it resembles a standard LEGO piece in many of its characteristics, though a great power hides within it. The RCX is actually a small computer based on the Hitachi H8 Series Microprocessor and fully equipped with memory, timers and input and output devices. When a user writes program on his personal computer, the program is download it to the RCX via infrared tower and executed on the RCX, the result is a completely self-sufficient entity that can behave autonomously, which is the difference between a true “Intelligent” robot and an automated machine.

It is a Hitachi H8/300-based microcomputer system that features:
I. 32 Kilobytes of onboard memory.
II. Three 12-volt output ports for controlling electric drive motors.
III. Three input ports for reading a variety of digital sensors (touch, rotation, light, and temperature).
IV. An infrared port for communication with personal computers and other RCXs.

Figure 1.1 & 1.2 shows the RCX & various component connections with the RCX.




Figure1.2 RCX Connections

The Logical Structure
Imagine a structure made of multiple layers (see Figure 1.3). At the very bottom there is the processor, which is a Hitachi H8300 series. This processor executes the machine code instructions. Additional components have the task of converting input signals from the three sensor ports into digital data. The next layer in the system is the ROM code. A new RCX comes with a set of instructions that provides all the basic functionalities to the unit, like port control, display and IR communications. If you’re familiar with its architecture, you can compare the ROM to the BIOS of a personal computer that boots and communicates with its peripherals.


Figure 1.3 Logical Structures

Just above the ROM code in the schematic structure is the firmware. This is a sort of operating system for our RCX unit, providing functionality to the entire system. The word “firmware” identifies a particular kind of software that is usually not alterable by the final user, though in this case there’s an important exception, as we will see. The firmware’s duty is to interpret the byte code and convert it into machine code instructions, calling the ROM code routines to perform standard system operations. It is stored in the RAM, meaning that it is downloaded at your first installation of the MINDSTORMS system; yet it needs to be downloaded again through the IR tower every time user power down the RCX for more than a few seconds, namely by removing the batteries.
On top of the firmware there is user code and the stored data. The software on the PC converts the RCX Code into a format that is more compact and readable by the RCX processor (that is, bytecode). The RAM is logically divided into different sections: 16 Kb for the firmware, 6 Kb for storing user grams, and the rest used for interpreting the byte code and handling data for the program’s execution. Even if they are all in the same physical area, following o layer-based logical structure, we can consider the programs to be in a higher
Note that when turning the RCX off, the RAM remains connected the power supply so that it can retain its contents (both the firmware and the program data), so it will slowly consume the batteries even when switched To avoid this, user can remove the batteries if he plans not to use the unit for a long time, but remember that he will have to redownload the firmware (and a program you had already stored in RAM) before attempting to use it again.

Summarization of the process in a top-to- bottom scheme:
Using RCX Code (or other software), user writes a program on a PC
User program’s instructions are transformed into low-level instructions (byte codes)
User downloads the program (in byte code form) to the RCX’s RAM using the IR transmitter tower
The firmware interprets the byte code and converts it into machine code instructions using ROM routines
The processor executes the machine code