Wishful Coding

Didn't you ever wish your
computer understood you?

Saving sensors with structural limits

When building a robot with some sort of back-and-forth motion, such as a steering car or a robotic arm, you commonly see touch sensors at the end or center to easily move to that point.

However, the NXT motors have built-in rotation sensors, so with a bit more fiddling, you can get rid of most touch sensors in your system by using the structural limits of the model.

The basic idea is that you move the motor slowly forwards until it doesn’t go any further, record the tacho count, rotate backwards slowly until it stops, record the tacho count. Now you know the center point(the average of the two), and you can move to any point within the limits real quick.

In NXT-G this can very easily be done using the PID block by HiTechnic, but it does not give you the endpoints, which you can notice in the video.

In NXC there is a more powerful absolute position regulation, implemented at firmware level. Flexible, fast, precise, awesome.