Saturday, June 15, 2013

AVC Part 2

The world does not want me to write this post....
I'd worked on it for about an hour and  forgot to open a new tab when navigating away to find a link and blogger lost it.....

On the day of the event I arrive at the venue at around 7:45, Unloaded my stuff and setup on the provided worktables under the tent. They open the course for testing at 8am and I slowly walk the doping class car around the course gathering way point data.  For the first turn I decide to go waaay long so as to try and avoid some of the traffic. In the videos you can see the car goes way past the first turn this is intentional.

My first heat is with Cheapshot the little car. Its heat two and a rush to be ready. I strip out the RC code and setup so the system arms on reset..... I test this in the pits by pressing the go button and it seems to work.
I sit at the line its time to go I hit the button and nothing happens..... I then hit rest and wait out the 20 seconds of gyro zero and other things then the car finally takes off just after the first place car finishes.....
The car goes out about 10 feet and turns in a large never ending never varying circle round and round...
Heat 2 round 0 Zero....

So I have 6 heats or so to get the big car ready.... I revert the code to what it was for testign last night. Rather than hurrying to strip otu the RC arming code I just comment out the one line of processing received chars from the DSM2 receiver and add a serial port command to arm the car....
I press the button and the car turns hard right smacking into other cars... then it straightens out and runs the course solidly.  (Here is the heat one video..)
Video by Ben Brockert

The car makes it through the hoop but misses the ramp... slightly to the left.... I'm faster than Savage solder, but they hit the ramp... after the first heat the score is Savage Solder 440 NetBurner (me) 412.. so I was 22 seconds faster... but missed the 50pt hoop bonus.

I hurry back and look at the small car code.... I see where I commented out too much and that my {} in the state machine did not line up as expected, id turned off the IMU/gyro processing. It is with high hopes I go back to run heat two of the Cheapshot small car.... This time the car starts right up, turns hard just like its big brother and flips over on the start ramp.... I'm now zero for 2 on this vehicle.

Time to adjust the course to try and hit the ramp and run the big car again....I move the way points over about 3 ft to hit the ramp and we run heat two.... It lurches off the start gets going solidly.... just three feet before the hoop it swerves out of the way just missing the hoop.... when it gets to the ramp it goes way wide and actually rubs on the curb..... I moved the way points the wrong way.... it scrapes along the curb recovers and finishes the race..... I'm now solidly in first place.
(After heat 2 Photo by Ben Brockert)


They now take a break and let everyone practice for an hour before the next heats. Realistically the small car has no chance of even placing so I focus on the getting the big car to hit the ramp. I go out on the course and carefully measure the center of the ramp.....

I do a quick review of the code for the small car and realize that steering code has a static variable in it to measure the rate of turn... between loops and  since most of my testing had the course starting to the north this would not be apparent.. I change the code so it ignores this for the first pass through navigation and prepare to try again.... This time the small car ends up in the fence... I'm zero for 3  very frustrating..

I'd planned on going faster than I was going. In testing I ran the straightaways at 3X the speed and 50% faster on the corners, but for the last run I had such a lead that if I just finished I would win. No incentive to go faster... It was still fast enough to jump the finish line:


(picture by maushammer)

So I left the car just as it was and the third heat looked just like the first two....it went straight at the hoop and the ramp and dodged away just missing at the last possible minute.
It did not matter I was not fastest, I was most consistent I'd won.
I think I had 1131 points and the 2nd place car (the team that won last year 0x27) had 571 points.
That is a pretty solid win.  If Id just focused on the one car I could have fixed a few bugs and gotten another 250 pts...(2 hoops and 3 ramps).

So what did I learn?  Again I relearned the don't try and do too much... one entry, not three. I Was lucky that my starting out weirdness did not cause a crash and if the 2nd/3rd place cars had been consistent I would have taken third.

The way I tested I drove the car around an area laying out a track... then placed way points on the map. Since the map faced north all of my testing had me starting to the north.... something about my starting code worked on a heading of 0... but not at a heading of ~270 I thought I was testing like I'd race... alas that was not the case.

The BD960 trimble GPS and Omnistar service was flawless the entire time I used it. Sitting in the tent at the race it was reporting an estimated error of between 5 and 15cm. Without this level of accuracy winning the race would have required a lot more work.  Its pretty amazing when you realize that its measuring better than 20cm at 20hz.

The GPS track was flawless. better than 20cm accuracy at 20Hz, so why did I miss the hoop twice and the ramp every time? After my midnight suspension repair the car pulled to the right. The code took care of this with an integral steering term in the PID that turned heading into steer direction.  As all the turns were in the same direction and I did not want windup I zeroed the I term at each waypoint switch.... so since I put waypoints right before the hoop and the ramp.... right before the hoop and the ramp the I term was zeroed and the car swerved to the right until the error built up again.... I should have checked  the heading change and not zeroed the I term for changes less than some value.  I should have figured this out in testing,....

In my testing I'd set the hoop in the track and made sure the car was consistent. I never tested hitting a spot the was pre-configured, only in being consistent run after run... (You can see the in the video from my previous post) The track was very consistant, but it wasn't wher eI wanted it to be.

Last year I handicaped myself by not using the good GPS. This year I wanted to prove a point that the lowest cost NetBurner device was powerful, so I gave myself a deliberate handicap by choosing our lowest powered CPU. In testing I recorded telemetry and got data from the devices.  During the actual race I had no on board data recording. If I had I would have easily seen both the the start up and ramp missing problems in the data in a way that I could fix them... regardless the car won with an SBL2E cpu, a network attached CPU for less than $15.

I've now won with a car so next year I'm going to finally enter a flying machine. Id prefer to enter a plane, but if the rules don't change they heavily favor a VTVL vehicle. So I'll probably pull my autonomous helicopter out of mothballs and use a new modern CPU. For fun here is the best piece of video my autonomous helicopter ever took:





Lastly I get requests for the code on these projects.... since I write code for a living for NetBurner I'm hesitant to post my hobby code because its not up to the standard of code that I would release in my professional capacity.  So as long as you realize that this is hobby code written in a hurry while suffering from sleep deprivation you can have at it..
.
Here is the code for the car.. as a a few days before the AVC...
and
here is the QT code for taking logs and placing waypoints... again a few days before the AVC....
https://github.com/pbreed/QTMap

I'll try to update the code as run some time in the next week....


3 Comments:

Blogger Ben Brockert said...

Timestamp on that video is before 11AM, so I'm fairly sure that's heat 1. Heat 3 I watched from the sideline, trying and failing to get a good pic of it jumping the finish line.

I haven't processed my photos yet, but I found a couple of you on Flickr. http://www.flickr.com/photos/94313015@N03/8993463518/ http://www.flickr.com/photos/94313015@N03/8993455552/ in this set http://www.flickr.com/photos/94313015@N03/sets/72157634019372762/with/8993463518/

3:49 PM  
Blogger Michael Shimniok said...

Awesome job!! You really overcame a lot of hardship in the final days/hours. Wow. Sorry we didn't get a chance to chat.

10:26 PM  
Blogger Mark Omo said...

How did you use Omnistar? The subscriptions are very expensive, do you get it through your work?

8:11 AM  

Post a Comment

<< Home