Steamworks - Week 1
Posted on Tue, Mar 7 2017 in Bob's Journal
The Krypton Cougars are back in action. After their banner performance last year, the students were eager to learn from their mistakes and made an exhaustive list of everything they wanted to do better, presumably so they could pointedly ignore it.
Last year the battery was very hard to replace, causing much frustration during and after the competition season. One student ended up becoming the designated battery installation expert, and that could only be done in a timely manner if the robot was held up in the air. For 2017, the team decided that wasn't nearly difficult enough, and buried the battery even deeper in the depths of the robot. It now requires two or three students to replace a battery, after moving multiple robot mechanisms out of the way.
Last year the team divided their focus between too many things, and vowed this season they would streamline aggressively. When the game was revealed, the first meeting was to discuss what game elements the team would target and which they would ignore. The team decided that the fractional point value of fuel made it unnecessary, and that the forty-point gears and fifty-point climbing were much more important. They then spent half of build season designing a hopper and loader for fuel. Which leads us to the next improvement...
Last year the robot was not mechanically completed until the last moment. The programmers were forced to program on the car ride to the competition. We agreed that this year we'd finish all mechanical changes at least a week before the end of build season, giving our programmers and drivers the time they needed. Naturally, the mechanical team decided that prototyping the fuel hopper system took priority over programming and driver practice, leaving the programmers to test their changes in the gaps. An additional motor was added to the robot, for the hopper, the night the team arrived at the competition, which the programmers did not find out about until the night before. It was programmed at the competition. The drivers got no practice time.
With this auspicious start, our team could not help but have a great first competition. One thing you must do at an FRC competition, after getting your robot unpacked, is have the robot's on-board radio re-imaged for the field. Until this is complete, and your robot is inspected, you can't do much. There were already a few teams in line before us, and they seemed to be having trouble.
"Did you update your firmware?" the technical assistant would ask.
"Yes," they replied confidently. Then they'd plug in their radio, enter their team number, and then watch as a large error dialog appeared. Three teams in a row did this, so when it was our turn I was a bit worried.
"Did you update your firmware?" The last update we'd done had been the last week of build season. I hadn't seen a notice of any new changes, but how could all of these other teams not have updated their radios in three weeks?
We plugged in our radio, entered our team number, and hit the "Configure" button. A progress bar appeared on the screen. A few seconds later our radio was successfully imaged. We took it back to the pits and plugged it into the robot.
I suppose at this point I should mention that this is the first year our team has used a co-processor for vision. It's a second computer with 192 GPU cores, and it can process two different camera feeds for different targets and stream video feeds and target information back over the network to our drivers. It's one of the programming team's several amazing achievements this season. We rely on this vision information to drive our robot, both autonomously and when we need extra precision under human control. After the radio was re-imaged, this vital co-processor disappeared from the network.
By that time it was getting late in the evening, and Miranda had only had a short nap on the ride out, so I had to leave so we could put her to bed. Back at the hotel, I provided tech support via text message. The core problem was somewhat obvious. With the router reconfigured, there was no longer anything providing DHCP on the network for the co-processor. All we needed to do was connect to it and set a static IP address. Fortunately, we had a second radio with us, still programmed for the build site. We plugged into that and tried to connect with SSH. "Connection refused."
We tried many variations. The co-processor was clearly on the network. We could ping it and it showed up on nmap scans, but SSH failed. With no solution, our team was kicked out of the pits so the school could close for the night.
I arrived the next morning to find two technical advisers and another team's mentor in our pits, watching over the shoulders of our programmers as they continued to try anything to connect to the missing device.
Unfortunately, they knew even less about our problem than we did. The mentor tracked down another router, in case ours was broken, but couldn't get it configured properly. He did have time to criticize our Arch Linux laptops, however, and suggest we should move to Ubuntu. The technical advisers asked us to try all of the things we'd already tried. One thing he said bugged me, though: "Port 22 is blocked on the field."
I remembered that three weeks ago we had installed the mandatory radio firmware update, and hadn't tested that system since. "Try re-imaging the radio without the firewall turned on," I told one of the programmers. Sure enough, once the firewall was disabled we were able to connect and set a static IP address. The robot was ready for action.
Throughout the day the robot performed well, with issues being mechanical and quickly fixed. Our driver, not trusting the autonomous gear scoring mechanism, had rammed the robot against a peg, sheering off several LEDs, damaging the camera mount, and bending the aluminum shaft that held it. We bent it back.
A piece of fuel got under the robot, tearing loose some wires. We reconnected them and added more electrical tape. Our robot was immobilized when the metal plate for the fuel pickup was bent downward, digging into the carpet. We cut it off with a jigsaw, and duct-taped over the rough metal edge.
With three more matches to go on the first day, our team set the robot up on the field, but signaled that they were not getting a camera feed. The robot did not move during autonomous, but quickly got back into the match once the player-controlled period began. Then things started going wrong on the field. Pieces that were supposed to move wouldn't. Pieces that were supposed to stop kept going. Signal lights turned off. The field-fault alarm sounded.
The teams reset their robots to try again, but the field couldn't be brought under control. Eventually the students on the field were told to leave. The robots were powered off. The volunteers at the event scurried around while the DJ played dance music to distract the thousands of teenagers.
As minutes stretched into hours, Miranda's bedtime arrived. We headed back to the hotel. Much later that evening the field was finally fixed. Our team had their match, and then the school closed for the night.
The next morning we were informed that because of the extraordinary delay, twelve matches had been eliminated. We had only four matches left to prove ourselves. We got off to a solid start with an early win. Our second match of that day boasted the highest score of the entire weekend, and our robot was directly responsible, because we managed to give the other team two hundred and twenty five penalty points.
As you may remember from previous years, our team likes to play defense, and they'd been moving to block other robots from getting to their retrieval zone when the driver lost control of the robot. It stopped moving, inside the retrieval zone, and nothing he could do would make it respond. Since interfering with robots in your opponent's zone is a penalty, the referee dutifully counted up all the times our robot was bumped by an opponent's bot.
Back in the pits the programmers were stumped. The program was clearly running, but none of the motors would move. "We're not seeing any traffic on the CAN bus", a college-age mentor said. "Could the CAN bus be out?" asked the head mentor. A second later one of the students noticed the loose wire dangling from the shooter motor. Once this wire was replaced, the robot sprang to life.
It was now our next to last match of the day. The drivers set the robot on the field, but the cameras were now so battered that they were crashing, and there was no camera feed. Being clever fellows, they lined up the robot anyhow and commanded it to drive forward far enough to smash into the airship. Remarkably this worked, and the gear the robot was holding was lifted up into the airship for sixty points. And then the driver-controlled period started. At least, it was supposed to be driver controlled.
The robot began spinning to the left. "HELLO COMRADE", the driver station announced. "WE CONTROL ROBOT FOR MOTHER RUSSIA". The drivers began freaking out. They called for a volunteer, signalling frantically. The robot stopped spinning, then began spinning the other way. "WHO DESIGN CONTROLS??!? WE CANNOT DRIVE THIS"
Finally the robot came to a stop. "YOU DRIVE". The main driver took control while our other driver dragged a volunteer over to investigate. By then the alert messages had disappeared from the screen. A few seconds later the robot announced "HAVE A NICE DAY COMRADE". The volunteer snapped a picture of the strange pronouncement.
Now, I suppose at this point I should let you in on something of which the team was unaware. During the times they'd been leaving the programming laptop unattended in the pits, I'd added two lines of code to the robot's base class. Kelly and I watched from the stands, laughing maniacally as the drivers fought with their suddenly disobedient robot.
The excitement in the pits was palpable. "We've been hacked!" The only trace of this "hack" was a line in the log that read "Russian Hacking Attempt Detected", so I made them grep for that text. Sure enough, they discovered that a file had mysteriously been added to their project. One programmer threatened to kill whoever had added that file. The other, being slightly calmer, began to make the connection. "You did this," he accused me. "Why?"
"Because it was awesome," was my reply. As word got around that the Russians had not, in fact, taken control of our robot, the team calmed down. I explained to them the importance of checking their changes before deploying them. The programmers removed the offending lines and sent the robot back out to the field for its final match.
This time the camera was working as expected, and they lined up for the peg, ready to show their superiority. Then the match began. The second light ring on the front of the robot switched on, reflecting off the airship and drowning out their vision target. Once again, the robot sat motionless during the autonomous period. They finished the tournament in seventeenth position, slightly above the halfway point for thirty-six teams.
Now it was time for alliance selections, and being seventeenth meant they had no hope of being an alliance captain. They needed another team to select them. The first round of selections went by, and our team remained on the sidelines. In the second round they were selected by the third seeded alliance, who had done some fantastic scouting. Rather than pick teams based on rank, they selected teams that had slow starts but had improved throughout the tournament. Our alliance stormed through the quarterfinals and semifinals without a loss.
In the finals we faced the fourth-seeded alliance, and our team had fallen into the role they most love: defense. Our robot set up in the narrow passage to the opponent's feeder slot, but far enough outside it to not be penalized, and blocked any robot trying to pass. This strategy worked flawlessly the first match and we won 285 to 195. The second match was much like the first, but one of our teammates did not climb, and the match ended with a tie. In the third match our alliance decided to step up defense, which proved to be a poor decision, as this undercut our offensive abilities too much and was largely ineffective, resulting in a 215 to 305 loss.
Our team prepared for their unanticipated fourth finals match. It started off poorly, when our autonomous gear scoring teammate failed to move, costing our alliance twenty-five points. However, the rest of the match was played evenly, and with thirty seconds to go our alliance was only down by five points. It would come down to which team could get the most robots in the air. Unfortunately, our robot's camera to see the climbing rope had long ago failed, and our driver spun in circles, trying desperately to get the rope to attach. On the other side, all three robots headed into the air. Then, one of their ropes came loose, leaving that robot stranded on the floor. If we could climb the rope, our alliance would be the champions.
With barely any time remaining, the driver finally managed to connect to the rope and begin climbing, but it looked like it might be too late. As the clock counted down, the robot climbed up. Everyone watched our robot in anticipation. There was one second remaining, and the robot was inches from the top, when suddenly our rope snapped, sending our robot, and our alliance's hope of victory, plummeting to the floor.
Oh well, another silver metal isn't that bad.