Make Your Python Prettier With Decorators

Many Pythonistas are familiar with using decorators, but far fewer understand what’s happening under the hood and can write their own. It takes a little effort to learn their subtleties but, once grasped, they’re a great tool for writing concise, elegant Python.

This post will briefly introduce the concept, start with a basic decorator implementation, then walk through a few more involved examples one by one.

Continue reading “Make Your Python Prettier With Decorators”

Single-Rotor Drone: A Thrust-Vectoring Monocopter

We’re not entirely sure what to call this one. It’s got the usual trappings of a drone, but with only a single rotor it clearly can’t be called by any of the standard multicopter names. Helicopter? Close, but not quite, since the rotor blades are fixed-pitch. We’ll just go with “monocopter” for now and sort out the details later for this ducted-fan, thrust-vectored UAV.

Whatever we choose to call it — builder [tesla500] dubbed it the simultaneously optimistic and fatalistic “Ikarus” — it’s really unique. The monocopter is built around a 90-mm electric ducted fan mounted vertically on a 3D-printed shroud. The shroud serves as a mounting point for the landing legs and for four servos that swivel vanes within the rotor wash. The vanes deflect the airstream and provide the thrust vectoring that gives this little machine its control.

Coming to the correct control method was not easy, though. Thanks mainly to the strong gyroscopic force exerted by the rotor, [tesla500] had a hard time getting the flight controller to cooperate. He built a gimballed test stand to work the problem through, and eventually rewrote LibrePilot to deal with the unique forces on the craft and tuned the PID loops accordingly. Check out the results in the video below.

Some attempts to reduce the number of rotors work better than others, of course, but this worked out great, and we’re looking forward to the promised improvements to come.

Continue reading “Single-Rotor Drone: A Thrust-Vectoring Monocopter”

Science Shows Green Lasers Might Be More Than You Bargained For

This may come as a shock, but some of those hot screaming deals on China-sourced gadgets and goodies are not all they appear. After you plunk down your pittance and wait a few weeks for the package to arrive, you just might find that you didn’t get exactly what you thought you ordered. Or worse, you may get a product with unwanted bugs features, like some green lasers that also emit strongly in the infrared wavelengths.

Sure, getting a free death ray in addition to your green laser sounds like a bargain, but as [Brainiac75] points out, it actually represents a dangerous situation. He knows whereof he speaks, having done a thorough exploration of a wide range of cheap (and not so cheap) lasers in the video below. He explains that the paradox of an ostensibly monochromatic source emitting two distinct wavelengths comes from the IR laser at the heart of the diode-pumped solid state (DPSS) laser inside the pointer. The process is only about 48% efficient, meaning that IR leaks out along with the green light. The better quality DPSS laser pointers include a quality IR filter to remove it; cheaper ones often fail to include this essential safety feature. What wavelengths you’re working with are critical to protecting your eyes; indeed, the first viewer comment in the video is from someone who seared his retina with a cheap green laser while wearing goggles only meant to block the higher frequency light.

It’s a sobering lesson, but an apt one given the ubiquity of green lasers these days. Be safe out there; educate yourself on how lasers work and take a look at our guide to laser safety. Continue reading “Science Shows Green Lasers Might Be More Than You Bargained For”