Drawing LEGO Bricks in LaTeX

Sometimes the star align and bring together several of your passions. I love LEGO and I love LaTeX. Thanks to Sam Carter and his TikZbricks package, you can now draw LEGO bricks directly in LaTeX. Let’s start with a simple example of drawing a single 2×4 brick:

\documentclass[a5paper]{article}
\usepackage{tikzbricks}
\begin{document}
\begin{tikzpicture}
   \brick{4}{2}
\end{tikzpicture}
\end{document}

This will be rendered as:

TikZbricksLEGOLaTeX01

It is possible to build whole models with this package. The LEGO company created its first augmented reality puzzle game that used a mobile app in 2011. It was called Life Of George. This seems like a perfect example for putting TikZbricks to the test.

\documentclass[a4paper]{article}
\usepackage{tikzbricks}
\definecolor{lego-white}{rgb}{0.95, 0.95, 0.96}
\begin{document}

\begin{wall}
    \wallbrick[color=black]{2}{1}
    \addtocounter{brickx}{1}
    \wallbrick[color=black]{2}{1}
    \newrow
    \wallbrick[color=blue]{1}{1}
    \addtocounter{brickx}{2}
    \wallbrick[color=blue]{1}{1}
    \newrow
    \wallbrick[color=blue]{4}{1}
    \newrow
    \addtocounter{brickx}{-1}
    \wallbrick[color=lego-white]{1}{1}
    \wallbrick[color=red]{4}{1}
    \wallbrick[color=lego-white]{1}{1}
    \newrow
    \addtocounter{brickx}{-1}
    \wallbrick[color=red]{1}{1}
    \wallbrick[color=red]{2}{1}
    \wallbrick[color=black]{1}{1}
    \wallbrick[color=red]{1}{1}
    \wallbrick[color=red]{1}{1}
    \newrow
    \addtocounter{brickx}{-1}
    \wallbrick[color=red]{3}{1}
    \wallbrick[color=black]{1}{1}
    \wallbrick[color=red]{2}{1}
    \newrow
    \wallbrick[color=lego-white]{4}{1}
    \newrow
    \addtocounter{brickx}{-1}
    \wallbrick[color=lego-white]{2}{1}
    \wallbrick[color=black]{1}{1}
    \wallbrick[color=lego-white]{1}{1}
    \wallbrick[color=black]{1}{1}
    \newrow
    \addtocounter{brickx}{-1}
    \wallbrick[color=yellow]{1}{1}
    \wallbrick[color=lego-white]{2}{1}
    \wallbrick[color=yellow]{3}{1}
    \newrow
    \wallbrick[color=yellow]{4}{1}
\end{wall}

\end{document}

This will be rendered as:

TikZbricksLEGOLaTeX02

There are many more options, such as chaning the perspective and size of various components. But we will leave this for now and simply enjoy this moment.

Automatic cross referencing in LaTeX

In technical and scientific writing it is common to references figures, tables and equations in the text. The figure, for example, would have a caption that reads “Figure 1: Robot at the beach”. In the text we then want to reference this figure as (see Figure 1). For far too long I made my own life too difficult by not taking advantage of some of the more advanced featurs of LaTeX. Here are some leasons I learned.

It would be possible to hard code the reference in the text by writing (see Figure 1), but this is not recommendet since the numbering might change when you add more figure or tables . Hence we use dynamic referencing by giving each figure or table a label which we reference using the \ref{label} command. In the text we would write (see Figure \ref{fig:robot}). Here is a complete example:

\documentclass[a5paper]{article}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}

\lipsum[2] (see Figure \ref{fig:robot})

\begin{figure}[h]
\includegraphics[width=0.5\linewidth]{robot.jpg}
\caption{Robot at the beach}
\label{fig:robot}
\end{figure}

\end{document}

This will be rendered to PDF as:

Cross_referencing_documentation_01

The first, and possibly most effective time safer, is to use the \autoref{label} feature of the hyperref package. You should probably always use this package anyway for other reasons by adding \usepackage{hyperref}.

\documentclass[a5paper]{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{document}

\lipsum[2] (see \autoref{fig:robot})

\begin{figure}[h]
\includegraphics[width=0.5\linewidth]{robot.jpg}
\caption{Robot at the beach}
\label{fig:robot}
\end{figure}

\end{document}

This will automatically add the appropriate type of reference. For the figure type, it will add “Figure” to the text for you. This will be rendered to:

Cross_referencing_documentation_02

This also works for tables and equation. I wished I had know this little feature much earlier.

New HRI Podcast: Aldebaran Again

I recorded a new episode of the Human-Robot Interaction Podcast:

Aldebaran Again – Is this the end of Pepper?

Softbank Robotics sold their Nao and Pepper robots to the United Robotics Group (URG) which reversed the name of this business back to its orginal “Aldebaran”. In this episode Dwain Allan and I discuss the uncertain future of Nao and Pepper based on direct correspondence with URG. We try to answer the question whether you should still invest in this robotic platform. Is Aldebaran another zombie robotic company?

Optimal Price For Swimming In Christchurch For Disabled Swimmers

The Christchurch City Council changed its fee structure for swimming pool admission as of October 1st, 2022. There are some important changes for disabled swimmers who have a Hāpai Access card.

While there is a 25% discount for annual pool membership, there is a 50% discount for casual entry fees. The later includes multi-visit pass. The question now is, how often do you need to swim per week before the annual membership becomes the cheaper option.

Annual Entry Costs based on number per weekly visits.

The graph above shows that you need to swim around 3.25 times on average per week before the annual membership becomes cheaper.

While I applaud the Christchurch City Council for increasing the discount for casual fees from 25% to 50%, I would have appreciated it even more if they had extended this discount to the annual membership. Active swimmers will be forced to give up their annual membership if they swim more than three times a week. Normally, discounts are setup so that the more you use a service, the higher the discount becomes.

No other discount category, such as Community Services Card or Super Gold Card, has this inconsistency.

For abled visitors with no discount or visitors with a 25% discount (Community Services Card or Super Gold Card), already visiting the pool more than twice a week justifies an annual pool membership:

 

It is unclear why the Christchurch City Council wants to make going to the pool for disabled swimmers more of a hassle than for others. Annual memberships is quick an easy. No need to constantly refresh the cards or pay every time at the counter.

It would be great if the CCC would make our live not only more affordable, but also easier.

Mechanical Keyboards Guide

A short list of the best mechanical keyboards.

Once you typed on a mechanical keyboard, you never want to go back to the stock rubber dome keyboards that come with most computers. And I am not even a gamer. I just spend a lot of time in front of computers. Even Logitech has entered the mechanical keyboard market aside from gaming with their MX Mechanical. It has become its own hobby, with enthusiast spending many hours on selecting, assembling, modifying keyboards. It is another rabbit hole. “How deep?” you ask? Just check out these YouTube Channels.

Instead of spending my own thousands of dollars, I decided I should rather eatable you to do it for me. So here we go, a list of my favourite keyboards. I have settled on the 75% form factor as the most suitable for me.

Matias Mini Tactile Pro

This Matias Mini keyboard is heavily inspired by the good old Mac keyboards and it is one of the fews that have Alps switches. Continue reading “Mechanical Keyboards Guide”