Friday, June 5, 2009

Robot Competition (day two)

We got to see other people's wheelchair's and defenders today. While all seemed to mostly work, some were more impressive than others. Specifically the only group that decided to brave the ramp did as good a job as possible with the not-so-accurate light sensors. The main reason I mention them is because our defender was able to stop them on the ramp with the reaching arm. Of course, the defender required a bit of modifying (wheel counter-balances removed and used as stilts, and the tread removed), but it worked in stopping them.

All in all our robots were successful. The code posted below is not the final code, as we made a few tweaks to the navigating code and the steering check code, but it shows the direction that we were going. The final code is stuck on the engineering computer which we were unable to get to. The code posted below also did not parse well since blogger uses HTML code to enter the posts, so some of it got parsed. Most of it is there though.

It was sad to see our robot go, but we'll have a video up of it navigating the course soon enough.

Here's to a great year in Engineering 100.

(P.S. We'd like to give a special thanks to Snapple!)

Wednesday, June 3, 2009

Robot Competition

Well we completed the competition today. Our robot navigated the course with ease until it reached the defenders which snagged our robot both times. Overall I'd call it a success though since I didn't see any other group get past the defenders. The program worked exactly like it was supposed to, and was even off a little bit from where it should have been but still managed to navigate the course. This shows the robustness of the robot.

The steering calibration worked perfectly and there were no problems with getting stuck (steering or wheels).

We also got to test our car which, as I would've imagined (because the program was so simple), worked fine and didn't stop on the crosswalk. We didn't have a chance to test our defender because everyone kept needing to replace their batteries so we ran out of time, but we'll do that tomorrow.

Monday, June 1, 2009

Robot programs

Here is the wheelchair program, complete with steering check...
It goes with this robot

Wheelchair Robot Program, controls above pictured robot     Copyright (C) 2009  Jordan Lange      This program is free software: you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation, either version 3 of the License, or     (at your option) any later version.      This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.      You should have received a copy of the GNU General Public License     along with this program.  If not, see 
#define engine_main OUT_A;
#define engine_steer OUT_B;
#define sensor_left SENSOR_1;
#define sensor_right SENSOR_3;
#define sensor_steering SENSOR_2;

int turning = 0;

task main() {
SetSensor(SENSOR_1, SENSOR_TOUCH);
SetSensor(SENSOR_2, SENSOR_TOUCH);
SetSensor(SENSOR_3, SENSOR_TOUCH);
SetSensorMode(SENSOR_1, SENSOR_MODE_RAW);
SetSensorMode(SENSOR_2, SENSOR_MODE_RAW);
SetSensorMode(SENSOR_3, SENSOR_MODE_RAW);
SetPower(OUT_A, 99); // Main power at max
SetPower(OUT_C, 99); // Main power at max
SetPower(OUT_B, 3); // Steering power at 3

OnFwd(OUT_A); // Turn on engines
OnFwd(OUT_C);
// Check for bumping into the walls...
start steering_check;
// Navigate the course
start navigate_course;
}

task steering_check() {
while (true) {
if (turning != 1) {
// Make sure the steering is straight
if (SENSOR_2 > 45) {
// Turn power off while correcting the steering
int x = OutputStatus(0);
int y = OutputStatus(2);
if (x > 0) {
Off(OUT_A);
Off(OUT_C);
}
// Steering is off, set it all the way to the left
SetPower(OUT_B, 7);
OnRev(OUT_B);
Wait(20);
Off(OUT_B);
SetPower(OUT_B, 3);
// Bring the steering back to center
int timeout = Timer(0);
int timeoutCounter = 0;
int power = 3;
while (true) {
if (Timer(0) > timeout + 30) {
// Try again...
// set steering all the way to the left again
SetPower(OUT_B, 7);
OnRev(OUT_B);
Wait(20);
Off(OUT_B);
if (timeoutCounter > 4) {
// Failsafe, wheels are STUCK
power++;
}
SetPower(OUT_B, power);
// Reset timeout
timeout = Timer(0);
timeoutCounter++;
}
if (SENSOR_2 <>
break;
OnFwd(OUT_B);
Wait(1);
Off(OUT_B);
}
// Turn the power back on
if (x > 0) {
OnFwd(OUT_A);
OnFwd(OUT_C);
}
// Steering is aligned, yay!
repeat (5) { PlaySound(SOUND_CLICK); }
}
}
}
}

task navigate_course() {
OnFwd(OUT_A);
OnFwd(OUT_C);
Wait(1150);
Off(OUT_A);
Off(OUT_C);
repeat(10) {
SendMessage(1);
}
ClearMessage();
until (Message() == 2);
OnFwd(OUT_A);
OnFwd(OUT_C);
// start banking to the right a little bit so it hits the walls
turning = 1;
turn(5);
Wait(500);
turn(-4);
until (SENSOR_1 <= 150 && SENSOR_3 <= 150);
// Hit the far wall, reverse and then turn left
OnRev(OUT_A);
OnRev(OUT_C);
Wait(700);
OnFwd(OUT_A);
OnFwd(OUT_C);
// hard left to cross stairs
turn(-12);
Wait(720);
turn(8); // straighten steering up a bit
Wait(100);
turning = 0;
// The first wall it hits, turn to the left
// Should be in a position where that's useful
until (SENSOR_1 <= 150 || SENSOR_3 <= 150);
reverse_turn(13, 180);
repeat (5) { PlaySound(SOUND_CLICK); }
// Defender mode (default mode)
while (true) {
if (SENSOR_1 <= 200) {
reverse_turn(-13, 180);
}
if (SENSOR_3 <= 200) {
reverse_turn(13, 180);
}
}
}

void turn(int time) {
if (time <>
OnFwd(OUT_B);
Wait(-1 * time);
Off(OUT_B);
} else if (time > 0) {
OnRev(OUT_B);
Wait(time);
Off(OUT_B);
}
}
void reverse_turn(int time, int back_delay) {
turning = 1;
if (time <>
OnRev(OUT_A);
OnRev(OUT_C);
OnFwd(OUT_B);
Wait(-1 * time);
Off(OUT_B);
Wait(back_delay);
Off(OUT_A);
Off(OUT_C);
} else if (time > 0) {
OnRev(OUT_A);
OnRev(OUT_C);
OnRev(OUT_B);
Wait(time);
Off(OUT_B);
Wait(back_delay);
Off(OUT_A);
Off(OUT_C);
}
OnFwd(OUT_A);
OnFwd(OUT_C);
turning = 0; // Let the steering check take care of setting the steering back to straight
}

Next up is the Car program...
It is this robot, but the extending arm will be removed and the brick turned to the side to allow the wheelchair coming over the ramp to communicate with it
Car Robot Program, controls above pictured robot     Copyright (C) 2009  Jordan Lange      This program is free software: you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation, either version 3 of the License, or     (at your option) any later version.      This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.      You should have received a copy of the GNU General Public License     along with this program.  If not, see 
task main() {
SetPower(OUT_A, 7);
SetSensor(SENSOR_3, SENSOR_LIGHT);
ClearMessage();
while (Message() != 1) {
OnFwd(OUT_A);
Wait(500);
OnRev(OUT_A);
Wait(500);
}
if (SENSOR_3 <= 38) {
Toggle(OUT_A);
until (SENSOR_3 >= 45);
Wait(200);
Off(OUT_A);
}
Off(OUT_A);
}

And last is our defender program...

Defender Robot Program, controls car robot pictured above, but with a different purpose     Copyright (C) 2009  Jordan Lange      This program is free software: you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation, either version 3 of the License, or     (at your option) any later version.      This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.      You should have received a copy of the GNU General Public License     along with this program.  If not, see 
task main() {
SetPower(OUT_A, 7);
OnRev(OUT_A);
Wait(500);
Off(OUT_A);
SetPower(OUT_C, 5);
OnFwd(OUT_C);
Wait(200);
Off(OUT_C);
}

This program extends this arm (not Chun's arm):


Tuesday, May 26, 2009

Main Robot - Day 3 1/2

We worked on getting the steering system to stop at center using a touch sensor. The steering now stops at the center. We also added supports to the RCX brick so that it stays on better. Now that the final design is mainly done, we can start programming for the track.

(Touch sensor design)

(Brick supports)

Wednesday, May 20, 2009

Main Robot - Day 2

We adjusted the rear drive train a lot today. We first tried the TORSEN differential, but there was too much torque on the differential when the locking system (the part that makes both wheels spin equally when one has been spinning faster than the other) engaged, and the differential started flying apart. So we (Paul) built a limited slip differential that doesn't have quite as much torque on it when the locking mechanism engages. It works perfectly, but the drivetrain is geared down a lot so it doesn't move very quickly, but it seems pretty strong. It doesn't make its way up the stairs yet, but a bit of tweaking will change that.

Aside from that, we built a front bumper system that has two independent sensors that trigger when something bumps into either side of the car. It's programmed to reverse and change direction when it hits something then move forward agan in an attempt to avoid the obstace. It's pretty crude, but seems to work.
(TORSEN differential w/ "motor box" powering it)

(Limited slip differential)

(Limited slip w/ "motor box" attached)

(Car now)

(Another shot of the car now)

The bumper system is up front.

Monday, May 18, 2009

Main Robot - Day 1


Today we started building the robot that would navigate the final course. It consists of a front steering system (Figure 1) with rear wheel drive. The drivetrain consists of three engines, driving one single drive shaft (Figure 2) that gears into an open differential (Figure 3) which allows each wheel to spin independently for better turning.

Figure 1

Figure 2

Figure 3


Since the open differential is bad if the wheels start to slip (like on the sand) we might switch to a TORSEN differential system which has the good properties of an open differential (better turning) along with the fact that it is a completely mechanical system and transfers torque to the non-slipping wheel if one wheel starts slipping (property of a locking differential). The amount of torque transferred is a function of the torque bias ratio (TBR). A TBR of 3:1, for example, would mean that one side of the differential could handle 75% of the torque, while the other side only needed to handle 25% of the torque.

From wikipedia: "When the traction difference exceeds the TBR, the slower output side of the differential receives the tractive torque of the faster wheel multiplied by the TBR; any extra torque remaining from applied torque contributes to the angular acceleration of the faster output side of the differential."

Friday, May 15, 2009

Pathfinder Robot

We completed our pathfinder robot today. It is a powerful robot with one engine per wheel in the back, and two engines powering the single front wheel. Designed this way, the robot can easily climb over the stairs. The robot is as shown below (Snapple not included).



We (Paul) also completed a VERY COMPLEX AND AMAZING steering system that will be used on our final navigator robot. The single motor powers the steering mechanism, which will turn the wheels that will be added later.