On "Bicycle"
Added 2023-03-28 16:20:44 +0000 UTCTopic Selection
"Something about bicycles" has always been on the list of ideas to write about one day, and this topic even got requested by one of my Patrons over a year ago, but at the time it didn't feel that compelling, mostly because I'm actually not much of a bike enthusiast myself.
I started thinking about bicycles again right around the time I finished working on "Sound", but I only started researching the topic in late November. When I first considered the subject, I was primarily interested in bicycle frames and how they carry different loads. I always wanted to visualize something using finite element method, and a bicycle frame was the perfect opportunity for that.
I then got into the topic of bicycle stability, which turned out to be fascinating, especially since it's covered reasonably well with approachable research papers. Bicycle stability and bicycle frame analysis needed to be prefaced with some explanation of forces acting on bicycles in general, so that created the need for the whole large part related to bicycle motion.
To introduce the concept of forces and moments I needed a more lightweight approach, and thus the section on wooden boxes was born. The cherry on top were the spoked wheels and their design – before this article I had no idea how well thought-through their design is.
All in all, the article suffered from a bit of a feature creep, but I'm happy with the topics I covered – the unifying theme of forces acting on objects ties everything together well.
New Techniques
While I typically use a CAD app for designing mechanical parts for my articles, the rider required a new approach. This was actually the first time I ever modeled and rigged a 3D character model, and Blender was the obvious choice. I followed a YouTube tutorial, and the original plan was to create more of a cartoonish stickman, but it clashed with a fairly realistic representation of the bicycle, so I ended up designing a more anatomically correct human. Interestingly enough, to save download bandwidth I only exported half of the human model:

This then required a bit more gymnastics to correctly render the rider in different non-symmetrical poses. To make the rider pedal and hold steer realistically, I needed to use inverse kinematics – this ensures that the feet stick to the pedals and the hands stick to handlebars during all the motions. I had some theoretical college experience solving this problem for robotic arms, but I was a bit rough on the details and I ended up writing a simple gradient descent solver. By tweaking the error function I could easily penalize some unwanted configurations, e.g. elbows being bent incorrectly:

I'd like to revisit this topic again in the future to see what proper modern techniques in this area look like.
Another big subproject was the finite element method solver for the bicycle frame. The simplest analysis of frames is easy in that regard, as they can be expressed using one dimensional elements that only have length – these can represent the tubes of the frame. A series of lectures from CalPoly was very helpful here. My big concern was the computational cost of solving these models in a browser, but it turned out to be a non issue for the small scale simulation of the frames.
Design
I had a really hard time getting the lighting to look right on the rider, and after some trial and error I opted for a toon shaded. That simple shading not only helped to deemphasize the rider in favor of the bicycle, but it also removed some of the "naked person" effect – at least to my eye, the rider looks more like an abstract, emoji-yellow silhouette.
For many of the 2D demonstrations I also put the rider against a green landscape. It made those demos looks much more like an illustration as opposed to a more austere version without any background. The entire landscape is rendered with a single shader, with a sprinkle of "smokes and mirrors" to make it more alive. For example, the green hills are just sine waves moving at different speeds to create a parallax effect.
It also took a while to choose the color scheme for the bicycle, but I find the light blue frame and tan rims quite pleasing, although probably not very dirt-proof in practice.
Simulations
Throughout the presentation, it was sometimes difficult to find the right balance between having correct physical simulations of different behaviors, as opposed to just crafting some animation that just qualitatively looks correct. It ended up being a mix of both.
For example, the braking and steering simulations are reasonably realistic, at least to whatever extent I modeled the physics correctly. On the other hand, things the front wheel gyroscopic effect in a leaning bicycle is not simulated at all – I just convincingly turn the bicycle upright. More accurate physical simulations of bicycles get fairly large, but the simple simulations of tire behavior and rudimentary dynamics ended up looking surprisingly lifelike.
One of the biggest surprises for me was actually the "hero" demonstration on top of the article. I knew I didn't want to give the user direct control over the handlebars, as it's very difficult to steer a bike by controlling the angle or torque on the handlebars with a slider. That slider actually controls the desired lean angle, and a super simple controller adjusts the steer angle to get to that desired lean without the bicycle falling to the ground – I'm still astonished that this actually works that well.
Final Words
Without a doubt, this was the most demanding article I've written so far. At over 15000 words and 118 demonstrations, it took me almost 4 months worth of weekends and evenings to finish this post. While not all of that free time was available for this work, I think it still firmly stands in the "took too much time" category.
When I start working an article it often feels that I won't have enough interesting material to fill in the page, but time and again I've proved myself wrong, so next time I'll perhaps know better to stop earlier, and just let the thing settle.
For now I think I scratched an itch of presenting something from the realm of mechanics and mechanical engineering, and I'm satisfied with the result.
Comments
same here! joined Patreon to support you. Your interactive articles have been the best way for me to learn and understand a topic really well. Please continue! I hope we can one day make a school that teaches all of their courses with such interactivity and plain language.
Armin Mahmoudi
2023-11-15 03:34:44 +0000 UTCI joined Patreon for you. Thank you!
Markus
2023-03-31 08:52:10 +0000 UTCI probably won't want to touch anything related to Newtonian mechanics for a while, but I would read an article about figure skating if you end up writing one!
Bartosz Ciechanowski
2023-03-30 04:43:35 +0000 UTCThank you for this impressive work. Just yesterday I was checking back some of your previous posts to get some inspiration/ideas of how to make exploratory explainers for the science of figure skating – they clearly will involve simulations with non-holonomic constraints, human body animations and biomechanics. So seeing this incredible work with bicycles today was a bit serendipitous. Any chance you might be interested in exploring the topic of figure skating, by the way? :) Not jumping (that's well explained in every pop-sci skating article), but the actual skating of figures. Science and information on that is super scarce. I couln't find any good books like ones on science of bycicles. I now study from some books from 1897 – surprisingly they have a good grasp on the mechanics of skating, and operate with phrases like "epicycloid curves".
Ivan Danyliuk
2023-03-29 08:24:50 +0000 UTC