Categories
Uncategorized

LinkDump 2019-02-28

link-dump-4

It’s that time! Time for another LinkDump post. It’s basically a blog post that links to other things on the World Wide Web, and often has little to no commentary. Every now and then I’ll just post some links to things I’ve read or looked at or need to check out in the future, or just want to share.

Categories
Uncategorized

App Testing with the uArm

uarm-touch-ipad

One of the end effectors included with the uArm Swift Pro is a stylus which can be used with a tablet instead of a human finger, which is handy, because robots don’t have human fingers.

Over at Brinn Labs we’ve been trying to diagnose this problem we have with an iPad in a kiosk that seems to be going to a black screen. I’ve already done a few tests to diagnose it, but one of the tests I couldn’t easily do was stress test it by running through the app over and over again… enter our robot overlords!

blockly-blocks

In uArm Studio you can use a “Blockly” interface to program the movements. If you’ve used Scratch or another block-based programming interface, Blockly is one of those.

Blockly is easy to use, but can also be frustrating if you know how to write code. I wanted to walk through this exercise just using Blockly. Now for a non-coder, this is a great, easy to use interface… for someone who loves code, not so much.

blockly-javascript

And then I clicked on the Javascript view. Aha! Real code! But! You cannot edit it… it appears to be read-only, or just a rendering of the code you created using the block interface. That’s not fun.

blockly-xml

But wait! There’s an XML view… featuring XML you’d probably never write. But the XML version is important because that’s how uArm Studio stores the file on disk… in XML format. I haven’t tried editing the XML yet to see what uArm Studio does with it, but it might be worth a try.

To be honest, I’m much more interested in the uArm Python SDK which looks like something I’d enjoy digging into. (Especially with my new-found love of Python.)

Anyway, here’s a video of the uArm Swift Pro in action touching the iPad to work through the app… and after that is a time lapse from a camera that was running over the weekend to make sure nothing went wrong.

Categories
Uncategorized

Python Image Resizing

python-editing

My journey to Python continues. I’ve been playing on a Raspberry Pi project and it’s been working quite well! In the meantime, I’ve still got work to do, and lately (at work) I’ve had to deal with a lot of screenshots that get emailed, and when I started it was just a few, so I’d open the PNG files in Photoshop, resize them, and save them out as compressed JPG files. This started to get painful as I had to do more of them, and as a fun little comparison, while Photoshop CS5 runs quite fast on my 2012 MacBookPro, Photoshop CC 2019 is terrible on my 2017 iMac.

Side-rant: I hate Adobe’s forced subscription model, and Photoshop CS5 does most of what I need to do. Adobe’s Creative Cloud is caught in an forced update cycle where they have to add things, many of which may not be useful (to you) and are probably resource hogs, too. CC 2017 was quite a bit faster than CC 2019. (End of rant!)

Anyway, back to Python. Since I’m often looking for excuses to write Python lately, I checked to see if there was an easy way to resize images and convert from PNG to JPG. There sure is, and it took me just a few minutes to find some working code. This sped up my screenshot situation quite a bit! The one hiccup in finding Python example code online is that it’s often for Python 2.x instead of Python 3.x and needs some minor adjustments.

dropscript

While typing Python commands in the terminal was working fine, I’ve been around the block before with this sort of thing… In fact, in 2012 Wilfredo Sanchez put out DropScript and I used it for many Perl scripts to make my life easier. Luckily I wasn’t the only fan of DropScript, and there’s a modern version of DropScript! Oh yeah, so the way it works is that you can take a script (written in whatever language) and make it run when you drop files on it. It’s a customizable droplet. I remember I had a big folder full of droplets for web development and file management. It was handy.

So it took another 10 minutes, but I converted my Python script to a DropScript application so now things are even faster… drag and drop, no typing!

I still need to make my Python a little more accepting. For instance, I have to drop files on it, but it would be nice to be able to drop a folder full of files onto it. Baby steps, right? I’ll keep hacking away at Python as I get time. And I will admit, the cleanliness of Python is sort of nice…

Categories
Uncategorized

uArm Swift Pro Plotting

urm-swift-pro-00

We recently got a uArm Swift Pro robot arm at Brinn Labs and I’ve been putting it through its paces. It comes with software called uArm Studio that lets you do a lot of things, but for this post I’ll focus on drawing (or “plotting”) using a pen.

heart-bw

One of the tools I’ve used in the past with the Egg-Bot was StippleGen2 from our friends at Evil Mad Scientist Laboratories. StippleGen2 is a program written in Processing that takes an image and converts it into a series of lines, or more specifically, a single line, which is suitable for plotting.

Above is the image I started with, an “8-bit heart” as I call it. It’s a simple black and white image of a low-res heart. (Great for Valentine’s Day, right?)

heart-tsp

After running the heart through StippleGen2 and choosing the appropriate complexity of the line drawing I wanted, I saved out the file as an SVG format vector file. Perfect for plotting. (In fact, since it’s a single line, the z axis never has to move up once it starts.)

uarm-studio

I fired up uArm Studio and chose the Draw/Laser feature, and then loaded in the SVG file. I did have to scale it up a bit, as I still don’t have the exact dimensions I should use for artwork in uArm Studio.

Once the file is loaded, you hit start and there’s a step where you set the z axis so it know where the pen hits the paper. At this step, I wish there was a little more control over how the z axis moves. I think the smallest increment is one millimeter, and I think it should be smaller. (Most CNC software has some adjustment to how much you move things, so I can see adding in 0.5mm and perhaps 0.2mm as well.)

urm-swift-pro-01

While the uArm Swift Pro is awesome, I’m still going to be a little critical… One of the issues I’ve come across in the Draw/Laser part of the software is that the speed seems to be hard-coded, with no way to adjust it to go faster (or slower.) As someone who understands G-code and how CNC machines work, I found this a little annoying…

urm-swift-pro-03

So I set about to find a solution. I first posted a message on the forum, but then Chinese New Year hit and it seemed as though it would be two weeks (or more) before I got an answer. I had dug around and found that the G-code created by the Draw/Laser part of the software generates a file and drops it at ~/uarm/Temp/files/gcode/tmp_pen.gcode and I assumed that by editing the feedrate in that file, I could speed things up… I was right!

urm-swift-pro-04

My first attempt was to connect with the arm using Universal Gcode Sender, which in this case was not universal, and failed to properly talk to the arm. I dug around a bit more and found simple_stream.py which is a Python script to stream G-code to a device. Sadly, it was not compatible with Python3, but luckily, I’ve been writing a lot of Python lately, so I fixed it.

After I got it working (that is, after much hacking at the original code) I found that I could easily speed up the drawing to half the time. In this case, 5 minutes with the Python script versus 10 minutes with uArm Studio. For TSP art, great precision tends not to matter too much, and I think I could speed it up even more.

I’ll work on cleaning up my Python code and seeing if I can get it online in case others want to muck around with it.

Update: Code is here: https://github.com/raster/uArm-GCode-Streamer