 So, hi everyone. My name is Katie Levinson and this presentation is called Don't Fix It in Software. And you may be asking what's happening here. And the long and short of it is that I got drunk and mouthed off at DEF CON 17. And, you know, someone showed up, the longer story is that somebody showed up when a speaker didn't show up and said, you know, entertain the world. And, you know, and he was whining about how his robot didn't work in software and didn't work and he was going to use software to fix it. And the problem was basically that he said it didn't drive straight. And I'm finally like, what's the ratio of your drive base? And he's like, you know, are you driving the rectangle with the fat side forward or the skinny side forward? And he says the fat side. And like, if you look at the nice fat rectangle, I have a laser pointer. This means I'm in charge. If you look at the fat rectangle, if you imagine wheels on the end of this, as you go forward at all, you're basically levering against yourself to walk down. And it's not really magical that you're getting out of alignment. And if you want to only go straight, you know, drive it with the skinny side of your rectangle forward and then enjoy figuring out how to turn. But, you know, so this is the situation. And this goes on. More questions. And I end up doing this very academic intelligent rant, which I'm really sure probably look more like that. But the long and the short of it is afterwards security comes and takes me aside. And this makes me nervous because I don't have the best history with authority figures. But, you know, he says, why don't you do that? This is a talk. And I was pretty excited because, you know, the bottle of vodka was offered. And unfortunately some scoundrels were absconded with my vodka. I'm really proud I got to use those words. It's like my vocab words of the day. But now, thankfully, someone else would give me vodka. Props to you, dude. But the long and the short of it is now we're coming up and we're going to do this big list of all the ways in which I, all the things I wish someone had told me before I started building robots competitively or professionally. At the very least, I can show you some pretty pictures. I do photography and so most of these slides are pretty pictures. I'm really that boring. It's just, pretty pictures for you to look at. All right. My best qualification is the experience of doing stuff wrong. As I'm sure you know, all DEF CON speakers are only admitted if they are exceptionally qualified. So that's how, that's how things are. These are qualifications I'm probably more likely to put on my resume. Just want to like say right now, thanks to Originate, I just started with them like a little bit ago and they're totally like, yeah, you can do this talk that's basically self-humiliation. You can do it in our name. They printed me an awesome hoodie which I unfortunately left on the floor because I plan ahead. But they are awesome and if you are sick of your boss's shit, consider applying. Yeah. So basically, if you have a question, just like ask and if we run out of time, I'll have to ignore you and you can email me but I'd like this to be, you know, casual and interactive as much as possible. Was what? No, no, no. This was DEF CON 17 where I went up and like, oh, that sounds terrible. We should do something about that, guys. Q and A afterwards. All right. All right. So the outline, we're going through some good ideas and we've got some bad ideas and we're going to go through some things that people generally just don't think through the whole way. So starting right off with the good ideas. Let's go through physics. Tork is angular force. If you were to take a wrench and apply some force to a bolt in a nice, you know, arc, that is torque. Speed is how fast you do it. Physicists will get snobby and tell me that I'm not saying this correctly and I don't care. This is just a working definition for us idiots, okay? First item is pulse width modulation abbreviated to PWM. Sometimes you want your robot to be going at a speed somewhere between 0 and int max. People frequently decide that the way to do that is to just feed less energy into the motors and that's a bad idea. You really should not be doing that. Motors do not output power linearly. You can see this straight line is actually, that is the force output. You can see on the, when it hits the side with the torque, that's called the stall torque. That's where it's not moving at all. Where it hits the x-axis. That is called the free running speed where there's nothing on it at all. And you know, the variations come in between there. You can see the power that is output in total on the curve line. And you'll notice that like it is not the same at all points. So you actually want to put it where it's getting, I'm sorry guys over there. I'm going to laser this one and try to describe as best as possible. But I apologize in advance. You want to put it somewhere near the top so you get out as much power as possible and less inefficiencies. Alright, so basically you want to pick a good point on that curve and stick with it as much as possible. Gear everything, you know how fast you want the robot to go. So take the motor at the torque and power output you want and just gear it so that the wheels actually turn at approximately the speed you're looking for. And the question is, you know, oh sorry, nope, we're looking at a picture now. This is an oscilloscope looking at a PWM output. And so you can see that basically the line goes up and down. It's about one third down, two thirds up. So if you do this insanely fast to humans, it looks like the motor is just running at a slower speed. And so if the line is up two thirds of the time, it's going two thirds of its max speed. And this is the real way you control speed on robots without totally messing up your power output. And the question is, you know, how do you pick the point that you run this square wave at? And the important thing to remember is that climbing takes force. Unless you're going to be constantly operating on a perfectly smooth surface, you're going to need a little bit extra boost to get over whatever you happen to run into. And what happens very often is that people, they put themselves right at this total peak and then they have to go up a hill so now they're moving slower. So now they get pushed down this side of the curve. They're outputting less speed. It's coming out as torque. Now the motor is less efficient so they can shove further down the curve and further down the curve, further down the curve. And they're just wailing in place and really not getting anywhere. So you want to optimally pick a place a little bit over towards the speed side. So if you hit a bump, you don't wind in this horrible downward spiral of getting nothing done at all. And the expected terrain will change approximately where on the speed side of the curve you want to set your running point, generally speaking. Yeah, I hope I'm going at okay speed. This is, you can see at the bottom these things here. I'm going to, like I feel like I'm being a total dick here. These things at the bottom, these are PWMs. You usually do this as a hardware object. You buy them. The internet sells them. They're like 100 bucks. They're cheaper if you like fire. But like, you know, a good trustworthy, like I would feel comfortable putting this on my robot and it will probably not be the thing that catches fire. It's about 100 bucks. This guy removed all the cooling systems because he likes fire. That's his prerogative. You do get to at least see the insides of them, which is interesting to some people. All right. Next item. I really shouldn't have to have a whole series of slides on this, but software people think threads are just kind of magic. It's like I've applied a bolt to this problem and now all my physics are solved. And it's like, no, people major in this shit. And it's kind of complicated. So the once over lightly, this is a bolt. This is not a bolt. Every time you call this a bolt, I die a little inside. And I need to drink. This is a screw. The end is pointy. You don't have to drill a hole first when you put it in. You don't put a nut on the end. So I don't know what this chicks problem is, but you don't need to put a nut on the end of this. Also, bolts need to have something on the other end to hold them on. You either thread the piece of metal or wood or whatever that you're putting them into, or you put a nut on the end. This is wrong. You're just going to rip the head off the bolt here. You see the arrows imply the force. You're going to rip off the head of the bolt, or you're going to rip the twirly, okay. The thread, yeah, we are extremely technical around here. You're going to rip the threads off the screw if you do this. Don't do this, okay? This is also wrong. This is a machine that does nothing but bend your screws. And by screws, I mean bolts. This is going to get a lot interesting really fast. Alright, this is wrong. This is also wrong. In this one, you are not bending your bolt, but you're going to shear it, because you're using the bolt as the major pieces that keeps it together, and they weren't actually in the same way that, you know, you rip off the head, you'll just shear these things in half. They're like zinc-plated shit. They're really not made for this, okay? Don't do this. This is also wrong. This is a... It's Miller Lite, dude. This is right, okay? This is how you do it. The bolt is actually not the object that is holding the pieces of metal together. The bolt is the object that holds the pieces together enough for static friction to take over and actually do your major holding force. Like, it's like you don't, like the force should not be physically in the bolts. The force is in the fact that static, I'm just going to repeat myself. You got it, okay? All right, next, this is a puppy, because we're changing ideas. And people say I talk too fast, so I just put puppies and kittens and those things in whenever we have to transition ideas. I hope you guys are cool with that. Puppies are awesome though, so I really hope you are. Next item, drivetrain ratio, okay? We're going to consider the places where the wheels... We're going to assume the four-wheeled robot here, because we're simple, okay? So, assume that the points where the wheels touch the ground are points, you make them into a shape. If it's a square, then you can go forward and turn. You know, if you want it to be super agile, you have the big, like, crazy angle thing, or you drive the rectangle with the short side forward if you just want it to go straight almost all the time. This is not terribly complicated, but a lot of people are just like, I'm making a robot, I'm going to put some wheels on some wood, you know? So think about this when you're setting up your stuff. Okay, the other thing that people default to is a car. You know, all of you who drive, though, that cars aren't actually, like, particularly nimble objects. They need to... It's just like trying to turn a bicycle. They need to go forward in order to turn. Also, making the wheels swivel properly is a pain in the ass. So unless you have a good reason for this, this is probably not the default that you want to go to, even though it's what you see most often in your daily life. Tank is actually a pretty good default. Just put the wheels down the side, put them all forward to go forward, put these guys forward and these guys backwards to turn. Turns on a dime, pretty clean, it'll scuff up everything if you care about that because basically the whole art of it turning is it doing little micro hops. So, and in particular, if you have large tank treads and then you previously had rug in your house, some people will do like two wheels tank driven and then casters or omni wheels on the front as a slightly less brutal alternative. That will save your carpet significantly, but no guarantees, man. Omni wheels, unless you have a good reason you should just buy these. So many people want to make them... I warned you. So they're happy with the resistance. They permit, like some people will do like they will have a set of wheels going this way on the robot and then a set of wheels going this way on the robot and what you can do is by driving different sets of wheels independently, you get a robot that goes this way and goes this way without turning. Terrible lateral traction for pretty obvious reasons. This thing in the middle here is an omni wheel. I'm sorry, the speaker is in the way. I really can't even see that one. But yeah, this thing towards the middle is an omni wheel and as you can see it's a, yo dog I heard you like wheels so I put some wheels on your wheels. These little black things are free-floating. So this is why you can have the wheels go opposite ways of each other and not have anything actually fight. This is also the transition side towards vector drives which are these things with like the miniature hair curler rolling pin things. You'll notice these are at an angle which means that this wheel when you turn it, most wheels when you turn it, they just want to go forward. This wheel wants to go forward and also in the direction of the little hair curlers. And so when you look at this, if you put four of them on, their default state is that they all have two directions that they're pushing and if you balance them right, you actually now have a