View unanswered posts | View active topics It is currently Mon Sep 22, 2014 8:14 am






Reply to topic  [ 2 posts ] 
NXT - Simple X-Y Router coding 
Author Message
Rookie

Joined: Tue Sep 23, 2008 6:17 pm
Posts: 1
Post NXT - Simple X-Y Router coding
Well, as you can see this is my first post here, so hello to all!

I've been kicking around the idea of building a simple NXT router for a while now, and now that I've learned a bit about robotC the project seems much more feasible. I have a good basic working knowledge of robotC and C in general, but some aspects of this particular project are a little beyond me. I do, however, have a good idea of how the program _should_ work. Here are my goals for the finished machine:

- X and Y movement only (no Z-axis)
- Minimal program size (no sensors, manual calibration, etc)
- Flexible (tool path data to be read from text file - simplified g-code)
- Machine will cut straight lines only, no curves

As I mentioned, this program would read raw coordinate data from a text file, in a simplified g-code format. here's an example:

Code:
G1 X6.6843 Y6.3204
G1 X6.5651 Y15.9977
G1 X11.2923 Y16.0145
G1 X13.1744 Y11.9885
G1 X14.4775 Y11.0899


"G1" indicates the transit speed, and then there are the obvious x and y. The idea is, that once I build the machine itself, I'd need to find out how many actual motor rotations it would take to move the tool 1", which would then be stored as a variable, something like Xratio Yratio. Using the ratios, the program would be able to translate the file data to mechanical output. As far as writing the code goes, there are two things I haven't figured out how to do:

1. Read lines (individual values?) from a separate file, in order (ex. x1y1 - NEXT - x2y2 - NEXT - etc)
2. Keep the X and Y axis drive motors synched up to reach the destination point at the same time, or in other words linear point-to-point transitions. The best way to do this that I can think of is using the motor encoder sync function with a modifier ratio based on x2-x1/y2-y1.

I welcome any insight anyone can offer. I figured this project would be right up someone's alley! I plan to use the machine (target size is 10" x 10") to cut parts for micro indoor RC planes from light and/or soft foam.


Tue Sep 23, 2008 7:06 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: NXT - Simple X-Y Router coding
THis is very feasible.

If you're using LEGO NXT motors and gears, I'd suggest gearing down the motors to get higher resolution. Say five to one would get you 1800 counts per revolution. You might want to use the "corkscrew" gear to minimize "slop" on the gearing.

With ROBOTC you can easily transfer text file from PC to NXT.

You'll have to write your own parset for the text file. This shouldn't be too hard. Look at the example code for GPS -- it should be somewhere in the samples folder -- because it contains a parser for the ASCII text string read from GPS and I recall it parsed numbers with decimal fractions. THe parser shouldn't be too complicated. Read a character at a time and act on it depending on whether it is a digit, space or decimal.

If you do a web search you can probably find some previous examples of people who built plotters with Mindstorms. Your project should be very similar.

Good luck.


Sat Sep 27, 2008 2:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.