📜 ⬆️ ⬇️

Radio-controlled walking robot on MG90

Recently, many articles on the creation of walking robots based on Chinese servos have appeared on the network. All of them are written technically competently and competently, only there is a small problem: in most cases the crafts described in them do not work in the end. Therefore, we bring to your attention our development, brought to the logical end.




If the video does not show here, then: direct link .
')

Features:

1) 4 legs 2) radio control 3) light 4) optimal price 5) without a blunt arduin.


READ MORE: 1) A robot with six legs is stable by definition, and therefore not interesting. We chose a more complex 4-foot version. Pros: cheaper, puts less battery, less to cut parts, more nimble paws. 2) Controlled by bluetooth, there are no control and power wires. Only 5-byte control bursts are sent from the laptop. The entire calculation of the trajectory, angles and impulses of control of the servos takes place in the controller on board. 3) To reduce the weight, all the parts were made from a PCB, for ease, they made holes and windows. No extra racks and brackets. A small lightweight battery at 1.1 Ah - enough for 40 minutes. Lithium polymer, estessno. 4) SERVERS: TowerPro MG90 cars are not the cheapest, but also not the lousiest of what Chinese offers. Ordered on ibee and there was a suspicion that the Taiwanese comrade sent the weaker MG90S cars, re-gluing the stickers. Blue SG90 with plastic gears are buzzing and buggy in 50% of cases, we do not recommend. CONTROLLER: The stone must support hardware FloatPoint's hardware, no integer AtMega is able to cheat on 12 servos. For the price / quality of the chosen fee STM32F3Discovery. I was pleasantly surprised by her good protection against a fool. 5) Most degradant programmers begin their journey with some {censored} called "arduin". The robot on Arduin will turn out pretty dry. We wrote everything on Sikh. The stone was written in KEIL, the top - in MS VS.

DESIGN. Machines of Chinese comrades have a shaft exit only on one side. If the root machine is fixed only on one side, then its own weight will pour out into a bending moment and quickly wear it out, so we decided to be confused and glue 10 mm steel pins on the back side coaxially with the shaft. Root machines secured between two plain textolite boards. On the bottom bearings are soldered under the pins. On the top floor there is a Discovery board (sitting on the connector, without soldering), on the bottom floor there is a battery and two power conditioners. The floors are sealed by soldering with long pins (fairly strong and light, such as paper clips), while they also feed into the upper board. Chassis dimensions were chosen based on the size of the Discovery. The length of the knee was chosen 4 cm, based on honest data about the servers given by Ariman . A shin length of 7 cm provides ground clearance of about one centimeter. With longer legs cars can not cope. Details (only flat, not folded) are drawn in the Vatokad, the 3D model is assembled there. In the textolite foil cut the track wiring power and signals. All that is possible, glued with dichloroethane. Finishing gross weight of 367 grams. Details cut out on the machine GF-38 cutters kyocera. We agree with Ariman `th - the process of milling must be monitored personally, you cannot order parts from your uncle for money - they will make fufel. Without a machine would also work, but less gracefully and for a long time.



PROGRAM PART. In STM32F3Discovery there are enough multi-channel universal timers, which allows you to control 12 (and more) machines, without at all downloading percents. The stone has a hardware implemented function for calculating the square root (for which thanks to him) in just 13 cycles. The arcsine function from math.h turned out to be a hell of a brake, because of which it was necessary to write its decomposition into the Taylor series. The rest used school trigonometry, incl. cosine theorem. The calculation occurs 50 times per second, because The nominal period for submitting control to the machines is 20ms. With the help of PLL, the percent is brought to maximum performance. Servas are controlled by timers through a single-pulse mode, before that they tried PWM - it was worse. Due to the low location of the CG and the rapid raising / lowering of the paws, the robot does not fall when two paws are raised simultaneously. The change in speed, reverse, turn on the move and turn on the spot are implemented by recalculating the length and direction of the step. With a phased push-off with the front legs and a rearward, co-directional movement, it rears up. The Bluetooth module is connected to the UART, all the packages contain a sync byte and CRC. The speed is 9600. On the TX interrupt, a packet handler is called, giving commands to the main loop.



CARS. To control the machine, you need to constantly give impulses, otherwise it turns off and does not hold the position. Even if the pulse duration does not change, you still need to constantly submit it. In this mode, the machine behaves like a spring - the more you turn it with your hands - the more it resists. Switched off does not resist at all (but this does not mean that it can be uselessly to twist your fingers back and forth back - the gearbox goes off). We repeated the experiment of Ariman, picking up a beer can with a machine, the result is the same as his - raises about 700 grams instead of the Chinese declared 2000 grams. The leg assembly can resist a force of 750 grams (maybe more, did not try - textolite knees begin to bend, and the machine can burn), but the leg behaves relatively adequately with a force of 400 grams and less (yes, the force is usually in newtons, translate yourself). Total robot can keep on itself in the limit of 750 * 4 = 3kg, this is if the design does not grunt. Bear in motion can 400 * 2 (because two legs hang in the air) = 800 grams, minus 367 of its mass, a total of 433 grams. The more you load, the more cars get heated. Guzzle in the amount of half an amp. Tip: the first thing to do with new cars - disassemble and responsibly clean from industrial faeces. After assembling the chassis, all the machines need to be calibrated, because Comrade SunMuyVchay does not guarantee the identity of the characteristics of individual copies; we calibrated at two points: 0 and 90 degrees. These are the prog, control and test-calibration:



Details and prices
Details and prices (prices for spring 2014, Ibei, Dialectstream, Promelectronika):

12 MG90 servos + 2 ... 3 spare + a couple of cheap blue for experiments - 12x185r
Board STM32F3Discovery or equivalent, most importantly with FPU and good peripherals - 507r
Battery 1100 mAh - 329r
2 stabilizers on 5 volts - 2101
Bluetooth module - 217r
USB-UART adapter (for debugging) - 112r
Avtokraska in a cylinder (color, as it turned out, does not affect driving performance) - 130r
2 sheets of PCB 20x30cm - 2x150r
Sockets, switch - 100r


ADDITIONALLY. Basically, we did together with Nolkʻom (Miass) with the participation of Ivan and Miha (Zlatoust). They did it slowly, in the evenings for 4 months. It is better for one not to take it - there is not enough enthusiasm and a variety of ideas for implementation. Software that you need to know and be able to: AutoCAD or SolidAid (schematics, 3D model), Artkam (codes for CNC machine), Matkad (static calculations), MS VS 2008 or Matlab (runs a model), MS VS or Borlyak (upper programs) , Keil or Iar (lower programs), and Excel and Calculator.

Update 12/07/14
Today, we tested the control from the phone. Experience in android little, so it turned out quite simple and crooked, but it works. Probably we will not develop this topic, since we bought a joystick - we will continue to manage it.
Here is a short android video:

If the video does not show here, then: direct link .

Some nuances of implementation
Examples of working with bluetooth under the eclipse in the network is enough. Including ready / smart in Russian.
The easiest way to connect is by ID (without wasting time searching for devices within reach, and without risk to connect to another device). The module ID (we have the HC-06 module with ID = "20: 13: 11: 01: 11: 28") must be known in advance via the Bluetooth menu in the phone. Next you need to connect to the device with UUID = "00001101-0000-1000-8000-00805F9B34FB". This is the UUID of the serial port. It is not necessary to configure it. Powered by 9600 baud.
At first they made the controls on the buttons, but since our speed on the robot is adjusted smoothly, it was decided to switch to the touchscreen. The TextView1 element in single-finger mode acts as a touchscreen in layout, and it also displays debug digits. It has a feature: it works on setOnTouchListener, but if you do not declare setOnClickListener, then the touch only responds to the first touch, but not to motion and release.



It looks like this in the costructor and in the emulator:




As it turned out, the touchscreen clogs the buffer of the serial port due to the fact that it generates a notification too often. I had to enter an artificial slowdown sleep (100). With the buttons this did not happen.
Before running Eclipse, we recommend saving / closing other programs. Simultaneously with minecraft will not start at all. Under Win7, the Eclipse buggy is terrible. Switched to WinHR. It is better not to debug in the emulator (drag-on), but directly in the phone - put the “USB debugging” checkbox in its settings.


Kament on incoming kamenty:
INTRODUCTION. Tovarischi habrorobotostiteli, despite the fact that the article in some places has a motivational character (according to the mood), the goal of writing it is quite serious - focusing on the nuances and pitfalls of robotics “on my knees” on the example of our creation. And also give the desired vector and demonstrate the capabilities of servos. Therefore, we ask you not to measure with letters in the kamentah, but to speak on the merits (although kamenty of the type “cover it is surely like this” are also welcome). And of course, individual individuals can advocate the construction of small-scale mechanization, at least on I_7, at least on the Z80, at least on a calculator with a balalaika. The country is free, there are many people and opinions.

In essence
To keep kament not lost in other kamentah, we will lay out here. So:

Instead of discovery, it is better to put just a chip with a strapping. Yes, it's right. And, by the way, a branded board with a green soldering mask would look very cool. This option was considered in perspective. In the meantime, on the prototype (hereinafter - OE), it turns out that there is another board on the top board - which is wrong. But in order to save time, we went to this option, because the layout of the board for the chip, the order of the board for the 3rd class of accuracy, the inevitable errors in the scheme / layout, the reorder of the board - a long, tedious, well, more expensive.

But I would not milling textolite at home. Yeah, right. To cut at home is absolutely impossible. We did in the workshop with ventilation. Well, of course, the slegonny was inhaled with glass dust, not without it. It seems like for a one-time job is not deadly. Of course you need to work in a respirator and protective mask, and the nose under the mill does not stick. BUT, we repeat, this is O.E. - ordering untested motherboards from a company is an unaffordable luxury. By the way, the lower board had to be edited for sonar, when they had already drilled and engraved the back side. Due to various types of jambs, we had to pause and interrupt the milling process twenty times.

The implementation of the jump and landing would be interesting. Yes, they also thought in terms of overcoming the stairs. While we are afraid to kill cars. The problem here is that the impact of the landing will not be on the engine, but on the gearbox (or rather, in the opposite direction - this is a multiplier). In order for the blow to fall partly on the engine, the cars must begin to work out the lifting of the paw and even with the correct deceleration just before touching the floor. But here is an ambush - the tact of managing the servos is catastrophically large for this purpose (20ms). Those. the gearbox will be bent, not having time to recover. There are two ways out - 1) to spring up each joint so that a sharp blow falls on the spring, and then slowly chose the spring and then compress the spring, or 2) install expensive machines with the ability to set not only the position, but also the speed and moment of force. Although it may all be prejudices, and these servos will fully withstand the leap, but for now it is scary.

Mathematical retreat
There is a mathematical nude here, that's why it is minimized.
The leg consists of three links, it turns out four nodal points. To solve the direct problem (we know the angles of the machines - we need to find the coordinates of the fourth point relative to the first), in the general case, a threefold replacement of the XYZ basis from point to point is required, and this is a multiplication of 3x3 matrices, whose elements are cos and sin. This is a direct challenge. And it is necessary to solve the REVERSE task (we know the coordinates - and we need to calculate the angles). How to solve this problem in general, we do not know until now. The only option that we have invented is a multiple solution of the direct problem with fitting the angles to the given coordinates with a given error. But. It was saved by the fact that the problem was solved by decomposition into several flat problems, for which the school trigonometry is enough. It took only one replacement of the basis (and that is not in 3D, but in 2D). The whole vector picture was divided into triangles, for the calculation of the angles of which the arc cosine, arc sinus and arctangent were required. Since these functions are mutually computable (with the help of T. Pifagora, that is, with the square root calculation), we decided to use only arcsine. Its decomposition in the Taylor / Maclaurin series is the simplest one given in pedivicia. Although it would be possible to use a simple piecewise linear or piecewise parabolic approximation using the least squares method. (Which in the end would lead to the same formula as the Taylor series.) This method of calculation (specifically this one, without clever optimizations and the use of Hacker-type hacker algorithms with FixedPoint arithmetic) will not stretch anything (at first they also wanted to use it) stuck on the first division or the calculation of the root or sine, and there are dozens of them, and twelve machines, and the cycle is 1/50 second. If you still use the atmega, then the calculation of the angles must be done on the PC, and the robot should send the finishing values ​​by bluetooth (24 bytes are obtained), or calculate in advance all phases of the movement for all occasions and put in the table by which to step.


Sources
We do not plan to publish, because there will be people (more precisely, not people) who will correct the code, improve it and sell it as their own. And no answer or greetings. More and karma spoiled out of envy. Already passed, no longer want. Another thing that repels the fact that the robot can be used for opposing purposes. Therefore NO.

Goals, Plans
The main goal, in general, is achieved: the robot walks, almost dancing. For now, we will probably take a timeout until autumn, so that the brain can rest. There just mini-cameras will come, we will put. Now, in a hurry, we will probably transfer the control program to the android, in order to control not from the laptop, but from the phone with the touchscreen. Thoughts on further application (if the hands reach) are as follows: 1) To put a sonar on it on a servo and scan around, send data to a computer, it will build a map of the area (as in games) and accordingly send the robot further; 2) Since the battery is small - it makes sense to teach it to self-charge, i.e. to attach two contacts to the plinth, and so that it connects to them. It will be found either by ultrasound or by infra-light or 3) You can teach to walk along the white line drawn on the floor, for which you need to analyze only one line from the frame from the onboard camera, looking forward and downward; 4) If you put your feet under you, like a cat / dog, then you can go through narrower corridors than with your paws spread out. In fact, this is another method of displacement, another math. Check in September.

Good night and good luck ...

Source: https://habr.com/ru/post/228969/


All Articles