热度 17
2013-10-23 21:34
1755 次阅读|
0 个评论
I am currently having a delightful, exuberant, and all-around wonderful time. This is because I've started work on my Arduino-powered robot, which means my head is currently bubbling over with ideas and brimming with questions. In my previous blog on this topic , I started off by looking at traditional 2-wheel and 4-wheel bases. Eventually, however, I decided to go with a 3-wheel base from RobotShop.com as shown below. Why? Well, quite apart from anything else, it looks almost as cool as Doctor Who in a bow tie and a fez! Robot base in its usual orientation (top) and flipped over so we can better see the motors (bottom). Observe the special "transwheels" attached to the motors. These boast free-turning rollers mounted perpendicular to the axle arranged around the periphery of the wheel. Based on its use of transwheels, the exciting thing about my omni-directional robot base is that it can move in any direction. Of course, the tricky thing about controlling this omni-directional base is that it can move in any direction (LOL). This is actually a tremendously interesting topic, which we will consider in more detail below, but first... So, with my base on order, the next thing I need is a controller to handle my three DC motors. Of course, I could use my main Arduino board to directly control an H-Bridge, but I want to keep the Arduino's computing resources as free as possible. The solution is to use a dedicated motor controller board. Each of my Cytron SPG30-20K motors has a rated current of 410mA. After looking around the Internet, it seemed to me that the most affordable and best supported option was the Arduino Motor-Stepper-Servo Shield from Adafruit.com: This little beauty—which connects to the main Arduino via an I2C interface, thereby consuming only two pins—can control up to four DC motors (which is what I need) or two stepper motors. It can handle 1.2A per channel and offers a 3A peak current capability, so it's more than capable of dealing with the motors on my base. The cool thing is that all my main Arduino has to do is send a command to the motor controller saying "Make motor 'n' run in 'x' direction at 'y' speed," after which we can leave the motor controller to perform its magic. Now, this is where things start to get interesting... Purely for the sake of discussion, let's assume we have a birds-eye view of a 2-wheel base. Let's further assume that this base is currently pointing "north," but we wish it to travel some distance "east." We could illustrate this as shown below (these images omit the one or two castors used to balance the base): As we see, first have to rotate the robot until it's pointing in the direction we wish to go (we'll call this action "rotation"), after which we can move it as far as we wish (we'll call this action "translation"). Now consider the 3-wheel base we introduced on the previous page. By varying the amount of rotation on the three wheels, we can simply make this base go in any direction we please. On the other hand, we may well decide that our 3-wheel base has a "front" (indicated by the arrows in the images below). One reason for this might be that we have a particular sensor—like the Pixy machine vision sensor—that is mounted with a specific orientation. Now, working with a 3-wheel base, let's once again assume that our base starts off pointing "north," but we wish it to travel some distance "east." Of course, we could do the same thing we did with our 2-wheel base, which is to first perform the rotation and to then perform the translation—that is, to keep these actions completely separate. Alternatively, by carefully controlling and varying the speed of each of our three wheels, we can perform the rotation and the translation simultaneously as illustrated below: As we see, there are two ways in which we could approach this. The first is to arrange things such that the rotation is times to end with the translation. The second, which I think I prefer, is to make the rotation happen—and get the base pointing in the right direction—as quickly as possible and to then continue with the translation. Of course, when I say "as quickly as possible," this needs to be qualified a little. If the base rotates or accelerates too quickly, all sorts of unfortunate things might occur. What we want to do is to ramp up to the full rotational and translational speeds at the beginning and then ramp down again at the end. This topic, along with more esoteric concepts like Genetic Algorithms, will be the subject of my next blog. Until then, do you have any questions or comments?