aspose file tools*
The moose likes Beginning Java and the fly likes lejos, java, and legos Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "lejos, java, and legos" Watch "lejos, java, and legos" New topic
Author

lejos, java, and legos

Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
I have a legos rcx brick and a few motors/sensors, I have heard of people reprograming thier rcx with java called "lejos." Does anybody know anything about this or has anybody done it themselves and would like to offer me some advice about it? It sounds really cool to me and I would like to try it, but I don't know how or where to get started. Any help or comments would be greatly appriciated. Thanks in advance- Dan


-Dan
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

How about the lejos website? I use the Lego firmware and Bricx Command Center myself.


[How To Ask Questions On JavaRanch]
Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
thanks Joe , just curious, what have you done with your legos, anything cool?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Lots of cool stuff. Two robots that play tag. All manner of line following robots. A robot that chases a flashlight. Right now I'm working on a reactive target range, a "Hogan's Alley". I made a target stand that pops a target up and when the target gets hit, it falls down. I want to make a couple of them (I have 2 RCX's), control them with a laptop via the IR tower and keep score.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I just took a "Robot Building Lab" at grad school and we played with Handyboard robots (programmed in Interactive C or RoboJDE(Java), as well as the RCX robots with Lejos.

Check out the course website: http://plan.cs.drexel.edu/courses/robotlab/ it may give you some ideas to code.

Here's a quick summary of each lab:
lab 2:
part A: build a differential drive robot, and demonstrate the motion capabilities of the robot (go forward, left, right, reverse, etc)
part B: use a reflection sensor to determine when you're on top of a piece of paper and when you're not. Write a program that goes forward until it finds a definite change in color (going from paper to carpet and vice versa) and stop.

lab 3:
Add two light sensors to the robot:
If there's more light on the left, it should go left.
If there's more light on the right, it should go right.
If there's more light in the center, it shoudl go straight.
If it can't find a light -- it should wander aimlessly til it finds one.
(My cat was a big fan of this lab -- she loves attacking flashlights)

lab 4:
Add bumpers to the robot
The robot should follow the light but if it bumps into an object it should avoid it, then resume following the light. If it runs over a piece of paper it should avoid it, then resume following the light.

lab 6a:
Add kinematics to the robot (this is built into lejos api)
write a program that constantly spits out the robot's position (x, y, theta) while it wanders around and avoids obstacles.

lab 6b:
Add inverse kinematics to the robot
write a program so that a robot will go to a particular waypoint.
i.e. it starts at 0,0 make it go to (15,30)
If it bumps into an obstacle it should avoid it then recalculate how to get to the goal waypoint.

lab 7:
Add sonar to the robot with a servo motor so it can sweep the sonar from side to side (not sure if this is a standard Mindstorm sensor)
Do the same as 6b, but detect obstacles with the sonar instead of just bumping into them.

undergraduate final:
Use the sonar to develop a map of the world the robot sees. Write a planning algorithm that will navigate around several obstacles and reach a goal poing.

graduate final:
Given a series of doors, mount the sonar on the side of the RCX. And use particle filtering to do localization.
Basically -- say there are a set of 3 doors along the wall.
After the robot sees one door, he should know that he's located after one of those 3 doors, after seeing two doors, he should know he's located after the 2nd or 3rd door. If he doesn't see any doors after that, he should know he's located after the 3rd door.

Anyway -- dunno if those give you any ideas, but it was a neat class and adding onto the labs like that helped to understand the capabilities of the robot as well as how to balance multiple behaviors.

I'm thinking of writing a JavaRanch Journal article about RoboJDE vs LeJOS... what do you think?


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Dan Maples
Ranch Hand

Joined: Jun 21, 2004
Posts: 153
wow thanks guys thats great! Jess, definantly write that journal, I think it would be great for people like me to read. Thank you both again, you've been more than helpful! -Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lejos, java, and legos