# Going to Uni

Page 1 of 1

## 7 Replies - 1581 Views - Last Post: 30 September 2008 - 06:34 AM

### #1 sms123

• D.I.C Head

Reputation: 0
• Posts: 64
• Joined: 15-August 08

# Going to Uni

Posted 13 September 2008 - 02:37 AM

hey guys, i am going to Sheffield uni on the 21st to do a Mcomp in computer science, and i have just got a pack from the department, and it says that as an introductory exercise, we will be making football playing robots out of lego, but instead of using lego's language, they use Java. there are some introductory exercises they want me to do just thought i would share them with you lol.

//note i dont need help with this btw, just showing you guys lol
Motor b controls left wheel, motor c controls right wheel
Motors can rotate up to 999 (degrees per second)
to set speed - Motor.B.setSpeed(50); //rotates wheel at 50d/s
to set direction - Motor.B.forward(); // or Motor.B.backward();

then it asks;
write statements to make the robot
1.)move slowly backwards
2.)turn gradually to the right
3.)turn gradually to the left
4.)Spin rapidly on the spot

then it goes on to say
//writing short hand, its a long para
robot has 2 distance sensors = leftDistanceSensor + rightDistanceSensor
if robot is closer to object on left, turn right visa versa
write script to achieve this

robot has touch sensor on front = touchSensor
isPressed() returns true if touching something
write script to make robot reverse if hits obstacle

ultrasonic distance sensor is not accurate (be noisy cause of electrical interference) how would you deal with this?
int distance = distanceSensor.getDistance();

i think this will be fun hahahha, but i think they will get a bit annoyed if i make my robot like the ones you see on Robot Wars lol with axes and flippers lol

Is This A Good Question/Topic? 0

## Replies To: Going to Uni

### #2 abgorn

• sudo apt-get install brain

Reputation: 31
• Posts: 1,415
• Joined: 05-June 08

## Re: Going to Uni

Posted 13 September 2008 - 02:55 AM

Lol, do you actually have to make a physical lego robot?
Was This Post Helpful? 0

### #3 sms123

• D.I.C Head

Reputation: 0
• Posts: 64
• Joined: 15-August 08

## Re: Going to Uni

Posted 13 September 2008 - 03:02 AM

abgorn, on 13 Sep, 2008 - 02:55 AM, said:

Lol, do you actually have to make a physical lego robot?

lol i guess so, i loved lego when i was a kid lol
heres what i have done, what do you think;
//btw not sure what to do about the last one, the one about interference, was thinking, using two sensors???
```Ex1
(i)
Motor.B.setSpeed(25);
Motor.C.setSpeed(25);
Motor.B.backward();
Motor.C.backward();

(ii)
Motor.B.stop();
Motor.C.setSpeed(25);
Motor.C.forward();

(iii)
Motor.C.stop();
Motor.B.setSpeed(25);
Motor.B.forward();

(iv)
Motor.B.setSpeed(999);
Motor.B.forward();
Motor.C.setSpeed(999);
Motor.C.backward();

Ex2

int leftDist;
int rightDist;
boolean tooClose = false;
do{
if((leftDist<10)||(rightDist<10)){
if((leftDist<2)&&(rightDist<2)){
Motor.B.setSpeed(25);
Motor.C.setSpeed(25);
Motor.B.backward();
Motor.C.backward();
tooClose = true;
}
if(leftDist<rightDist){
Motor.c.stop();
Motor.B.setSpeed(100);
Motor.B.forward();
}else{
Motor.c.stop();
Motor.B.setSpeed(100);
Motor.B.forward();
}
}
}while(!tooClose);

Ex3

boolean hasntHit = true;
do{
if(touchSensor.isPressed){
Motor.B.setSpeed(25);
Motor.C.setSpeed(25);
Motor.B.backward();
Motor.C.backward();
hasntHit = false;
}
}while(hasntHit);

```

Was This Post Helpful? 0

### #4 abgorn

• sudo apt-get install brain

Reputation: 31
• Posts: 1,415
• Joined: 05-June 08

## Re: Going to Uni

Posted 13 September 2008 - 03:56 AM

Your doing a good job so far, but where did you get the methods from?

This post has been edited by abgorn: 13 September 2008 - 04:06 AM

Was This Post Helpful? 0

### #5 sms123

• D.I.C Head

Reputation: 0
• Posts: 64
• Joined: 15-August 08

## Re: Going to Uni

Posted 13 September 2008 - 09:51 AM

abgorn, on 13 Sep, 2008 - 03:56 AM, said:

Your doing a good job so far, but where did you get the methods from?

oh they gave examples, lol, they just said, like if you want to know if the touch sensor was activated, use .isPressed() etc
Was This Post Helpful? 0

### #6 RedSonja

• D.I.C Head

Reputation: 10
• Posts: 172
• Joined: 04-September 08

## Re: Going to Uni

Posted 30 September 2008 - 05:25 AM

Well, I am so jealous. It was never this much fun when I was a student. There must still be lots of Lego at home from when the kids were little, maybe I could have a go...

Actually since most of what I do has to do with rockets, I wondered about getting one of those little USB desktop missile launchers.
Was This Post Helpful? 0

### #7 homemade-jam

• Gabe's Nemesis

Reputation: 11
• Posts: 1,300
• Joined: 17-March 08

## Re: Going to Uni

Posted 30 September 2008 - 06:22 AM

I'm looking forward to going to uni in less that 10 months
Was This Post Helpful? 0

### #8 William_Wilson

• lost in compilation

Reputation: 207
• Posts: 4,812
• Joined: 23-December 05

## Re: Going to Uni

Posted 30 September 2008 - 06:34 AM

I had a robotics course a while back using the BOE robot.

It is amazing what you can learn from trial and error, fault tolerances, random errors, etc. Though we used basic to code these things and the code loading app didn't have syntax highlighting, so there was a lot of copy and paste

It can be frustrating, but I'm sure you'll have fun doing it
Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }