If you’ve ever tried to control MKS SERVO42D or SERVO57D stepper motor controllers from Python, you know the pain. These controllers transform regular stepper motors into servo-like systems with closed-loop feedback, position control, and CAN communication. They’re affordable and capable, but the lack of a proper Python library meant you were stuck writing raw CAN commands or wrestling with incomplete code snippets scattered across forums.
Not anymore.
I just released mks-servo-can — a complete Python library that finally gives these motor controllers the control interface they deserve.
This webside already has an Advanced QR code Generator, but as the name says, it only generates QR codes. The nice thing about QR codes is that anyone can read them directly from the smartphone camera app (at least modern ones). However, there are other codes that you need to install an app only for reading them. I’m not a big fan of installing “yet-another-phone-app”, so I decided to fix this problem creating “yet-another-web-app” called Barcode Tool - Generator & Scanner!
Last week, I saw this post on LinkedIn where Carlos Argueta was showing some interesting robotics perception experiments that were running on Google Colab.
I mentioned in the comments that I had, in the past, managed to run Gazebo on Google Colab. So, I decided to find that old notebook and here it’s:
I was testing some ideas at home and I needed to create a QR code. I searched online and found a few websites, but they were full of ads and I was not sure what they were doing with my data. So, I went to my “friend” Gemini and asked it for a single webpage QR code generator. After a few iterations, I got something quite interesting!
After spending years using weird magic spells to launch a graphical file manager (e.g. nautilus) from the command line without it printing a lot of rubbish, I finally learned that xdg-openjust works!
Use xdg-open . and you will have your graphical file manager PLUS a clean terminal!
In the last weeks I’ve been reading a lot of papers. Usually I open an online document (e.g. google docs) and write down my notes there while I read a paper. However, I also like to highlight a pdf as I read it, but that forces me to download the pdf and keep the final file. Therefore I was trying to find a way to annotate a pdf directly from my web browser… and that’s the motivation that made me hack together my very own arxiv-highlighter!
Today I was trying to implement, using PyTorch, the Focal Loss (paperswithcode, original paper) for my semantic segmentation model. Focal Loss is “just” Cross Entropy Loss with some extra sauce that allows you to adjust (γ) how much weight you give to examples that are harder to classify otherwise your optimiser will focus on the easy examples because they have more impact on the loss. To save time, I didn’t even considered writing my own code (although the focal loss is fairly simple), and I went directly to google where I found this nice example:
Today I needed to check some connections in the PCB of my ST-Link V2 clone because I wanted to add the trace support following the nice explanations from here. However, my old brandless digital microscope (you know, they all look the same and come in a blue box…) refused to work. dmesg helped me find some repeated error messages (Failed to query (GET_DEF) UVC control 4 on unit 1 or Failed to query (GET_MIN) UVC control 4 on unit 1) and a little bit of google-fu did the rest. I found my system was suffering from a problem with libwebcam0 and uvcdynctrl and the log file /var/log/uvcdynctrl-udev.log was already at 68GB (?!?).
I learned this is a super old bug (first message is from 2011!) and it can slow down your system to a halt. Using apt show and the very useful apt-rdepends I noticed libwebcam0 and uvcdynctrl just depended on each other… so following the suggestion and removing libwebcam0, uvcdynctrl and uvcdynctrl-data solved my problem (sudo apt remove libwebcam0 uvcdynctrl uvcdynctrl-data).
I hope this blog post can help other people avoid spending time on google to solve the same 11-year-old problem…
UPDATE (29/01/2023): Ubuntu Cheese sometimes is too picky and stops the stream with an error message, so I suggest using ffplay. First, connect your microscope (webcam) and check the devices available (v4l2-ctl --list-devices):
In my situation, the microscope was the USB2.0 UVC PC Camera. You can get extra info with ffmpeg -f v4l2 -list_formats all -i /dev/video2. Finally, just use ffplay /dev/video2.
Affiliated links
If you want to support my work, you can buy an equivalent USB microscope on Amazon (or anything else, really) using the affiliated link below:
I am always using Google Colab, but in many cases I also need to install something using apt-get. The problem was that sometimes you need to add a new repository, update, install… then your notebook becomes full of text and that eats your memory (locally too as the browser needs to render that after all). So, today I found a nice post explaining the reason why the -qq argument may still leave some bits of text behind. You should go there and read it by yourself, but I will copy some info here in case that website disappears.