http://sites.google.com/site/strykerspi ... ects=0&d=1
here is my line-following segway program. (Yes, it's a safe link.)
It should be self explanatory (if you open it in the NXT 1.0 NXT-G environment), but here's the basics:
Same old same old, put a light sensor on the front and use it for balancing. But there's a difference here: put
two on the front, side-by-side, and you can line-follow.
I haven't worked on my algorithm at all, it's just a P (Not even a PI, much less PID) algorithm. Thus, it will probably be in need of some modification.
Inputs/Outputs:
2 Light Sensors (I don't remember what ports)
1 UltraSonic Sensor (Again, don't remember what port)
3 Motors (Ports A, B, and C)
Motors B and C are the wheels of the segway, Motor A is attached to the NXT brick, which is standing up. (Think like
this, but instead of the rider standing up over the NXT, the rider
is the NXT.)
To move forward, Motor A leans the NXT forward, and to move backward, the opposite.
I think that's all there is to it. I haven't done anything or the physical robot part yet, but I'm sure it can be done.
- Stryker
P.S. Oh, and the US Sensor is on the top, pointing forwards; the program automatically starts the segway driving forwards (it
is a line follower after all) and leans the rider back if it gets within like 10 cm of an obstacle or something. (I haven't looked @ the program in a while, and it takes forever for NXT-G to boot up on my computer, so I don't feel like doing it right now. Sorry if some things aren't quite right.)