~ / cmdr2

projects: freebird, easy diffusion

hacks: carbon editor, torchruntime, findstarlink

  • #car
  • #simulation
  • #game
  • #drs
  • #featured

Continuing on the race car simulator series. Last week, the “effective tire friction” calculation was implemented, which modeled the grip at the point of contact between the tire and the road surface. This intentionally did not take into account the vertical load (or any other forces), since the purpose was limited to calculating the “effective” friction coefficient based on the material conditions. The next step was implemented yesterday, which calculates the effective force the tire will apply on the wheel axle, in reaction to the torque applied by the engine on the wheel axle. That reaction force will cause the car to move forward. It also factors in the existing inertial force (i.e. if the car is already moving) in order to model sideways slip (e.g. for drifting).

  • #car
  • #simulation
  • #game
  • #drs
  • #featured

Started building a car simulator, focused on F1-like car characteristics. It’s reasonably detailed in terms of simulation, but is ultimately meant for games/machine learning, so it approximates some of the behavior. It isn’t physically accurate. The first piece is the car simulator itself - https://github.com/cmdr2/car-sim. This module is a numbers-only simulation, i.e. it doesn’t handle visualization, interaction or anything that’s not related to the simulation of vehicle components. I’ve started from the point of contact between the tire and the road, and will work backwards from that. I’ve got a basic tire friction model working, which computes the “effective friction” against the track surface, by taking into account: tire material, tread amount, road type, road condition, tire width, tire hardness, tire pressure, tire temperature, tire wear and tire camber.

  • #blog-engine
  • #dropbox
  • #aws
  • #lambda
  • #s3
  • #featured

Finished the blog-agent project for now. The blog is now live, and the code is up at the GitHub project. In summary, it lets me write my notes as text files in Dropbox, and it automatically formats and publishes it as a blog on S3. It runs by triggering an AWS Lambda function via a Dropbox webhook. It’s built purely for a workflow that I’m very used to (writing notes in text files, one file per month, posts separated by two hyphens padded with line breaks). But making this a public project will probably force me to keep things well-documented (so that I can fix things easily, if they break in the future).

  • #blog-engine
  • #dropbox
  • #aws
  • #lambda
  • #s3
  • #featured

Published the first version of the Dropbox-based blog that gets mirrored on S3. The GitHub project is live, and still has quite a few bugs and missing pieces. How does it work? It takes the original posts from Dropbox and automatically publishes them in other places (after formatting them). As the author of those notes, the only place I’m concerned about is my Dropbox folder with my text files. But the agent then goes and mirrors the writing in different places automatically, and I never need to think about that process at all.

  • #blog-engine
  • #dropbox
  • #aws
  • #lambda
  • #s3
  • #featured

tl;dr - Today, I fixed a few bugs in Easy Diffusion and Freebird/VR Puppetry. And started building a blog engine that automatically takes my text file blog-posts from Dropbox and publishes them as a static blog on S3. I’ve already been writing a private blog for 10+ years as text files on Dropbox, and like it that way. Fixed a few bugs reported in Easy Diffusion 3.5’s beta. And investigated an issue in VR Puppetry and fixed a separate bug in bl_xr for VR Puppetry and Freebird. And did a bit of support work for Easy Diffusion and Freebird/VR Puppetry.

  • #stable-diffusion
  • #c++
  • #cuda
  • #easydiffusion
  • #lab
  • #performance
  • #featured

// Cross-posted from Easy Diffusion’s blog. tl;dr - Today, I worked on using stable-diffusion.cpp in a simple C++ program. As a linked library, as well as compiling sd.cpp from scratch (with and without CUDA). The intent was to get a tiny and fast-starting executable UI for Stable Diffusion working. Also, ChatGPT is very helpful! Part 1: Using sd.cpp as a library First, I tried calling the stable-diffusion.cpp library from a simple C++ program (which just loads the model and renders an image). Via dynamic linking. That worked, and its performance was the same as the example sd.exe CLI, and it detected and used the GPU correctly.

  • #easydiffusion
  • #ai
  • #lab
  • #performance
  • #featured

// Cross-posted from Easy Diffusion’s blog. tl;dr: Explored a possible optimization for Flux with diffusers when using enable_sequential_cpu_offload(). It did not work. While trying to use Flux (nearly 22 GB of weights) with diffusers on a 12 GB graphics card, I noticed that it barely used any GPU memory when using enable_sequential_cpu_offload(). And it was super slow. It turns out that the largest module in Flux’s transformer model is around 108 MB, so because diffusers streams modules one-at-a-time, the peak VRAM usage never crossed above a few hundred MBs.

  • #ar
  • #vr
  • #xr
  • #freebird
  • #webxr
  • #featured

// Cross-posted from Freebird’s blog. Wrote a WebXR drawing tool with passthrough (i.e. AR overlay), in order to draw lines over real-world surfaces. It’s pretty handy! Uploaded it as Freebird Lite. It proved itself useful yesterday, since I could sketch lines around the house to plan different fittings and show the ideas to others (using the headset). Since it’s just a website in a browser, it doesn’t require any installation. And it works on all the compatible 6 DoF headsets.

  • #pyscript
  • #starlink
  • #featured

Got !FS working in the browser using PyScript! It’s pretty cool - python, skyfield, numpy etc running inside the browser, fully client-side. And I didn’t have to modify the code, it just works. And most importantly, it performed pretty decently. Acceptable performance. The performance on desktop browsers is pretty good. It’s a bit slower on mobile (but acceptable for my purpose). sgp4 has some C-bindings, so I had to compile to WebAssembly using Emscripten, and made a .whl (wheel). skyfield is pure python, so I made a wheel for that as well using python -m build.

  • #hydroponics
  • #plant
  • #farming
  • #electronics
  • #featured

Built a simple hydroponics growing container with an ESP 8266. Code at https://github.com/cmdr2/farm The seeds have been planted - 18 tomato seeds spread across 6 planters (aka plastic egg carton with a plastic wrap to build the humidity). For the plumbing system, I’ve gone for a simple design. It has two tanks, stacked vertically over each other. A motor switches on at preset intervals, pumps the nutrient solution from the lower tank for a preset duration. A smaller hole (compared to the inlet pipe) in the upper tank (containing the plant roots) drains the water back to the lower tank. For fun, an emergency cut-off could’ve be built at the top of the upper tank (using a water-level sensor). But for now, that’s not in scope.