Wednesday, January 16, 2008

NXT Line Follower (via RobotC)

This time via RobotC (http://www.robotc.net)




const int thresh = 50; // light sensor thresh
const int power = 40; // motor power
const int factor = 2; // multiplicative sweep increase
const int overshoot = 20; // turn additional after line found
const int initialTurn = 8; // first sweep size

int spin_left(int deg) {
nSyncedTurnRatio = -100;
nMotorEncoderTarget[motorA] = deg;
motor[motorA] = power;
}

int spin_right(int deg) {
nSyncedTurnRatio = -100;
nMotorEncoderTarget[motorA] = -deg;
motor[motorA] = -power;
}

int straight() {
nSyncedTurnRatio = +100;
motor[motorA] = power;
}

void stop() {
motor[motorA] = 0;
}

bool online() {
return SensorValue(lightSensor) < thresh;
}

void resetMotorEncoder() {
nMotorEncoder[motorA] = 0;
}

bool stateIdle() {
return nMotorRunState[motorA] == runStateIdle;
}

task main()
{
bFloatDuringInactiveMotorPWM = false;
nSyncedMotors = synchAB;

int lastDir = 0;
while (true) {

while ( online() ) { straight(); }
stop();

resetMotorEncoder();
int turn = initialTurn;
for ( int i = lastDir; !online(); i++ ) {
lastDir = i%2;
for ( int j = turn; j && !online() ; j-- ) {
if ( lastDir ) { spin_left(1); }
else { spin_right(1); }
}
turn *= factor;
}

if ( lastDir ) { spin_left(overshoot); }
else { spin_right(overshoot); }
while ( !stateIdle() ) { wait1Msec(1); }

}
}

Tuesday, January 15, 2008

transcoding for IPod Touch


$ ffmpeg.exe -y -i INPUT -f mp4 -vcodec libx264 -level 21 -s 480x266 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -threads auto -acodec libfaac -ac 2 -ab 128k OUTPUT


I think I used higher audio bitrate. Had to back it off to transcode video off my Olympus camera.

Monday, January 14, 2008

NXT Line Follower

Programmed with the NXT-G (LabView).

Cribbed from http://www.bnxt.com/paper/line_follower

NXT Marble Lift

Trying to figure out the Mindstorms / NXT. Simple robot to save Daniella and I from having to manually move the marbles to the top of the marble run set.

Friday, January 19, 2007

Sea horses and sea dragons

Tonight seahorses came up while we were playing with play dough. Some google videos of said, and something I had never heard of: sea dragon.



Sea Dragons

Thursday, January 18, 2007

Cheetahs

Dani has a set of plastic jungle animals and I was telling her about the cheetah being the fastest animal in the world.