<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Léonard Urban</title>
    <link>https://writefreely.ch/leonardurban/</link>
    <description>Here I post longer form content. Main mastodon account: @leonardurban@tooting.ch</description>
    <pubDate>Sun, 13 Sep 2026 07:53:45 +0200</pubDate>
    <item>
      <title>Fripuck devlog n°5: Lua is moon in portuguese</title>
      <link>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg5-lua-is-moon-in-portuguese</link>
      <description>&lt;![CDATA[Banner of the e-puck landing on a lua moon&#xA;&#xA;These last two weeks, I&#39;ve been busy working on the radio module of the e-puck2, specifically embedding a Lua VM onto its ESP32 chip, which handles remote communication. This work is part of my Fripuck project, my bachelor thesis aimed at adapting the e-puck2 software to better suit the needs of the University of Fribourg.&#xA;&#xA;In this post, I&#39;ll explain why I wanted to introduce a Lua VM into the project, present the API, and talk about the C implementation.&#xA;&#xA;Why add a VM?&#xA;&#xA;First, a quick reminder of who this software is for. At the University of Fribourg, the e-puck2 robot is used to introduce students to mobile robotics. Fripuck is the name I&#39;ve given to the new software I&#39;m writing for the platform.&#xA;&#xA;These robots are currently controlled remotely over Wi-Fi via a Python API built by a previous student during their own thesis. While that was a huge step up from the raw C API used before, remote control still comes with inherent drawbacks, either due to API abstractions or issues fundamentally linked to wireless telemetry.&#xA;&#xA;Adding an on-board Lua VM allows students to program the robot directly without needing a continuous network connection. This allows them to investigate network latency, resource constraints, and the classic problem of dividing work between on-device and off-device execution. Scripting behavior in Lua is also vastly simpler than setting up toolchains, compiling C, and flashing new firmware to the robot, a high hurdle for first-year students who might be completely new to programming.&#xA;&#xA;It&#39;s worth noting that the Lua scripting engine isn&#39;t meant to replace the remote Python API entirely. Remote controlling remains the primary way to interact with the robot,  especially since Lua on an embedded chip isn&#39;t practical or fast enough for heavy sensor data analysis. Instead, the VM acts as a complementary tool: ideal for low-latency tasks, reactive behavior, or simple on-device configuration.&#xA;&#xA;Why Lua?&#xA;&#xA;Choosing Lua over other scripting options was a deliberate choice on my part. It gets its fair share of criticism: array indices famously start at 1, it is far less ubiquitous than Python, and its single complex data structure, the table, takes some getting used to.&#xA;&#xA;However, Lua has its advantages in embedded contexts: it is easy to integrate into C programs via its clean, well-documented C API, while remaining fast, flexible, and lightweight. Compared to other embeddable languages like MicroPython, Lua is generally less RAM-hungry and features a cleaner architecture for constrained hardware. I&#39;ll also admit to a personal fascination with the technology, and this project felt like the perfect sandbox to explore it thoroughly.&#xA;&#xA;(If you are curious about Python support, GCtronic, the makers of the robot, maintain an official MicroPython port of the e-puck2 software).&#xA;&#xA;Architecture and API&#xA;&#xA;The two Lua environments I am most familiar with are game engines (like PICO-8 or LÖVE) and Neovim. From them, I borrowed two common patterns: update loops and hooks.&#xA;&#xA;Update Loops &amp; Hooks&#xA;&#xA;Update loops are standard in game engines and other frameworks. I chose to expose two: init() and update(), following PICO-8 terminology. Students write an init() function for startup tasks, followed by an update() loop that runs at roughly 20Hz (~50ms delta time).&#xA;&#xA;Alongside the loop, students can register hooks, callback functions triggered immediately when an event occurs, such as a sensor read or an incoming command from a remote controller.&#xA;&#xA;Here is what a complete user script looks like:&#xA;&#xA;-- Declare local variables for fast lookup&#xA;local lastside = &#34;center&#34;&#xA;local side = &#34;center&#34;&#xA;&#xA;function init()&#xA;    -- Register a hook to the ground sensors to track a black line&#xA;    robot.on(&#34;telemetry:ground&#34;, function(ground)&#xA;        -- Lua arrays start at 1!&#xA;        local difference = ground[1] - ground[3]&#xA;        &#xA;        if math.abs(difference)   20 then &#xA;            if difference &lt; 0 then side = &#34;left&#34;&#xA;            else side = &#34;right&#34; end &#xA;        else side = &#34;center&#34; end&#xA;&#xA;        if side ~= lastside then &#xA;            print(&#34;Black line on the &#34; .. side .. &#34; side.&#34;) &#xA;        end&#xA;&#xA;        lastside = side&#xA;    end)&#xA;end&#xA;&#xA;local counter = 0&#xA;local totaldt = 0&#xA;&#xA;-- Runs every 50ms; prints average delta time every 100 iterations&#xA;function update(dt)&#xA;    counter = counter + 1&#xA;    totaldt = totaldt + dt&#xA;    if counter   100 then &#xA;        local average = totaldt / counter &#xA;        print(&#34;Over 100 iterations, the average dt is: &#34; .. average .. &#34;s.&#34;)&#xA;        counter = 0&#xA;        totaldt = 0&#xA;    end&#xA;end&#xA;&#xA;This script does two things: it listens to the &#34;telemetry:ground&#34; hook to log which side of the robot detects a black line whenever new readings arrive, while the update() loop continuously averages execution timing over 100 cycles.&#xA;&#xA;This structure provides the flexibility of simple update loops while allowing students to handle asynchronous data sources independently.&#xA;&#xA;Handling Single-Threaded Execution&#xA;&#xA;Lua is strictly single-threaded, meaning the main update loop and event hooks cannot run concurrently. To prevent race conditions, I implemented an execution queue. Incoming hooks are queued up and processed sequentially before calling the update function. This keeps event processing prioritized without colliding with the main loop.&#xA;&#xA;C API Implementation&#xA;&#xA;Before looking at the implementation details, here is a quick primer on how the Lua C API operates.&#xA;&#xA;All interactions between the host C code and the Lua engine pass through a virtual stack. When a C function is called from Lua, we pop the input arguments off the stack, perform our logic, and push any return values back onto the stack. The same stack-based pattern applies to everything: defining tables, assigning metatables, or invoking Lua callbacks.&#xA;&#xA;Exposing Userdata&#xA;&#xA;Exposing C data types to Lua as userdata was new territory for me. The cleanest way to manage custom data types in Lua is through metatables.&#xA;&#xA;Metatables attach custom behavior (using metamethods like index for field lookups or len for array length operators) to tables or userdata. Through metatables, C functions can define exactly how Lua reads or writes underlying C memory.&#xA;&#xA;For example, the &#34;telemetry:ground&#34; hook exposes a 3-element array corresponding to the floor-facing infrared sensors. Here is how that lookup is handled in C:&#xA;&#xA;// Static buffer storing current sensor telemetry&#xA;static uint16t ground[3] = {0, 0, 0};&#xA;&#xA;// The _index metamethod function&#xA;static int lgroundindex(luaState L) {&#xA;    if (luatype(L, 2) == LUATNUMBER) {&#xA;        int i = luatointeger(L, 2);&#xA;        if (i  1 || i  3) return luaLerror(L, &#34;Index %d out of range [1,3]&#34;, i);&#xA;        &#xA;        // Convert 1-based Lua index to 0-based C array index&#xA;        luapushinteger(L, ground[i - 1]);&#xA;        return 1; // Number of return values pushed to stack&#xA;    }&#xA;&#xA;    ESPLOGW(TAG, &#34;Lua ground array called with unknown key.&#34;);&#xA;    return 0;&#xA;}&#xA;&#xA;// Handler for the &#39;#&#39; length operator (always 3 for ground sensors)&#xA;static int lgroundlen(luaState L) {&#xA;    luapushinteger(L, 3);&#xA;    return 1;&#xA;}&#xA;&#xA;Next, we map these C functions to a metatable structure:&#xA;&#xA;static const luaLReg groundmt[] = {&#xA;    {&#34;_index&#34;, lgroundindex},&#xA;    {&#34;len&#34;, lgroundlen},&#xA;    {NULL, NULL},&#xA;};&#xA;&#xA;To register this metatable in Lua, we create it in the registry, populate its methods, and assign it when creating the userdata:&#xA;&#xA;// 1. Create a new metatable named &#34;Ground&#34; on top of the stack&#xA;luaLnewmetatable(L, &#34;Ground&#34;);&#xA;&#xA;// 2. Register functions into the metatable on top of the stack&#xA;luaLregister(L, NULL, groundmt);&#xA;&#xA;// 3. Pop the metatable off the stack now that it&#39;s registered&#xA;luapop(L, 1);&#xA;&#xA;Then, when instantiated, we allocate our groundt userdata inside Lua and attach the metatable:&#xA;&#xA;typedef uint16t groundt[3];&#xA;&#xA;// Create userdata memory inside Lua (pushes it to the top of stack)&#xA;groundt g = (groundt)luanewuserdata(L, sizeof(groundt));&#xA;&#xA;// Retrieve the &#34;Ground&#34; metatable and push it to the top of stack&#xA;luaLgetmetatable(L, &#34;Ground&#34;);&#xA;&#xA;// Attach the metatable to our userdata (located at stack index -2) and pop the metatable&#xA;luasetmetatable(L, -2);&#xA;&#xA;Managing Callbacks&#xA;&#xA;Allowing users to define hook callbacks in Lua requires three straightforward steps in C:&#xA;&#xA;Store a reference to the user&#39;s function in the Lua registry when registered.&#xA;Push the function and its arguments onto the virtual stack when the event triggers.&#xA;Execute the function using luapcall() (it stands for protected function call, which manages errors).&#xA;&#xA;Here is a simplified view of executing a callback:&#xA;&#xA;if (luatype(L, narg) == LUATFUNCTION) {&#xA;    // The callback function is the second argument (after hook identifier)&#xA;    luapushvalue(L, 2); // Push function onto stack&#xA;}&#xA;&#xA;// Call the function on the stack with 1 argument and 0 return values&#xA;if (luapcall(L, 1, 0, 0) != LUAOK) {&#xA;    ESPLOGE(TAG, &#34;Error running hook callback: %s&#34;, luatostring(L, -1));&#xA;    lua_pop(L, 1); // Remove error message from stack&#xA;}&#xA;&#xA;In the real system, function references and event userdata are stored safely inside the Lua registry for persistent, repeated invocation.&#xA;&#xA;Improvements and Future Work&#xA;&#xA;My Lua VM implementation is progressing well, but a few key tasks remain:&#xA;&#xA;Mutation vs. Allocation: Currently, data passed through hooks reuses the same memory reference across calls to minimize heap allocations on the ESP32. However, this means users cannot easily save historical readings without copying them, which might prove confusing.&#xA;Direct Property Access: I want to support direct variable queries (like robot.ground[1]) within the main update loop without requiring dedicated hooks.&#xA;Connecting Actuators: The e-puck2 hardware relies on two chips: the ESP32 (handling radio and running our Lua scripts) and an STM32 main controller (managing motors, low-level sensors, and passing telemetry to the ESP32). The final missing piece is wiring Lua commands back across the internal bus to control the physical actuators on the STM32, which will be my main focus for the rest of August.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://uhrbaan.ch/images/banners/lua-epuck.png" alt="Banner of the e-puck landing on a lua moon"></p>

<p>These last two weeks, I&#39;ve been busy working on the radio module of the e-puck2, specifically embedding a Lua VM onto its ESP32 chip, which handles remote communication. This work is part of my <strong>Fripuck</strong> project, my bachelor thesis aimed at adapting the e-puck2 software to better suit the needs of the University of Fribourg.</p>

<p>In this post, I&#39;ll explain <em>why</em> I wanted to introduce a Lua VM into the project, present the API, and talk about the C implementation.</p>

<h2 id="why-add-a-vm">Why add a VM?</h2>

<p>First, a quick reminder of who this software is for. At the University of Fribourg, the <a href="https://www.gctronic.com/doc/index.php/e-puck2" rel="nofollow">e-puck2 robot</a> is used to introduce students to mobile robotics. Fripuck is the name I&#39;ve given to the new software I&#39;m writing for the platform.</p>

<p>These robots are currently controlled remotely over Wi-Fi via a Python API built by a previous student during their own thesis. While that was a huge step up from the raw C API used before, remote control still comes with inherent drawbacks, either due to API abstractions or issues fundamentally linked to wireless telemetry.</p>

<p>Adding an on-board Lua VM allows students to program the robot directly without needing a continuous network connection. This allows them to investigate network latency, resource constraints, and the classic problem of dividing work between on-device and off-device execution. Scripting behavior in Lua is also vastly simpler than setting up toolchains, compiling C, and flashing new firmware to the robot, a high hurdle for first-year students who might be completely new to programming.</p>

<p><strong>It&#39;s worth noting that the Lua scripting engine isn&#39;t meant to replace the remote Python API entirely</strong>. Remote controlling remains the primary way to interact with the robot,  especially since Lua on an embedded chip isn&#39;t practical or fast enough for heavy sensor data analysis. Instead, the VM acts as a complementary tool: ideal for low-latency tasks, reactive behavior, or simple on-device configuration.</p>

<h2 id="why-lua">Why Lua?</h2>

<p>Choosing Lua over other scripting options was a deliberate choice on my part. It gets its fair share of criticism: array indices famously start at <code>1</code>, it is far less ubiquitous than Python, and its single complex data structure, the <code>table</code>, takes some getting used to.</p>

<p>However, Lua has its advantages in embedded contexts: it is easy to integrate into C programs via its clean, well-documented C API, while remaining fast, flexible, and lightweight. Compared to other embeddable languages like MicroPython, Lua is generally less RAM-hungry and features a cleaner architecture for constrained hardware. I&#39;ll also admit to a personal fascination with the technology, and this project felt like the perfect sandbox to explore it thoroughly.</p>

<p><em>(If you are curious about Python support, <a href="https://www.gctronic.com/" rel="nofollow">GCtronic</a>, the makers of the robot, maintain an official [MicroPython port](<a href="https://www.gctronic.com/doc/index.php?title=e-puck2" rel="nofollow">https://www.gctronic.com/doc/index.php?title=e-puck2</a></em>PC<em>side</em>development<a href="/leonardurban/tag:Micropython" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Micropython</span></a>) of the e-puck2 software)._</p>

<h2 id="architecture-and-api">Architecture and API</h2>

<p>The two Lua environments I am most familiar with are game engines (like <a href="https://www.lexaloffle.com/pico-8.php" rel="nofollow">PICO-8</a> or <a href="https://www.love2d.org/" rel="nofollow">LÖVE</a>) and <a href="https://neovim.io/" rel="nofollow">Neovim</a>. From them, I borrowed two common patterns: <strong>update loops</strong> and <strong>hooks</strong>.</p>

<h3 id="update-loops-hooks">Update Loops &amp; Hooks</h3>

<p>Update loops are standard in game engines and other frameworks. I chose to expose two: <code>init()</code> and <code>update()</code>, following PICO-8 terminology. Students write an <code>init()</code> function for startup tasks, followed by an <code>update()</code> loop that runs at roughly 20Hz (~50ms delta time).</p>

<p>Alongside the loop, students can register <strong>hooks</strong>, callback functions triggered immediately when an event occurs, such as a sensor read or an incoming command from a remote controller.</p>

<p>Here is what a complete user script looks like:</p>

<pre><code class="language-lua">-- Declare local variables for fast lookup
local last_side = &#34;center&#34;
local side = &#34;center&#34;

function init()
    -- Register a hook to the ground sensors to track a black line
    robot.on(&#34;telemetry:ground&#34;, function(ground)
        -- Lua arrays start at 1!
        local difference = ground[1] - ground[3]
        
        if math.abs(difference) &gt; 20 then 
            if difference &lt; 0 then side = &#34;left&#34;
            else side = &#34;right&#34; end 
        else side = &#34;center&#34; end

        if side ~= last_side then 
            print(&#34;Black line on the &#34; .. side .. &#34; side.&#34;) 
        end

        last_side = side
    end)
end

local counter = 0
local total_dt = 0

-- Runs every 50ms; prints average delta time every 100 iterations
function update(dt)
    counter = counter + 1
    total_dt = total_dt + dt
    if counter &gt; 100 then 
        local average = total_dt / counter 
        print(&#34;Over 100 iterations, the average dt is: &#34; .. average .. &#34;s.&#34;)
        counter = 0
        total_dt = 0
    end
end

</code></pre>

<p>This script does two things: it listens to the <code>&#34;telemetry:ground&#34;</code> hook to log which side of the robot detects a black line whenever new readings arrive, while the <code>update()</code> loop continuously averages execution timing over 100 cycles.</p>

<p>This structure provides the flexibility of simple update loops while allowing students to handle asynchronous data sources independently.</p>

<h3 id="handling-single-threaded-execution">Handling Single-Threaded Execution</h3>

<p>Lua is strictly single-threaded, meaning the main update loop and event hooks cannot run concurrently. To prevent race conditions, I implemented an <strong>execution queue</strong>. Incoming hooks are queued up and processed sequentially <em>before</em> calling the update function. This keeps event processing prioritized without colliding with the main loop.</p>

<h2 id="c-api-implementation">C API Implementation</h2>

<p>Before looking at the implementation details, here is a quick primer on how the Lua C API operates.</p>

<p>All interactions between the host C code and the Lua engine pass through a <strong>virtual stack</strong>. When a C function is called from Lua, we pop the input arguments off the stack, perform our logic, and push any return values back onto the stack. The same stack-based pattern applies to everything: defining tables, assigning metatables, or invoking Lua callbacks.</p>

<h3 id="exposing-userdata">Exposing Userdata</h3>

<p>Exposing C data types to Lua as <code>userdata</code> was new territory for me. The cleanest way to manage custom data types in Lua is through <strong>metatables</strong>.</p>

<p>Metatables attach custom behavior (using metamethods like <code>__index</code> for field lookups or <code>__len</code> for array length operators) to tables or userdata. Through metatables, C functions can define exactly how Lua reads or writes underlying C memory.</p>

<p>For example, the <code>&#34;telemetry:ground&#34;</code> hook exposes a 3-element array corresponding to the floor-facing infrared sensors. Here is how that lookup is handled in C:</p>

<pre><code class="language-C">// Static buffer storing current sensor telemetry
static uint16_t ground[3] = {0, 0, 0};

// The __index metamethod function
static int l_ground_index(lua_State* L) {
    if (lua_type(L, 2) == LUA_TNUMBER) {
        int i = lua_tointeger(L, 2);
        if (i &lt; 1 || i &gt; 3) return luaL_error(L, &#34;Index %d out of range [1,3]&#34;, i);
        
        // Convert 1-based Lua index to 0-based C array index
        lua_pushinteger(L, ground[i - 1]);
        return 1; // Number of return values pushed to stack
    }

    ESP_LOGW(TAG, &#34;Lua ground array called with unknown key.&#34;);
    return 0;
}

// Handler for the &#39;#&#39; length operator (always 3 for ground sensors)
static int l_ground_len(lua_State* L) {
    lua_pushinteger(L, 3);
    return 1;
}

</code></pre>

<p>Next, we map these C functions to a metatable structure:</p>

<pre><code class="language-C">static const luaL_Reg ground_mt[] = {
    {&#34;__index&#34;, l_ground_index},
    {&#34;__len&#34;, l_ground_len},
    {NULL, NULL},
};

</code></pre>

<p>To register this metatable in Lua, we create it in the registry, populate its methods, and assign it when creating the userdata:</p>

<pre><code class="language-C">// 1. Create a new metatable named &#34;Ground&#34; on top of the stack
luaL_newmetatable(L, &#34;Ground&#34;);

// 2. Register functions into the metatable on top of the stack
luaL_register(L, NULL, ground_mt);

// 3. Pop the metatable off the stack now that it&#39;s registered
lua_pop(L, 1);
</code></pre>

<p>Then, when instantiated, we allocate our <code>ground_t</code> userdata inside Lua and attach the metatable:</p>

<pre><code class="language-C">typedef uint16_t ground_t[3];

// Create userdata memory inside Lua (pushes it to the top of stack)
ground_t* g = (ground_t*)lua_newuserdata(L, sizeof(ground_t));

// Retrieve the &#34;Ground&#34; metatable and push it to the top of stack
luaL_getmetatable(L, &#34;Ground&#34;);

// Attach the metatable to our userdata (located at stack index -2) and pop the metatable
lua_setmetatable(L, -2);
</code></pre>

<h3 id="managing-callbacks">Managing Callbacks</h3>

<p>Allowing users to define hook callbacks in Lua requires three straightforward steps in C:</p>
<ol><li>Store a reference to the user&#39;s function in the Lua registry when registered.</li>
<li>Push the function and its arguments onto the virtual stack when the event triggers.</li>
<li>Execute the function using <code>lua_pcall()</code> (it stands for <em>protected function call</em>, which manages errors).</li></ol>

<p>Here is a simplified view of executing a callback:</p>

<pre><code class="language-C">if (lua_type(L, narg) == LUA_TFUNCTION) {
    // The callback function is the second argument (after hook identifier)
    lua_pushvalue(L, 2); // Push function onto stack
}

// Call the function on the stack with 1 argument and 0 return values
if (lua_pcall(L, 1, 0, 0) != LUA_OK) {
    ESP_LOGE(TAG, &#34;Error running hook callback: %s&#34;, lua_tostring(L, -1));
    lua_pop(L, 1); // Remove error message from stack
}
</code></pre>

<p>In the real system, function references and event userdata are stored safely inside the Lua registry for persistent, repeated invocation.</p>

<h2 id="improvements-and-future-work">Improvements and Future Work</h2>

<p>My Lua VM implementation is progressing well, but a few key tasks remain:</p>
<ul><li><strong>Mutation vs. Allocation:</strong> Currently, data passed through hooks reuses the same memory reference across calls to minimize heap allocations on the ESP32. However, this means users cannot easily save historical readings without copying them, which might prove confusing.</li>
<li><strong>Direct Property Access:</strong> I want to support direct variable queries (like <code>robot.ground[1]</code>) within the main update loop without requiring dedicated hooks.</li>
<li><strong>Connecting Actuators:</strong> The e-puck2 hardware relies on two chips: the ESP32 (handling radio and running our Lua scripts) and an STM32 main controller (managing motors, low-level sensors, and passing telemetry to the ESP32). The final missing piece is wiring Lua commands back across the internal bus to control the physical actuators on the STM32, which will be my main focus for the rest of August.</li></ul>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg5-lua-is-moon-in-portuguese</guid>
      <pubDate>Thu, 20 Aug 2026 12:03:27 +0200</pubDate>
    </item>
    <item>
      <title>Fripuck devlog n°4: Static FlatBuffers</title>
      <link>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg4-static-flatbuffers</link>
      <description>&lt;![CDATA[Now that I am back from vacation, I managed to get a few things done ! &#xA;Here is a list of the key areas I managed to make progres in:&#xA;Project managment, to have a better overview of what was done and what I need to achieve;&#xA;A smarter packaging system to manage multiple sensors at once;&#xA;Reducing memory usage by implementing static FlatBuffers using a custom emitter.&#xA;&#xA;1. Project Managment&#xA;First, I finally took the time to look into project managment software, and stumbled on Kaneo, a rather minimal kanaban application that also includes a backlog and a Gantt chart. &#xA;I wanted something that was easy to self-host (there is a Dokploy template for it) and a small enough featureset I wouldn&#39;t waste time learning how to use it. &#xA;Now, if you want to follow the project&#39;s development, you can take a look at my kanban board ! &#xA;&#xA;Visually writing down what has to be done and has already been done helps me to prioritize certain features over others, and helps me stay motivated by seing the steady progress, so I am glad I finally took the time to configure everything.&#xA;&#xA;2. Smarter packaging&#xA;Before, every single sensor provided its own pack() function. This function was used to take as all the data that the sensor had accumulated since the last pack() call and add it to the common Flatbuffer. &#xA;Then, a central telemetry task would call the pack() functions sequentially and then finally send out the final, serialized packet.&#xA;&#xA;While this worked for testing purposes, it came with several issues: &#xA;It required to write extremely similar code each time I added a new sensor;&#xA;There was no check wether the packaged data exceeded the remaining available space;&#xA;Starvation was guaranteed since the sensors would alwas package in the same order.&#xA;&#xA;The first issue was kind of fixed by using a large macro that could automatically generate the pack() function for you, but the two other issues remained. &#xA;To fix them, I decided to throw away this implementation to switch to a sensor-agnostic implementation with a priority system. &#xA;&#xA;Generalizing the packaging &#xA;In FlatBuffer (specifically flatcc), you would typically use specialized functions for each datatype defined in your .fbs schema. &#xA;To be able to handle any sensor, we use the underlying flatcc functions. &#xA;These typically abstract away the datatype to an id, alignment and size variables.&#xA;This enables us to register a sensor to the telemetry system by providing only three values, instead of providing a whole function, simplifying the work of the user. &#xA;&#xA;Now we have a genericpack() function to use instead of the ~10 individual pack functions. &#xA;Since this generic function is provided by the telemetry task and not the sensor task, it has also much more context allowing for more granular control of how the data gets packaged.&#xA;&#xA;Data from the sensors is appended using this (simplified workflow): &#xA;&#xA;flatccbuilderstartvector(B, size, alignment, maxcount); // prepare to build scrap vector in heap&#xA;flatccbuilderappendvector(B, bytebuf + (startidx  size), count); // copy section of sensor data to the scrap vector&#xA;flatccbuilderreft vecref = flatccbuilderendvector(B); // get offset of built scrap vector&#xA;flatccbuilderreft tableslotref = flatccbuildertableaddoffset(B, id); // get offset of the sensor&#39;s final vector&#xA;tableslotref = vecref; // map the scrap vector to the sensor&#39;s final vector&#xA;// repeat the above steps for each sensor, each with its own size, alignment and id&#xA;FripuckProtocolSensorsSensorBatchendasroot(B); // finaly commit the full FB&#xA;&#xA;Currently those three values have to be digged up in the generated flatcc files, which is not ideal. &#xA;In theory, these values can be calculated or referenced in the generated code, which would be ideal in the long run. &#xA;&#xA;Priority System&#xA;To reduce starvation, and make sure time sensitive data gets priority, a priority system was made. &#xA;A priority and age is assigned to each sensor when registering them, to determine the order in which the sensors get packaged, and thus which one can package the most data. &#xA;That process is rather simple, simply adding agestep to the age of the sensor at each iteration to track how much time has passed since last data was sent, and then adding the age to the priority for the final priority.&#xA;The sensor which gets the highest priority gets picked next.&#xA;&#xA;This system prevents starvation but isn&#39;t optimal. Ideally, taking into account how much data the sensor has collected or what would optimally fill the FB packet would also be interesting metrics to determine the priority, but this simple system currently is sufficient for my needs.&#xA;&#xA;Puting it all together&#xA;With these two new systems as well as a limit tracker, we can now create a simple packaging loop to package and send our data: &#xA;&#xA;void packloop(flatccbuildert builder, uint32t budget) {&#xA;    for (; budget   0;) {&#xA;        // Priority check&#xA;        struct sensorinfo s = updateageandpicksensor();&#xA;        if (s == NULL) continue;&#xA;&#xA;        // Managing the remaining space and packaging the sensor data.&#xA;        uint32t byteswritten = 0;&#xA;        genericpack(builder, &amp;s-  fbdata, budget, &amp;byteswritten);&#xA;        budget -= byteswritten;&#xA;    ...&#xA;&#xA;Adding to that a simple timeout that will not block the packloop when only few or slow sensors are running, and we have a much better system than before ! &#xA;However, this doesn&#39;t solve our initial problem of high memory use, which requires the next adaptation: &#xA;&#xA;3. Static FlatBuffers&#xA;First, we need to understand how FlatBuffers works. &#xA;Here is what it is according to the docs: &#xA;&#xA;  FlatBuffers is an efficient cross platform serialization library [...].&#xA;&#xA;To achieve this serialization, flatcc (the C implementation of FlatBuffers) first creates the individual objects and vectors that go into the final FB object, and in a second step, it compacts down those individual blocks into a single, continuous memory block that is ready to be sent. &#xA;A unique twist on the serialization is that instead of growing the sequential block in only one direction, it starts in the center of the available space (offset 0), and grows data to the left (negative offset) and metadata (the position and type of the data) to the right (positive) offset. &#xA;&#xA;                  ┌───────┬────────┐&#xA;                  │   FB buffer    │ Emitter ctx&#xA;                  └───────┼────────┘&#xA;                    Data  │ Vtable (metadata)&#xA; negative offset ◄───── │ ─────► + positive offset&#xA;                          │&#xA;                       offset 0&#xA;&#xA;One major issue when using the default flatcc configuration, is that it builds this serialized block in the heap, meaning we need to allocate a huge chunk of data on the heap when the serialization starts. Since we only have so much heap space to begin with, this is a no go. &#xA;&#xA;Luckily for us, the flatcc developers go us coverd and provide a custom initialization command which enables us to provode our own emitter (the object responsible for building the serialized block). This way, we can assign a static buffer to it, which prevents fragmentation and doesn&#39;t reaquire a bunch of free heap space. It is also possible to define a custom allocator, which is used when creating the temporary vectors and objects before serializing them, but this is overkill for our needs.&#xA;&#xA;The custom emitter is divided into three parts: &#xA;The emitter context (ctx), which holds all the data the emitter function needs to build the serialized buffer;&#xA;The emitter function (custombuilderemitfun), which is called each time an object or vector needs to be added to the final buffer, and appends the data and the metadata to the respective ends of the buffer;&#xA;And finally the buffer itself, where the data will be added.&#xA;&#xA;We define the buffer as simply a static array of bytes, with a &#34;center&#34;. &#xA;Typically the center (or offset 0) won&#39;t be perfectly in the center of the static buffer, since flatcc generally produces much more data (left side) than metadata/Vtable (right side)&#xA;&#xA;define STATICFBBUFFERSIZE (2  1024)                       // 2KB static payload buffer&#xA;define FBBUFFEROFFSETZERO (STATICFBBUFFERSIZE  3 / 4)  // Index of offset 0&#xA;static uint8t fbbuffer[STATICFBBUFFERSIZE] = {0};&#xA;&#xA;Then, we need to define the context which will be passed through different function calls. &#xA;To be able to build the buffer and correctly determine its size, we need to store a reference to the buffer, its capacity, the offset of the center, the min and max offsets.&#xA;&#xA;typedef struct {&#xA;    uint8t buf;&#xA;    sizet capacity;&#xA;    flatbufferssoffsett zerooffset;  // Center (offset +0) of the buffer&#xA;    flatbufferssoffsett minoffset;   // Tracks the lowest negative offset emitted&#xA;    flatbufferssoffsett maxoffset;   // Tracks the highest positive offset emitted&#xA;} staticemittercontextt;&#xA;&#xA;Then begins the hard part, the emitter function. It has to strictly follow the following function definition: &#xA;int custombuilderemitfun(void emitcontext, &#xA;                            const flatcciovect iov, &#xA;                            int iovcount, &#xA;                            flatbufferssoffsett offset, &#xA;                            sizet len);&#xA;&#xA;Let&#39;s go through the different arguments: &#xA;emitcontext is a pointer to the context we defined earlier.&#xA;iov is an array containing data+size pairs of information we need to copy to the buffer.&#xA;iovcount is the number of elements in that array.&#xA;offset is the offset (positive or negative) where we need to write the data to.&#xA;len is the combined length of all the iov entries.&#xA;&#xA;Then, the workflow is pretty simple. &#xA;We loop through the iov entries, &#xA;We calculate the final address in the buffer where the data needs to be copied to, &#xA;Update the offset before writing the next entry.&#xA;&#xA;In code, this translates to the following (omitting bound checks and details):&#xA;&#xA;for (int i = 0; i &lt; iovcount; ++i) {&#xA;    sizet elemlen = iov[i].iovlen;&#xA;    if (elemlen == 0) continue;&#xA;&#xA;    // Calculate the final address to write to &#xA;    uint8t dest = &amp;ctx-  buf[ctx-  zerooffset + offset];&#xA;&#xA;    // copy &#xA;    memcpy(dest, iov[i].iovbase, elemlen);&#xA;    &#xA;    // update the entry&#xA;    offset += (flatbufferssoffsett)elemlen;&#xA;}&#xA;&#xA;Then, simply pointing to the lowest negative offset gives you a valid FB, no additional steps !&#xA;&#xA;Wrappingn it up&#xA;&#xA;------------------------&#xA;&#xA;Now that I’m back from vacation, I’ve managed to make progress on several key areas:&#xA;Project management, to get a clearer overview of what’s done and what’s left to achieve;&#xA;A smarter packaging system to handle multiple sensors more efficiently;&#xA;Reducing memory usage by implementing static FlatBuffers with a custom emitter.&#xA;&#xA;1. Project Management&#xA;First, I finally took the time to explore project management tools and came across Kaneo, a minimal Kanban application that also includes a backlog and a Gantt chart. I wanted something easy to self-host (there’s a Dokploy template for it) with a small enough feature set that I wouldn’t waste time learning how to use it.&#xA;&#xA;If you want to follow the project’s progress, you can now check out my Kanban board!&#xA;&#xA;Visually tracking what needs to be done and what’s already completed helps me prioritize features and stay motivated by seeing steady progress. I’m glad I finally set this up.&#xA;&#xA;2. Smarter Packaging&#xA;Previously, each sensor had its own pack() function. This function would take all the data the sensor had accumulated since the last pack() call and add it to a shared FlatBuffer (FB). A central telemetry task would then call these pack() functions sequentially and send out the final serialized packet.&#xA;&#xA;While this worked for testing, it had several issues:&#xA;It required writing nearly identical code for each new sensor.&#xA;There was no check to ensure the packaged data didn’t exceed the available space.&#xA;Starvation was inevitable since sensors were always processed in the same order.&#xA;&#xA;The first issue was partially fixed using a macro to auto-generate the pack() function, but the other two remained. To address them, I decided to scrap this approach and switch to a sensor-agnostic implementation with a priority system.&#xA;&#xA;Generalizing the Packaging&#xA;When using FlatBuffers, you typically use specialized functions for each datatype defined in your .fbs schema. To handle any sensor, we use the underlying flatcc functions, which abstract the datatype into an ID, alignment, and size. This allows us to register a sensor in the telemetry system by providing just these three values, instead of an entire function, simplifying the user’s work.&#xA;&#xA;Now, we have a single genericpack() function replacing the ~10 individual pack functions. Since this generic function is provided by the telemetry task rather than the sensor task, it has more context, enabling finer control over how data is packaged.&#xA;&#xA;Sensor data is appended using this simplified workflow:&#xA;&#xA;flatccbuilderstartvector(B, size, alignment, maxcount); // Prepare to build scrap vector in heap&#xA;flatccbuilderappendvector(B, bytebuf + (startidx  size), count); // Copy section of sensor data to the scrap vector&#xA;flatccbuilderreft vecref = flatccbuilderendvector(B); // Get offset of built scrap vector&#xA;flatccbuilderreft tableslotref = flatccbuildertableaddoffset(B, id); // Get offset of the sensor&#39;s final vector&#xA;tableslotref = vecref; // Map the scrap vector to the sensor&#39;s final vector&#xA;// Repeat the above steps for each sensor, each with its own size, alignment, and ID&#xA;FripuckProtocolSensorsSensorBatchendasroot(B); // Finally commit the full FlatBuffer&#xA;&#xA;Currently, these three values (ID, alignment, size) must be manually extracted from the generated flatcc files, which isn’t ideal. In theory, they could be calculated or referenced in the generated code, which would be a better long-term solution.&#xA;&#xA;Priority System&#xA;To prevent starvation and ensure time-sensitive data gets priority, I implemented a priority system. Each sensor is assigned a priority and an age when registered. These determine the order in which sensors are processed and how much data they can package. The process is straightforward: at each iteration, agestep is added to the sensor’s age to track the time since its last data was sent, and then the age is added to the priority to compute the final priority. The sensor with the highest priority is selected next.&#xA;&#xA;This system prevents starvation but isn’t perfect. Ideally, we’d also consider how much data a sensor has collected or how to optimally fill the FlatBuffer packet. However, this simple system currently meets my needs.&#xA;&#xA;Putting It All Together&#xA;With these two new systems and a limit tracker, we can now create a simple packaging loop to package and send data:&#xA;&#xA;void packloop(flatccbuildert builder, uint32t budget) {&#xA;    for (; budget   0;) {&#xA;        // Priority check&#xA;        struct sensorinfo s = updateageandpicksensor();&#xA;        if (s == NULL) continue;&#xA;&#xA;        // Manage remaining space and package sensor data&#xA;        uint32t byteswritten = 0;&#xA;        genericpack(builder, &amp;s-  fbdata, budget, &amp;byteswritten);&#xA;        budget -= byteswritten;&#xA;        ...&#xA;    }&#xA;}&#xA;&#xA;Adding a simple timeout ensures the packloop doesn’t block when only a few or slow sensors are running. This results in a much better system than before. However, it still doesn’t address the initial problem of high memory usage, which brings us to the next adaptation:&#xA;&#xA;3. Static FlatBuffers&#xA;First, let’s recap how FlatBuffers works. According to the docs:&#xA;&#xA;  FlatBuffers is an efficient cross-platform serialization library for C++, Java, Python, Go, and more.&#xA;&#xA;Unlike traditional serialization formats (e.g., JSON or Protobuf), FlatBuffers does not serialize or deserialize data in the conventional sense. Instead, it directly constructs a binary buffer in memory, where data is organized for zero-copy access. This means you can read fields directly from the buffer without parsing or deserialization steps.&#xA;To build this buffer, flatcc (the C implementation of FlatBuffers) follows a two-step process:&#xA;&#xA;It first creates intermediate vectors and tables (temporary structures) for each object defined in your .fbs schema.&#xA;It then compacts these into a single, contiguous memory block ready for transmission.&#xA;A unique aspect of FlatBuffers is its bidirectional growth mechanism. Instead of growing the buffer in one direction, it starts at the center (offset 0) and grows:&#xA;Data (e.g., vectors, scalars) toward negative offsets (left).&#xA;Metadata (e.g., VTables, which store field layouts for tables) toward positive offsets (right).&#xA;This minimizes alignment gaps and ensures the final buffer is tightly packed.&#xA;&#xA;                  ┌───────┬────────┐&#xA;                  │   FB buffer    │ Emitter ctx&#xA;                  └───────┼────────┘&#xA;                    Data  │ Vtable (metadata)&#xA; negative offset ◄───── │ ─────► + positive offset&#xA;                          │&#xA;                       offset 0&#xA;&#xA;But why does it matter ?&#xA;By default, flatcc allocates this final buffer on the heap, which is problematic for embedded systems with limited memory. Fortunately, flatcc allows us to provide a custom emitter—a callback function that redirects buffer construction to a static memory region of our choosing. This avoids dynamic allocation entirely. It’s also possible to define a custom allocator for temporary vectors and objects before serialization, but that’s overkill for our needs.&#xA;&#xA;The custom emitter consists of three parts:&#xA;The emitter context (ctx), which holds all the data the emitter function needs to build the serialized buffer.&#xA;The emitter function (custombuilderemitfun), called each time an object or vector needs to be added to the final buffer. It appends data and metadata to their respective ends of the buffer.&#xA;The buffer itself, where the data is stored.&#xA;&#xA;We define the buffer as a static byte array with a &#34;center.&#34; Typically, the center (offset 0) isn’t perfectly centered in the static buffer, as flatcc usually generates more data (left side) than metadata/vtable (right side):&#xA;&#xA;define STATICFBBUFFERSIZE (2  1024) // 2KB static payload buffer&#xA;define FBBUFFEROFFSETZERO (STATICFBBUFFERSIZE  3 / 4) // Index of offset 0&#xA;static uint8t fbbuffer[STATICFBBUFFERSIZE] = {0};&#xA;&#xA;Next, we define the context passed through function calls. To build the buffer and correctly determine its size, we need to store a reference to the buffer, its capacity, the center offset, and the min/max offsets:&#xA;&#xA;typedef struct {&#xA;    uint8t buf;&#xA;    sizet capacity;&#xA;    flatbufferssoffsett zerooffset;  // Center (offset +0) of the buffer&#xA;    flatbufferssoffsett minoffset;   // Tracks the lowest negative offset emitted&#xA;    flatbufferssoffsett maxoffset;   // Tracks the highest positive offset emitted&#xA;} staticemittercontextt;&#xA;&#xA;Now, the tricky part: the emitter function. It must strictly follow this definition:&#xA;&#xA;int custombuilderemitfun(void emitcontext,&#xA;                            const flatcciovect iov,&#xA;                            int iovcount,&#xA;                            flatbufferssoffsett offset,&#xA;                            sizet len);&#xA;&#xA;Let’s break down the arguments:&#xA;emitcontext: A pointer to the context we defined earlier.&#xA;iov: An array containing data+size pairs of the information to copy to the buffer.&#xA;iovcount: The number of elements in that array.&#xA;offset: The offset (positive or negative) where the data should be written.&#xA;len: The combined length of all iov entries.&#xA;&#xA;The workflow is straightforward:&#xA;Loop through the iov entries.&#xA;Calculate the final address in the buffer where the data should be copied.&#xA;Update the offset before writing the next entry.&#xA;&#xA;In code, this looks like (omitting bounds checks and minor details):&#xA;&#xA;for (int i = 0; i &lt; iovcount; ++i) {&#xA;    sizet elemlen = iov[i].iovlen;&#xA;    if (elemlen == 0) continue;&#xA;&#xA;    // Calculate the final address to write to&#xA;    uint8t dest = &amp;ctx-  buf[ctx-  zerooffset + offset];&#xA;&#xA;    // Copy&#xA;    memcpy(dest, iov[i].iovbase, elemlen);&#xA;&#xA;    // Update the offset&#xA;    offset += (flatbufferssoffsett)elemlen;&#xA;}&#xA;&#xA;Once all data is written, the lowest negative offset points to the start of a valid FlatBuffer—no further processing needed!&#xA;&#xA;---&#xA;Wrapping Up&#xA;While I haven’t been able to work on the project as much as I’d have liked, I’m glad to see it moving forward again. I’m also happy to see my memory issues disappear, hopefully for good 😅.&#xA;&#xA;Over the next month, I’ll try to dedicate as much time as possible to the project. Right now, I’m focusing my efforts on getting the camera to work and laying the initial foundations for the laptop → e-puck commands. This involves coordinating the radio and controller chip, as well as the Lua VM I’ve started implementing.&#xA;&#xA;C you next month!&#xA;&#xA;Project Github page: https://github.com/Uhrbaan/fripuck2]]&gt;</description>
      <content:encoded><![CDATA[<p>Now that I am back from vacation, I managed to get a few things done !
Here is a list of the key areas I managed to make progres in:
1. <a href="#1-project-managment" rel="nofollow">Project managment</a>, to have a better overview of what was done and what I need to achieve;
2. A <a href="#2-smarter-packaging" rel="nofollow">smarter packaging</a> system to manage multiple sensors at once;
3. Reducing memory usage by implementing <a href="#3-static-flatbuffers" rel="nofollow">static FlatBuffers</a> using a custom emitter.</p>

<h2 id="1-project-managment">1. Project Managment</h2>

<p>First, I finally took the time to look into project managment software, and stumbled on <a href="https://kaneo.app/" rel="nofollow">Kaneo</a>, a rather minimal kanaban application that also includes a backlog and a Gantt chart.
I wanted something that was easy to self-host (there is a Dokploy template for it) and a small enough featureset I wouldn&#39;t waste time learning how to use it.
Now, if you want to follow the project&#39;s development, you can take a look at my <a href="https://tasks.uhrbaan.ch/public-project/mwl0lhju0opl8zdi771jzwpt" rel="nofollow">kanban board</a> !</p>

<p>Visually writing down what has to be done and has already been done helps me to prioritize certain features over others, and helps me stay motivated by seing the steady progress, so I am glad I finally took the time to configure everything.</p>

<h2 id="2-smarter-packaging">2. Smarter packaging</h2>

<p>Before, every single sensor provided its own <code>_pack()</code> function. This function was used to take as all the data that the sensor had accumulated since the last <code>_pack()</code> call and add it to the common Flatbuffer.
Then, a central <code>telemetry</code> task would call the <code>_pack()</code> functions sequentially and then finally send out the final, serialized packet.</p>

<p>While this worked for testing purposes, it came with several issues:
+ It required to write extremely similar code each time I added a new sensor;
+ There was no check wether the packaged data exceeded the remaining available space;
+ Starvation was guaranteed since the sensors would alwas package in the same order.</p>

<p>The first issue was <em>kind of</em> fixed by using a large macro that could automatically generate the <code>_pack()</code> function for you, but the two other issues remained.
To fix them, I decided to throw away this implementation to switch to a sensor-agnostic implementation with a priority system.</p>

<h3 id="generalizing-the-packaging">Generalizing the packaging</h3>

<p>In FlatBuffer (specifically <code>flatcc</code>), you would typically use specialized functions for each datatype defined in your <code>.fbs</code> schema.
To be able to handle any sensor, we use the underlying <code>flatcc_</code> functions.
These typically abstract away the datatype to an <em>id</em>, <em>alignment</em> and <em>size</em> variables.
This enables us to register a sensor to the telemetry system by providing only three values, instead of providing a whole function, simplifying the work of the user.</p>

<p>Now we have a <code>generic_pack()</code> function to use instead of the ~10 individual pack functions.
Since this generic function is provided by the telemetry task and not the sensor task, it has also much more context allowing for more granular control of how the data gets packaged.</p>

<p>Data from the sensors is appended using this (simplified workflow):</p>

<pre><code class="language-c">flatcc_builder_start_vector(B, size, alignment, max_count); // prepare to build scrap vector in heap
flatcc_builder_append_vector(B, byte_buf + (start_idx * size), count); // copy section of sensor data to the scrap vector
flatcc_builder_ref_t vec_ref = flatcc_builder_end_vector(B); // get offset of built scrap vector
flatcc_builder_ref_t* table_slot_ref = flatcc_builder_table_add_offset(B, id); // get offset of the sensor&#39;s final vector
*table_slot_ref = vec_ref; // map the scrap vector to the sensor&#39;s final vector
// repeat the above steps for each sensor, each with its own size, alignment and id
FripuckProtocol_Sensors_SensorBatch_end_as_root(B); // finaly commit the full FB
</code></pre>

<p>Currently those three values have to be digged up in the generated <code>flatcc</code> files, which is not ideal.
In theory, these values can be calculated or referenced in the generated code, which would be ideal in the long run.</p>

<h3 id="priority-system">Priority System</h3>

<p>To reduce starvation, and make sure time sensitive data gets priority, a priority system was made.
A priority and age is assigned to each sensor when registering them, to determine the order in which the sensors get packaged, and thus which one can package the most data.
That process is rather simple, simply adding <code>age_step</code> to the age of the sensor at each iteration to track how much time has passed since last data was sent, and then adding the <code>age</code> to the <code>priority</code> for the final priority.
The sensor which gets the highest priority gets picked next.</p>

<p>This system prevents starvation but isn&#39;t optimal. Ideally, taking into account how much data the sensor has collected or what would optimally fill the FB packet would also be interesting metrics to determine the priority, but this simple system currently is sufficient for my needs.</p>

<h3 id="puting-it-all-together">Puting it all together</h3>

<p>With these two new systems as well as a limit tracker, we can now create a simple packaging loop to package and send our data:</p>

<pre><code class="language-c">void pack_loop(flatcc_builder_t* builder, uint32_t budget) {
    for (; budget &gt; 0;) {
        // Priority check
        struct sensor_info* s = update_age_and_pick_sensor();
        if (s == NULL) continue;

        // Managing the remaining space and packaging the sensor data.
        uint32_t bytes_written = 0;
        generic_pack(builder, &amp;s-&gt;fb_data, budget, &amp;bytes_written);
        budget -= bytes_written;
    ...
</code></pre>

<p>Adding to that a simple timeout that will not block the <code>pack_loop</code> when only few or slow sensors are running, and we have a much better system than before !
However, this doesn&#39;t solve our initial problem of high memory use, which requires the next adaptation:</p>

<h2 id="3-static-flatbuffers">3. Static FlatBuffers</h2>

<p>First, we need to understand how FlatBuffers works.
Here is what it is according to <a href="https://flatbuffers.dev/" rel="nofollow">the docs</a>:</p>

<blockquote><p>FlatBuffers is an efficient cross platform serialization library [...].</p></blockquote>

<p>To achieve this serialization, <a href="https://github.com/dvidelabs/flatcc" rel="nofollow"><code>flatcc</code></a> (the C implementation of FlatBuffers) first creates the individual objects and vectors that go into the final FB object, and in a second step, it compacts down those individual blocks into a single, continuous memory block that is ready to be sent.
A unique twist on the serialization is that instead of growing the sequential block in only one direction, it starts in the center of the available space (offset <code>0</code>), and grows data to the left (negative offset) and metadata (the position and type of the data) to the right (positive) offset.</p>

<pre><code>                  ┌───────┬────────┐
                  │   FB buffer    │ Emitter ctx
                  └───────┼────────┘
                    Data  │ Vtable (metadata)
 - negative offset ◄───── │ ─────► + positive offset
                          │
                       offset 0
</code></pre>

<p>One major issue when using the default <code>flatcc</code> configuration, is that it builds this serialized block in the heap, meaning we need to allocate a huge chunk of data on the heap when the serialization starts. Since we only have so much heap space to begin with, this is a no go.</p>

<p>Luckily for us, the flatcc developers go us coverd and provide a custom initialization command which enables us to provode our own <code>emitter</code> (the object responsible for building the serialized block). This way, we can assign a static buffer to it, which prevents fragmentation and doesn&#39;t reaquire a bunch of free heap space. It is also possible to define a custom allocator, which is used when creating the temporary vectors and objects before serializing them, but this is overkill for our needs.</p>

<p>The custom emitter is divided into three parts:
– The <em>emitter context</em> (<code>ctx</code>), which holds all the data the emitter function needs to build the serialized buffer;
– The <em>emitter function</em> (<code>custom_builder_emit_fun</code>), which is called each time an object or vector needs to be added to the final buffer, and appends the data and the metadata to the respective ends of the buffer;
– And finally the buffer itself, where the data will be added.</p>

<p>We define the buffer as simply a static array of bytes, with a “center”.
Typically the center (or offset 0) won&#39;t be perfectly in the center of the static buffer, since <code>flatcc</code> generally produces much more data (left side) than metadata/Vtable (right side)</p>

<pre><code class="language-c">#define STATIC_FB_BUFFER_SIZE (2 * 1024)                       // 2KB static payload buffer
#define FB_BUFFER_OFFSET_ZERO (STATIC_FB_BUFFER_SIZE * 3 / 4)  // Index of offset 0
static uint8_t fb_buffer[STATIC_FB_BUFFER_SIZE] = {0};
</code></pre>

<p>Then, we need to define the context which will be passed through different function calls.
To be able to build the buffer and correctly determine its size, we need to store a reference to the buffer, its capacity, the offset of the center, the min and max offsets.</p>

<pre><code class="language-c">typedef struct {
    uint8_t* buf;
    size_t capacity;
    flatbuffers_soffset_t zero_offset;  // Center (offset +0) of the buffer
    flatbuffers_soffset_t min_offset;   // Tracks the lowest negative offset emitted
    flatbuffers_soffset_t max_offset;   // Tracks the highest positive offset emitted
} static_emitter_context_t;
</code></pre>

<p>Then begins the hard part, the emitter function. It has to strictly follow the following function definition:</p>

<pre><code class="language-c">int custom_builder_emit_fun(void* emit_context, 
                            const flatcc_iovec_t* iov, 
                            int iov_count, 
                            flatbuffers_soffset_t offset, 
                            size_t len);
</code></pre>

<p>Let&#39;s go through the different arguments:
– <code>emit_context</code> is a pointer to the context we defined earlier.
– <code>iov</code> is an array containing data+size pairs of information we need to copy to the buffer.
– <code>iov_count</code> is the number of elements in that array.
– <code>offset</code> is the offset (positive or negative) where we need to write the data to.
– <code>len</code> is the combined length of all the iov entries.</p>

<p>Then, the workflow is pretty simple.
1. We loop through the <code>iov</code> entries,
2. We calculate the final address in the buffer where the data needs to be copied to,
3. Update the offset before writing the next entry.</p>

<p>In code, this translates to the following (omitting bound checks and details):</p>

<pre><code class="language-c">for (int i = 0; i &lt; iov_count; ++i) {
    size_t elem_len = iov[i].iov_len;
    if (elem_len == 0) continue;

    // Calculate the final address to write to 
    uint8_t* dest = &amp;ctx-&gt;buf[ctx-&gt;zero_offset + offset];

    // copy 
    memcpy(dest, iov[i].iov_base, elem_len);
    
    // update the entry
    offset += (flatbuffers_soffset_t)elem_len;
}
</code></pre>

<p>Then, simply pointing to the lowest negative offset gives you a valid FB, no additional steps !</p>

<h2 id="wrappingn-it-up">Wrappingn it up</h2>

<hr>

<p>Now that I’m back from vacation, I’ve managed to make progress on several key areas:
1. <a href="#1-project-management" rel="nofollow">Project management</a>, to get a clearer overview of what’s done and what’s left to achieve;
2. A <a href="#2-smarter-packaging" rel="nofollow">smarter packaging system</a> to handle multiple sensors more efficiently;
3. Reducing memory usage by implementing <a href="#3-static-flatbuffers" rel="nofollow">static FlatBuffers</a> with a custom emitter.</p>

<h2 id="1-project-management">1. Project Management</h2>

<p>First, I finally took the time to explore project management tools and came across <a href="https://kaneo.app/" rel="nofollow">Kaneo</a>, a minimal Kanban application that also includes a backlog and a Gantt chart. I wanted something easy to self-host (there’s a Dokploy template for it) with a small enough feature set that I wouldn’t waste time learning how to use it.</p>

<p>If you want to follow the project’s progress, you can now check out my <a href="https://tasks.uhrbaan.ch/public-project/mwl0lhju0opl8zdi771jzwpt" rel="nofollow">Kanban board</a>!</p>

<p>Visually tracking what needs to be done and what’s already completed helps me prioritize features and stay motivated by seeing steady progress. I’m glad I finally set this up.</p>

<h2 id="2-smarter-packaging-1">2. Smarter Packaging</h2>

<p>Previously, each sensor had its own <code>_pack()</code> function. This function would take all the data the sensor had accumulated since the last <code>_pack()</code> call and add it to a shared FlatBuffer (FB). A central <code>telemetry</code> task would then call these <code>_pack()</code> functions sequentially and send out the final serialized packet.</p>

<p>While this worked for testing, it had several issues:
– It required writing nearly identical code for each new sensor.
– There was no check to ensure the packaged data didn’t exceed the available space.
– Starvation was inevitable since sensors were always processed in the same order.</p>

<p>The first issue was <em>partially</em> fixed using a macro to auto-generate the <code>_pack()</code> function, but the other two remained. To address them, I decided to scrap this approach and switch to a sensor-agnostic implementation with a priority system.</p>

<h3 id="generalizing-the-packaging-1">Generalizing the Packaging</h3>

<p>When using FlatBuffers, you typically use specialized functions for each datatype defined in your <code>.fbs</code> schema. To handle any sensor, we use the underlying <code>flatcc_</code> functions, which abstract the datatype into an <em>ID</em>, <em>alignment</em>, and <em>size</em>. This allows us to register a sensor in the telemetry system by providing just these three values, instead of an entire function, simplifying the user’s work.</p>

<p>Now, we have a single <code>generic_pack()</code> function replacing the ~10 individual pack functions. Since this generic function is provided by the telemetry task rather than the sensor task, it has more context, enabling finer control over how data is packaged.</p>

<p>Sensor data is appended using this simplified workflow:</p>

<pre><code class="language-c">flatcc_builder_start_vector(B, size, alignment, max_count); // Prepare to build scrap vector in heap
flatcc_builder_append_vector(B, byte_buf + (start_idx * size), count); // Copy section of sensor data to the scrap vector
flatcc_builder_ref_t vec_ref = flatcc_builder_end_vector(B); // Get offset of built scrap vector
flatcc_builder_ref_t* table_slot_ref = flatcc_builder_table_add_offset(B, id); // Get offset of the sensor&#39;s final vector
*table_slot_ref = vec_ref; // Map the scrap vector to the sensor&#39;s final vector
// Repeat the above steps for each sensor, each with its own size, alignment, and ID
FripuckProtocol_Sensors_SensorBatch_end_as_root(B); // Finally commit the full FlatBuffer
</code></pre>

<p>Currently, these three values (ID, alignment, size) must be manually extracted from the generated <code>flatcc</code> files, which isn’t ideal. In theory, they could be calculated or referenced in the generated code, which would be a better long-term solution.</p>

<h3 id="priority-system-1">Priority System</h3>

<p>To prevent starvation and ensure time-sensitive data gets priority, I implemented a priority system. Each sensor is assigned a priority and an age when registered. These determine the order in which sensors are processed and how much data they can package. The process is straightforward: at each iteration, <code>age_step</code> is added to the sensor’s age to track the time since its last data was sent, and then the <code>age</code> is added to the <code>priority</code> to compute the final priority. The sensor with the highest priority is selected next.</p>

<p>This system prevents starvation but isn’t perfect. Ideally, we’d also consider how much data a sensor has collected or how to optimally fill the FlatBuffer packet. However, this simple system currently meets my needs.</p>

<h3 id="putting-it-all-together">Putting It All Together</h3>

<p>With these two new systems and a limit tracker, we can now create a simple packaging loop to package and send data:</p>

<pre><code class="language-c">void pack_loop(flatcc_builder_t* builder, uint32_t budget) {
    for (; budget &gt; 0;) {
        // Priority check
        struct sensor_info* s = update_age_and_pick_sensor();
        if (s == NULL) continue;

        // Manage remaining space and package sensor data
        uint32_t bytes_written = 0;
        generic_pack(builder, &amp;s-&gt;fb_data, budget, &amp;bytes_written);
        budget -= bytes_written;
        ...
    }
}
</code></pre>

<p>Adding a simple timeout ensures the <code>pack_loop</code> doesn’t block when only a few or slow sensors are running. This results in a much better system than before. However, it still doesn’t address the initial problem of high memory usage, which brings us to the next adaptation:</p>

<h2 id="3-static-flatbuffers-1">3. Static FlatBuffers</h2>

<p>First, let’s recap how FlatBuffers works. According to <a href="https://flatbuffers.dev/" rel="nofollow">the docs</a>:</p>

<blockquote><p>FlatBuffers is an efficient cross-platform serialization library for C++, Java, Python, Go, and more.</p></blockquote>

<p>Unlike traditional serialization formats (e.g., JSON or Protobuf), FlatBuffers does not serialize or deserialize data in the conventional sense. Instead, it directly constructs a binary buffer in memory, where data is organized for zero-copy access. This means you can read fields directly from the buffer without parsing or deserialization steps.
To build this buffer, <a href="https://github.com/dvidelabs/flatcc" rel="nofollow"><code>flatcc</code></a> (the C implementation of FlatBuffers) follows a two-step process:</p>
<ol><li>It first creates intermediate vectors and tables (temporary structures) for each object defined in your <code>.fbs</code> schema.</li>
<li>It then compacts these into a single, contiguous memory block ready for transmission.
A unique aspect of FlatBuffers is its bidirectional growth mechanism. Instead of growing the buffer in one direction, it starts at the center (offset 0) and grows:</li>
<li>Data (e.g., vectors, scalars) toward negative offsets (left).</li>
<li>Metadata (e.g., VTables, which store field layouts for tables) toward positive offsets (right).
This minimizes alignment gaps and ensures the final buffer is tightly packed.</li></ol>

<pre><code>                  ┌───────┬────────┐
                  │   FB buffer    │ Emitter ctx
                  └───────┼────────┘
                    Data  │ Vtable (metadata)
 - negative offset ◄───── │ ─────► + positive offset
                          │
                       offset 0
</code></pre>

<p><strong>But why does it matter ?</strong>
By default, <code>flatcc</code> allocates this final buffer on the heap, which is problematic for embedded systems with limited memory. Fortunately, flatcc allows us to provide a custom emitter—a callback function that redirects buffer construction to a static memory region of our choosing. This avoids dynamic allocation entirely. It’s also possible to define a custom allocator for temporary vectors and objects before serialization, but that’s overkill for our needs.</p>

<p>The custom emitter consists of three parts:
– The <strong>emitter context</strong> (<code>ctx</code>), which holds all the data the emitter function needs to build the serialized buffer.
– The <strong>emitter function</strong> (<code>custom_builder_emit_fun</code>), called each time an object or vector needs to be added to the final buffer. It appends data and metadata to their respective ends of the buffer.
– The <strong>buffer itself</strong>, where the data is stored.</p>

<p>We define the buffer as a static byte array with a “center.” Typically, the center (offset 0) isn’t perfectly centered in the static buffer, as <code>flatcc</code> usually generates more data (left side) than metadata/vtable (right side):</p>

<pre><code class="language-c">#define STATIC_FB_BUFFER_SIZE (2 * 1024) // 2KB static payload buffer
#define FB_BUFFER_OFFSET_ZERO (STATIC_FB_BUFFER_SIZE * 3 / 4) // Index of offset 0
static uint8_t fb_buffer[STATIC_FB_BUFFER_SIZE] = {0};
</code></pre>

<p>Next, we define the context passed through function calls. To build the buffer and correctly determine its size, we need to store a reference to the buffer, its capacity, the center offset, and the min/max offsets:</p>

<pre><code class="language-c">typedef struct {
    uint8_t* buf;
    size_t capacity;
    flatbuffers_soffset_t zero_offset;  // Center (offset +0) of the buffer
    flatbuffers_soffset_t min_offset;   // Tracks the lowest negative offset emitted
    flatbuffers_soffset_t max_offset;   // Tracks the highest positive offset emitted
} static_emitter_context_t;
</code></pre>

<p>Now, the tricky part: the emitter function. It must strictly follow this definition:</p>

<pre><code class="language-c">int custom_builder_emit_fun(void* emit_context,
                            const flatcc_iovec_t* iov,
                            int iov_count,
                            flatbuffers_soffset_t offset,
                            size_t len);
</code></pre>

<p>Let’s break down the arguments:
– <code>emit_context</code>: A pointer to the context we defined earlier.
– <code>iov</code>: An array containing data+size pairs of the information to copy to the buffer.
– <code>iov_count</code>: The number of elements in that array.
– <code>offset</code>: The offset (positive or negative) where the data should be written.
– <code>len</code>: The combined length of all <code>iov</code> entries.</p>

<p>The workflow is straightforward:
1. Loop through the <code>iov</code> entries.
2. Calculate the final address in the buffer where the data should be copied.
3. Update the offset before writing the next entry.</p>

<p>In code, this looks like (omitting bounds checks and minor details):</p>

<pre><code class="language-c">for (int i = 0; i &lt; iov_count; ++i) {
    size_t elem_len = iov[i].iov_len;
    if (elem_len == 0) continue;

    // Calculate the final address to write to
    uint8_t* dest = &amp;ctx-&gt;buf[ctx-&gt;zero_offset + offset];

    // Copy
    memcpy(dest, iov[i].iov_base, elem_len);

    // Update the offset
    offset += (flatbuffers_soffset_t)elem_len;
}
</code></pre>

<p>Once all data is written, the lowest negative offset points to the start of a valid FlatBuffer—no further processing needed!</p>

<hr>

<h2 id="wrapping-up">Wrapping Up</h2>

<p>While I haven’t been able to work on the project as much as I’d have liked, I’m glad to see it moving forward again. I’m also happy to see my memory issues disappear, hopefully for good 😅.</p>

<p>Over the next month, I’ll try to dedicate as much time as possible to the project. Right now, I’m focusing my efforts on getting the camera to work and laying the initial foundations for the laptop → e-puck commands. This involves coordinating the radio and controller chip, as well as the Lua VM I’ve started implementing.</p>

<p><code>C</code> you next month!</p>

<p><strong>Project Github page</strong>: <a href="https://github.com/Uhrbaan/fripuck2" rel="nofollow">https://github.com/Uhrbaan/fripuck2</a></p>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg4-static-flatbuffers</guid>
      <pubDate>Wed, 05 Aug 2026 22:43:21 +0200</pubDate>
    </item>
    <item>
      <title>Fripuck devlog n°3: Meeting the professors</title>
      <link>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg3-meeting-the-professors</link>
      <description>&lt;![CDATA[Over the last two months, I was busy with my exam sessions and wasn’t able to make as much progress as I would have liked. However, I did start planning a smarter serialization approach for sensor data. Currently, all samples are packed one after another, which causes FlatBuffers to use too much RAM. The core idea is to track how much data has been packed so far and use a priority system to decide which packets get packed first. I don’t have much to show yet, though.&#xA;&#xA;During that time, I also met with my professors to discuss the project, which forced me to clarify what I want to achieve with Fripuck. I identified four key improvements I could bring:&#xA;&#xA;Data analysis&#xA;Networking&#xA;Asynchronous API&#xA;On-board programming&#xA;&#xA;Slide from my presentation explaining why I am working on the project. It reads: There are 2 reasons why I feel the need to improve the e-puck2 robot: 1. During the robotics course, a project was rendered impossible due to low data resolution. 2. Personal interest in exploring embedded systems development, a topic not fully covered in the university curriculum. Improvements on 4 aspects: enabling easy data analysis, improved networking, asynchronous API, and enabling on-board robotics.&#xA;&#xA;Data Analysis&#xA;&#xA;The current API and firmware for the robot focus on real-time data, and it is up to the user to store and analyze it. My goal is to allow the firmware to save multiple data points in batches and send them at once, providing higher time resolution. The API would then store this historical data, allowing users to query it.&#xA;&#xA;Improved Networking&#xA;&#xA;A major annoyance when working with the robot is unstable networking. When 10 students work simultaneously on 10 different robots, the network can fail. The new API should be able to reconnect the robot as quickly as possible to avoid disrupting the user.&#xA;&#xA;Planned structure for the firmware/API&#xA;&#xA;Asynchronous API&#xA;&#xA;This is another step toward improving time resolution. Currently, the Python API used to communicate with the robot relies on a single .go_on() call that sends instructions and waits for sampled data. This causes the program to spend most of its time waiting for a network response, making the robot feel unresponsive. My goal is to make data exchange happen in the background so it doesn’t interfere with the user’s code. I also want to decouple the sending and receiving of data.&#xA;&#xA;On-board Robotics&#xA;&#xA;Currently, the robot can only be controlled remotely, or the user must modify the robot’s firmware (which is not suitable for the target audience). I would like to add a small on-board interpreter, likely using Lua (since it is lightweight and easy to embed), to configure the robot and execute simple commands. This would allow users to change robot-specific features without recompiling the firmware or let students test latency when running scripts on-board or over the network.&#xA;&#xA;-------&#xA;&#xA;Going Forward&#xA;&#xA;This summer, I’ll have plenty of time to work on this project and, hopefully, complete 80% of it. Right now, the most urgent tasks are to configure my new OS (I distro-hopped to openSUSE) and create a roadmap of the features I need to implement. On the academic side, I need to identify measurable goals to evaluate the success of my project.&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Over the last two months, I was busy with my exam sessions and wasn’t able to make as much progress as I would have liked. However, I did start planning a smarter serialization approach for sensor data. Currently, all samples are packed one after another, which causes FlatBuffers to use too much RAM. The core idea is to track how much data has been packed so far and use a priority system to decide which packets get packed first. I don’t have much to show yet, though.</p>

<p>During that time, I also met with my professors to discuss the project, which forced me to clarify what I want to achieve with Fripuck. I identified <strong>four key improvements</strong> I could bring:</p>
<ul><li>Data analysis</li>
<li>Networking</li>
<li>Asynchronous API</li>
<li>On-board programming</li></ul>

<p><img src="https://gcdnb.pbrd.co/images/tIK0kPvzNYqP.png" alt="Slide from my presentation explaining why I am working on the project. It reads: There are 2 reasons why I feel the need to improve the e-puck2 robot: 1. During the robotics course, a project was rendered impossible due to low data resolution. 2. Personal interest in exploring embedded systems development, a topic not fully covered in the university curriculum. Improvements on 4 aspects: enabling easy data analysis, improved networking, asynchronous API, and enabling on-board robotics."></p>

<h3 id="data-analysis">Data Analysis</h3>

<p>The current API and firmware for the robot focus on real-time data, and it is up to the user to store and analyze it. My goal is to allow the firmware to save multiple data points in batches and send them at once, providing higher time resolution. The API would then store this historical data, allowing users to query it.</p>

<h3 id="improved-networking">Improved Networking</h3>

<p>A major annoyance when working with the robot is unstable networking. When 10 students work simultaneously on 10 different robots, the network can fail. The new API should be able to reconnect the robot as quickly as possible to avoid disrupting the user.</p>

<p><img src="https://gcdnb.pbrd.co/images/2Il63qnsW0uB.png" alt="Planned structure for the firmware/API"></p>

<h3 id="asynchronous-api">Asynchronous API</h3>

<p>This is another step toward improving time resolution. Currently, the Python API used to communicate with the robot relies on a single <code>.go_on()</code> call that sends instructions and waits for sampled data. This causes the program to spend most of its time waiting for a network response, making the robot feel unresponsive. My goal is to make data exchange happen in the background so it doesn’t interfere with the user’s code. I also want to decouple the sending and receiving of data.</p>

<h3 id="on-board-robotics">On-board Robotics</h3>

<p>Currently, the robot can only be controlled remotely, or the user must modify the robot’s firmware (which is not suitable for the target audience). I would like to add a small on-board interpreter, likely using Lua (since it is lightweight and easy to embed), to configure the robot and execute simple commands. This would allow users to change robot-specific features without recompiling the firmware or let students test latency when running scripts on-board or over the network.</p>

<hr>

<h2 id="going-forward">Going Forward</h2>

<p>This summer, I’ll have plenty of time to work on this project and, hopefully, complete 80% of it. Right now, the most urgent tasks are to configure my new OS (I distro-hopped to openSUSE) and create a roadmap of the features I need to implement. On the academic side, I need to identify measurable goals to evaluate the success of my project.</p>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg3-meeting-the-professors</guid>
      <pubDate>Tue, 30 Jun 2026 11:06:20 +0200</pubDate>
    </item>
    <item>
      <title>Fripuck devlog n°2: April update</title>
      <link>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg2-april-update</link>
      <description>&lt;![CDATA[This month I&#39;ve been quite busy with University work and had less time to focus on Fripuck. Still, I&#39;ve managed to add new sensors and solve some pesky errors !&#xA;&#xA;New sensors&#xA;The e-puck2 robot is equipped with a ring of 8 proximity sensors (IR reflectors). I followed the architecture of the previous implementation. It cleverly turns the IR ligths of the sensors on and off at specific time intervals to limit interference and measure the ambient light levels. &#xA;&#xA;This is a significant step-up of my previous implementation, which kept the IR lights always on and scanned the sensors continuously. Not only did this produce interference in the results, but also increased power consumption. &#xA;&#xA;This month also brought three sensors living on the I²C connection: the Time-of-Flight (ToF), the Inertial Measurement Unit (IMU) and the ground sensors. &#xA;&#xA;I²C stability issues&#xA;I²C is a communication protocol where a master can communicate to multiple slave on the same wire. On the e-puck2, three sensors are configured and transfer their data over I²C: the ToF, IMU and ground sensors. &#xA;&#xA;At first, the I²C connection seemed to work for the ToF, but wouldn&#39;t for the other sensors, always returning HALBUSY error. Looking online, I found that I²C can be quite unstable on some STM chips, especially when using the standard HALI2CMemRead/Write functions. I decided to copy the implementation of the vl53l0x ToF api code, which used the HALI2CMasterReceive/Transmit functions directly. &#xA;&#xA;Here is how my custom 2cread/writereg was implemented, if it can be of use for anyone: &#xA;&#xA;HALStatusTypeDef i2creadreg(uint8t devaddr, uint8t reg, uint8t buffer, uint16t len)&#xA;{&#xA;    HALStatusTypeDef res;&#xA;    osMutexAcquire(i2cmutex, osWaitForever);&#xA;&#xA;    // Announce which device/register will be sent to&#xA;    res = HALI2CMasterTransmit(i2chandle, (devaddr &lt;&lt; 1), &amp;reg, 1, 100);&#xA;&#xA;    if (res == HALOK)&#xA;    {&#xA;        // Recieve data from the slave&#xA;        res = HALI2CMasterReceive(i2chandle, (devaddr &lt;&lt; 1), buffer, len, 100);&#xA;    }&#xA;&#xA;    osMutexRelease(i2cmutex);&#xA;    return res;&#xA;}&#xA;&#xA;HALStatusTypeDef i2cwritereg(uint8t devaddr, uint8t reg, uint8t buffer, uint16t len)&#xA;{&#xA;    // Local buffer to combine reg + data&#xA;    uint8t tmp[len + 1];&#xA;    tmp[0] = reg;&#xA;    memcpy(&amp;tmp[1], buffer, len);&#xA;&#xA;    osMutexAcquire(i2cmutex, osWaitForever);&#xA;    HALStatusTypeDef res = HALI2CMasterTransmit(i2chandle, (devaddr &lt;&lt; 1), tmp, len + 1, 100);&#xA;    osMutexRelease(i2cmutex);&#xA;&#xA;    return res;&#xA;}&#xA;&#xA;Python API &#xA;The python API now internally exposes an Abstract Base Class that makes it very easy to implement the reception of new sensor data. This framework has been used to implement all the sensor management in the python API, significantly reducing code duplication. &#xA;&#xA;What&#39;s next ?&#xA;Next month, I&#39;ll be working more on my upcoming exams, so it will probably be a quite uneventful month. &#xA;&#xA;In the available time I have, I will try to come op with a good priority system to manage which sensor data gets packaged when and sent. Currently, if I let too many sensors run at once, the Flatbuffers packet will consume so much ram that the program crashes. My objective is to smartly cut up the incoming data streams to control the final size of my Flatbuffers packet and make sure no streams are getting starved.&#xA;&#xA;Wrapping up &#xA;While this month didn&#39;t bring as many features as I would have hoped, I am still happy with what I achieved considering the limited amount of free time at my disposal. I am also pleased to see the I²C issue fixed, which has been bothering me for some time now. &#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>This month I&#39;ve been quite busy with University work and had less time to focus on Fripuck. Still, I&#39;ve managed to add new sensors and solve some pesky errors !</p>

<h2 id="new-sensors">New sensors</h2>

<p>The e-puck2 robot is equipped with a ring of 8 <strong>proximity sensors</strong> (IR reflectors). I followed the architecture of the previous implementation. It cleverly turns the IR ligths of the sensors on and off at specific time intervals to limit interference and measure the ambient light levels.</p>

<p>This is a significant step-up of my previous implementation, which kept the IR lights always on and scanned the sensors continuously. Not only did this produce interference in the results, but also increased power consumption.</p>

<p>This month also brought three sensors living on the I²C connection: the <strong>Time-of-Flight</strong> (ToF), the <strong>Inertial Measurement Unit</strong> (IMU) and the <strong>ground sensors</strong>.</p>

<h2 id="i²c-stability-issues">I²C stability issues</h2>

<p>I²C is a communication protocol where a master can communicate to multiple slave on the same wire. On the e-puck2, three sensors are configured and transfer their data over I²C: the ToF, IMU and ground sensors.</p>

<p>At first, the I²C connection seemed to work for the ToF, but wouldn&#39;t for the other sensors, always returning <code>HAL_BUSY</code> error. Looking online, I found that I²C can be quite unstable on some STM chips, especially when using the standard <code>HAL_I2C_Mem_Read/Write</code> functions. I decided to copy the implementation of the <code>vl53l0x</code> ToF api code, which used the <code>HAL_I2C_Master_Receive/Transmit</code> functions directly.</p>

<p>Here is how my custom <code>2c_read/write_reg</code> was implemented, if it can be of use for anyone:</p>

<pre><code class="language-c">HAL_StatusTypeDef i2c_read_reg(uint8_t dev_addr, uint8_t reg, uint8_t *buffer, uint16_t len)
{
    HAL_StatusTypeDef res;
    osMutexAcquire(i2c_mutex, osWaitForever);

    // Announce which device/register will be sent to
    res = HAL_I2C_Master_Transmit(i2c_handle, (dev_addr &lt;&lt; 1), &amp;reg, 1, 100);

    if (res == HAL_OK)
    {
        // Recieve data from the slave
        res = HAL_I2C_Master_Receive(i2c_handle, (dev_addr &lt;&lt; 1), buffer, len, 100);
    }

    osMutexRelease(i2c_mutex);
    return res;
}

HAL_StatusTypeDef i2c_write_reg(uint8_t dev_addr, uint8_t reg, uint8_t *buffer, uint16_t len)
{
    // Local buffer to combine reg + data
    uint8_t tmp[len + 1];
    tmp[0] = reg;
    memcpy(&amp;tmp[1], buffer, len);

    osMutexAcquire(i2c_mutex, osWaitForever);
    HAL_StatusTypeDef res = HAL_I2C_Master_Transmit(i2c_handle, (dev_addr &lt;&lt; 1), tmp, len + 1, 100);
    osMutexRelease(i2c_mutex);

    return res;
}
</code></pre>

<h2 id="python-api">Python API</h2>

<p>The python API now internally exposes an Abstract Base Class that makes it very easy to implement the reception of new sensor data. This framework has been used to implement all the sensor management in the python API, significantly reducing code duplication.</p>

<h2 id="what-s-next">What&#39;s next ?</h2>

<p>Next month, I&#39;ll be working more on my upcoming exams, so it will probably be a quite uneventful month.</p>

<p>In the available time I have, I will try to come op with a good priority system to manage which sensor data gets packaged when and sent. Currently, if I let too many sensors run at once, the Flatbuffers packet will consume so much ram that the program crashes. My objective is to smartly cut up the incoming data streams to control the final size of my Flatbuffers packet and make sure no streams are getting starved.</p>

<h2 id="wrapping-up">Wrapping up</h2>

<p>While this month didn&#39;t bring as many features as I would have hoped, I am still happy with what I achieved considering the limited amount of free time at my disposal. I am also pleased to see the I²C issue fixed, which has been bothering me for some time now.</p>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/fripuck-devlog-ndeg2-april-update</guid>
      <pubDate>Wed, 29 Apr 2026 18:39:11 +0200</pubDate>
    </item>
    <item>
      <title>Devlog n°1: Fripuck march update </title>
      <link>https://writefreely.ch/leonardurban/devlog-ndeg1-fripuck-march-update</link>
      <description>&lt;![CDATA[Hi there 👋&#xA;I&#39;m Uhrbaan, and for my bachelor thesis, I am working on updating the e-puck2&#39;s codebase and API to better fit the needs of my university. &#xA;&#xA;This blog serves as a monthly update on the progress I make on that project over the next year. &#xA;&#xA;What is the e-puck ?&#xA;The robot was designed by the EPFL, who describe them the following:&#xA;&#xA;  The e-puck is an educational robot that helps generations of students learn about embedded systems and robotics. First developed at EPFL in 2004 by Francesco Mondada and Michael Bonani, a new version was released in 2018, produced by GCtronic in Ticino. [source]&#xA;&#xA;Essentially, they are small robots equipped with many small sensors to help students make their first steps into mobile robotics.&#xA;&#xA;The e-puck2 robot and its many sensors&#xA;&#xA;The e-pucks used at my university are built and maintained by GCtronic, a small Ticinese company. They are also the authors of the main code running on these robots and also produced a C API to talk to the robots over the network. This API was later replaced by a Python API made by a university student during their bachelor thesis (just like me), which later also introduced computer vision capabilities through YOLO.&#xA;&#xA;What is Fripuck ?&#xA;Fripuck is my addition to this educational tool (if it works out 😅) ! The idea to work on the e-puck2 as my bachelor thesis rose out of two frustrations I encountered while working with the robots: (1) the blocking nature of the API and (2) the focus on real-time robotics, limiting the ability for data analysis/signal processing.&#xA;&#xA;  Good software is born of frustration&#xA;    — Someone, probably&#xA;&#xA;A second reason I started this project, and why I am not only modifying/rewriting the API but also the firmware, is that I got really interested in embedded development. The university sadly doesn&#39;t have courses about embedded programming, so I figured the best I could do was learn that subject on my own, and with my limited time, doing it during my bachelor thesis seemed to be the best option. &#xA;&#xA;Fripuck itself is the combination of three pieces of software: the firmware of the STM32F4 chip that controls the robot and all the sensors, the firmware of the ESP32 responsible for the communication over Wi-Fi with the student&#39;s computer, and finally the API (Python or Go for testing).&#xA;The name of the project is a combination of e-puck and Fribourg, the university with which I am doing my thesis.&#xA;&#xA;What do I want to achieve? I technically already started the project last semester, so about 4 months ago, just as an &#34;exploratory&#34; phase. This helped me to read a bit through the existing code base, get familiar with the hardware, and explore the limitations of the chip. For example, I got a Lua VM working on one of the two chips and controlling the LEDs with it. &#xA;&#xA;For the moment, I am mostly working on re-implementing the firmware and the API to reach feature parity (mostly, some features I do not care about since the university doesn&#39;t use them) with the old software, the status quo, while still keeping some nice improvements, like the API being multi-threaded and asynchronous by default, and the firmware using a more modern build system/development environment (PlatformIO), moving away from a custom serialization protocol to use Flatbuffers and using a real-time operating system more common in the academic world (FreeRTOS over ChibiOS). &#xA;&#xA;The progress can be tracked on GitHub at https://github.com/Uhrbaan/fripuck2 (at the time of writing, the table is mostly empty and the README.md isn&#39;t even fully finished yet). &#xA;&#xA;Ideally, if I have the time, I would like to add new features as well, like a full audio stream from the robot to the clients, which would enable voice commands; a Lua VM to make the robots work offline; or even audio playback, which could make the robots talk, maybe transforming them into AI assistants, who knows! 🤷 &#xA;Another big goal would be to increase the video playback speed, but I doubt it is possible to achieve more than 10 or 15 frames per second. &#xA;&#xA;What have I achieved so far? &#xA;Right now, most of the foundations have been laid out. I have a rather precise vision of the architecture of the whole system; the firmware is working, the Python API is working, and the robot can send and receive packets serialized as FlatBuffers. The only important foundational work that is remaining is managing the commands coming from the client. &#xA;&#xA;Once that is working, there will be a lot of work to re-add all the sensors, although I will probably be able to use a lot of the existing code to achieve this. &#xA;&#xA;What are you working on right now? &#xA;Currently, I am testing the telemetry process (the robot reads a sensor, packages it, sends it over the network, and the client receives it) by implementing the simple time-of-flight sensor and sending that data over the network. Once that is working, I will proceed to work on the commands. &#xA;&#xA;Wrapping up &#xA;So far, I&#39;ve been really enjoying the process. C was the first language I ever learned, and I hope this project is going to elevate my C skills to the next level. I am also having fun discovering the world of embedded programming, although I don&#39;t find it as welcoming as other domains, since documentation and tutorials aren&#39;t as readily available. I often find myself having to read through multiple example projects to understand what I am supposed to do, but on the bright side, code reading and comprehension is equally as important of a skill to train as writing it (since AIs are going to take that away apparently 🤷). &#xA;&#xA;Next month, I&#39;ll probably go a bit more into the architecture I&#39;ve planned and some technical challenges I&#39;ve come across. Anyway, if you stayed through the whole text, thank you for your time !]]&gt;</description>
      <content:encoded><![CDATA[<p>Hi there 👋
I&#39;m <a href="https://tooting.ch/@leonardurban" rel="nofollow">Uhrbaan</a>, and for my bachelor thesis, I am working on updating the <a href="https://www.gctronic.com/doc/index.php/e-puck2" rel="nofollow">e-puck2</a>&#39;s codebase and API to better fit the needs of my university.</p>

<p>This blog serves as a monthly update on the progress I make on that project over the next year.</p>

<h2 id="what-is-the-e-puck">What is the e-puck ?</h2>

<p>The robot was designed by the EPFL, who describe them the following:</p>

<blockquote><p>The e-puck is an educational robot that helps generations of students learn about embedded systems and robotics. First developed at EPFL in 2004 by Francesco Mondada and Michael Bonani, a new version was released in 2018, produced by GCtronic in Ticino. [<a href="https://www.epfl.ch/labs/mobots/robots-technologies/e-puck2/" rel="nofollow">source</a>]</p></blockquote>

<p>Essentially, they are small robots equipped with many small sensors to help students make their first steps into mobile robotics.</p>

<p><img src="https://www.gctronic.com/doc/images/5/52/epuck2_features.png" alt="The e-puck2 robot and its many sensors"></p>

<p>The e-pucks used at my university are built and maintained by <a href="https://www.gctronic.com/" rel="nofollow">GCtronic</a>, a small Ticinese company. They are also the authors of the main code running on these robots and also produced a C API to talk to the robots over the network. This API was later replaced by a Python API made by a university student during their bachelor thesis (just like me), which later also introduced computer vision capabilities through <a href="https://en.wikipedia.org/wiki/You_Only_Look_Once" rel="nofollow">YOLO</a>.</p>

<h2 id="what-is-fripuck">What is Fripuck ?</h2>

<p>Fripuck is my addition to this educational tool (if it works out 😅) ! The idea to work on the e-puck2 as my bachelor thesis rose out of two frustrations I encountered while working with the robots: (1) the blocking nature of the API and (2) the focus on real-time robotics, limiting the ability for data analysis/signal processing.</p>

<blockquote><p>Good software is born of frustration</p>

<p>— Someone, probably</p></blockquote>

<p>A second reason I started this project, and why I am not only modifying/rewriting the API but also the firmware, is that I got really interested in embedded development. The university sadly doesn&#39;t have courses about embedded programming, so I figured the best I could do was learn that subject on my own, and with my limited time, doing it during my bachelor thesis seemed to be the best option.</p>

<p>Fripuck itself is the combination of three pieces of software: the firmware of the STM32F4 chip that controls the robot and all the sensors, the firmware of the ESP32 responsible for the communication over Wi-Fi with the student&#39;s computer, and finally the API (Python or Go for testing).
The name of the project is a combination of e-puck and Fribourg, the university with which I am doing my thesis.</p>

<h2 id="what-do-i-want-to-achieve-i-technically-already-started-the-project-last-semester-so-about-4-months-ago-just-as-an-exploratory-phase-this-helped-me-to-read-a-bit-through-the-existing-code-base-get-familiar-with-the-hardware-and-explore-the-limitations-of-the-chip-for-example-i-got-a-lua-vm-working-on-one-of-the-two-chips-and-controlling-the-leds-with-it">What do I want to achieve? I technically already started the project last semester, so about 4 months ago, just as an “exploratory” phase. This helped me to read a bit through the existing code base, get familiar with the hardware, and explore the limitations of the chip. For example, I got a Lua VM working on one of the two chips and controlling the LEDs with it.</h2>

<p>For the moment, I am mostly working on re-implementing the firmware and the API to reach feature parity (mostly, some features I do not care about since the university doesn&#39;t use them) with the old software, the <em>status quo</em>, while still keeping some nice improvements, like the API being multi-threaded and asynchronous by default, and the firmware using a more modern build system/development environment (<a href="https://platformio.org/" rel="nofollow">PlatformIO</a>), moving away from a custom serialization protocol to use <a href="https://flatbuffers.dev/" rel="nofollow">Flatbuffers</a> and using a real-time operating system more common in the academic world (FreeRTOS over ChibiOS).</p>

<p>The progress can be tracked on GitHub at <a href="https://github.com/Uhrbaan/fripuck2" rel="nofollow">https://github.com/Uhrbaan/fripuck2</a> (at the time of writing, the table is mostly empty and the <code>README.md</code> isn&#39;t even fully finished yet).</p>

<p>Ideally, if I have the time, I would like to add <em>new</em> features as well, like a full audio stream from the robot to the clients, which would enable voice commands; a Lua VM to make the robots work offline; or even audio playback, which could make the robots talk, maybe transforming them into AI assistants, who knows! 🤷
Another big goal would be to increase the video playback speed, but I doubt it is possible to achieve more than 10 or 15 frames per second.</p>

<h2 id="what-have-i-achieved-so-far">What have I achieved so far?</h2>

<p>Right now, most of the foundations have been laid out. I have a rather precise vision of the architecture of the whole system; the firmware is working, the Python API is working, and the robot can send and receive packets serialized as FlatBuffers. The only important foundational work that is remaining is managing the commands coming from the client.</p>

<p>Once that is working, there will be a lot of work to re-add all the sensors, although I will probably be able to use a lot of the existing code to achieve this.</p>

<h2 id="what-are-you-working-on-right-now">What are you working on right now?</h2>

<p>Currently, I am testing the telemetry process (the robot reads a sensor, packages it, sends it over the network, and the client receives it) by implementing the simple time-of-flight sensor and sending that data over the network. Once that is working, I will proceed to work on the commands.</p>

<h2 id="wrapping-up">Wrapping up</h2>

<p>So far, I&#39;ve been really enjoying the process. C was the first language I ever learned, and I hope this project is going to elevate my C skills to the next level. I am also having fun discovering the world of embedded programming, although I don&#39;t find it as welcoming as other domains, since documentation and tutorials aren&#39;t as readily available. I often find myself having to read through multiple example projects to understand what I am supposed to do, but on the bright side, code reading and comprehension is equally as important of a skill to train as writing it (since AIs are going to take that away apparently 🤷).</p>

<p>Next month, I&#39;ll probably go a bit more into the architecture I&#39;ve planned and some technical challenges I&#39;ve come across. Anyway, if you stayed through the whole text, thank you for your time !</p>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/devlog-ndeg1-fripuck-march-update</guid>
      <pubDate>Mon, 30 Mar 2026 21:49:48 +0200</pubDate>
    </item>
    <item>
      <title>Thoughts on the Slimbook EVO 14</title>
      <link>https://writefreely.ch/leonardurban/thoughts-on-the-slimbook-evo-14</link>
      <description>&lt;![CDATA[I’ve been using the Slimbook EVO 14 for a few days now, and here are my impressions. This is also a test of writefreely—let’s see how it goes! 😉&#xA;&#xA;My Old Laptop&#xA;&#xA;As a computer science (and biology) student, I mainly use my laptop for taking notes and doing homework. Beyond that, I’m a Linux hobbyist and enjoy programming for fun.&#xA;&#xA;Before switching to the Slimbook, I used a Lenovo Ideapad C340 14&#39;&#39; Intel with 1TB of storage and 16GB of RAM. While it served me well for about six years, several issues became hard to ignore:&#xA;&#xA;Screen quality: The 1080p resolution was too low for comfortable text reading, and the viewing angles were poor.&#xA;Battery life: The 40Wh battery degraded over time, lasting only about 1.5 hours in power-saving mode by the end.&#xA;Graphics performance: The integrated GPU struggled with anything beyond lightweight games (like Minecraft at 720p) and limited external 4K displays to 30Hz.&#xA;Build quality: The chassis cracked in places, and I had to use duct tape to hold the hinges together.&#xA;Keyboard failure: An entire row of keys stopped working, rendering the laptop unusable without an external keyboard.&#xA;&#xA;Choosing a New Laptop&#xA;&#xA;My new laptop needed to meet the following criteria:&#xA;&#xA;Better performance&#xA;More RAM&#xA;Improved screen&#xA;Under 1,000 CHF&#xA;Good Linux support&#xA;From a European company (here’s why)&#xA;&#xA;These last two points narrowed my options to Tuxedo and Slimbook. Since I carry my laptop all day, I wanted something under 15&#39;&#39;. This left me with the Slimbook EVO and the Tuxedo InfinityBook—identical machines in terms of specs. I chose the Slimbook EVO because it was cheaper and came with GNOME preinstalled.&#xA;&#xA;Review&#xA;&#xA;Hardware&#xA;&#xA;The Slimbook EVO feels well-built, especially compared to my old laptop. The aluminum chassis is sturdy and premium. The screen is a significant upgrade: better viewing angles and resolution, though the scaling is a bit awkward. At 100%, everything is too small; at 200%, too large. Fractional scaling works, but may affect battery life. The 120Hz refresh rate is smooth, but I disabled it to save power—it’s not essential for my workflow.&#xA;&#xA;The only downgrade from my previous laptop is the lack of a touchscreen, but since I use an external drawing tablet, it’s not a dealbreaker.&#xA;&#xA;Performance-wise, this laptop is a breath of fresh air. It boots in under five seconds, handles Minecraft at full resolution (with shaders!), and supports 4K displays at 60Hz. My model has 32GB of RAM and 500GB of storage. The extra RAM is a relief, and while the storage is half of what I had before, 500GB is more than enough for my needs.&#xA;&#xA;Software&#xA;&#xA;Buying from a Linux-first vendor means most drivers are preinstalled. However, I decided to install Ubuntu 25 from scratch—perhaps not the smartest move. The installation went smoothly, but I had to manually install a few packages, like the Ethernet driver (guide here).&#xA;&#xA;Facial recognition via howdy doesn’t work yet, as it depends on a library not yet ported to Ubuntu 25. For now, I’ll stick with typing my password.&#xA;&#xA;I also replaced Slimbook’s slimbook-battery (which uses TLP) with power-profiles-daemon for better GNOME integration. I might revisit this later to see if TLP offers better battery life.&#xA;&#xA;Speaking of battery, I capped the charge at 80% in the BIOS to extend its lifespan. It’s reassuring that Slimbook sells replacement batteries, which could be useful down the line.&#xA;&#xA;Final Thoughts&#xA;&#xA;I’m happy with my purchase and would recommend the Slimbook EVO 14—especially if you value Linux support and European manufacturing.&#xA;&#xA;Note: This text was re-phrased with AI (Le Chat by Mistral.ai to be precise)._]]&gt;</description>
      <content:encoded><![CDATA[<p>I’ve been using the <a href="https://slimbook.com/en/evo" rel="nofollow">Slimbook EVO 14</a> for a few days now, and here are my impressions. This is also a test of <a href="https://writefreely.org/" rel="nofollow">writefreely</a>—let’s see how it goes! 😉</p>

<h2 id="my-old-laptop">My Old Laptop</h2>

<p>As a computer science (and biology) student, I mainly use my laptop for taking notes and doing homework. Beyond that, I’m a Linux hobbyist and enjoy programming for fun.</p>

<p>Before switching to the Slimbook, I used a <a href="https://www.lenovo.com/ch/en/p/laptops/ideapad/ideapad-c-series/lenovo-ideapad-c340-14iwl/88ipc301187#tech_specs" rel="nofollow">Lenovo Ideapad C340 14&#39;&#39; Intel</a> with 1TB of storage and 16GB of RAM. While it served me well for about six years, several issues became hard to ignore:</p>
<ul><li><strong>Screen quality</strong>: The 1080p resolution was too low for comfortable text reading, and the viewing angles were poor.</li>
<li><strong>Battery life</strong>: The 40Wh battery degraded over time, lasting only about 1.5 hours in power-saving mode by the end.</li>
<li><strong>Graphics performance</strong>: The integrated GPU struggled with anything beyond lightweight games (like Minecraft at 720p) and limited external 4K displays to 30Hz.</li>
<li><strong>Build quality</strong>: The chassis cracked in places, and I had to use duct tape to hold the hinges together.</li>
<li><strong>Keyboard failure</strong>: An entire row of keys stopped working, rendering the laptop unusable without an external keyboard.</li></ul>

<h2 id="choosing-a-new-laptop">Choosing a New Laptop</h2>

<p>My new laptop needed to meet the following criteria:</p>
<ul><li><strong>Better performance</strong></li>
<li><strong>More RAM</strong></li>
<li><strong>Improved screen</strong></li>
<li><strong>Under 1,000 CHF</strong></li>
<li><strong>Good Linux support</strong></li>
<li><strong>From a European company</strong> (<a href="https://www.cnbc.com/2025/08/01/switzerland-economic-blow-with-surprise-39percent-us-tariff.html" rel="nofollow">here’s why</a>)</li></ul>

<p>These last two points narrowed my options to <a href="https://www.tuxedocomputers.com/" rel="nofollow">Tuxedo</a> and <a href="https://slimbook.com/en/" rel="nofollow">Slimbook</a>. Since I carry my laptop all day, I wanted something under 15&#39;&#39;. This left me with the Slimbook EVO and the Tuxedo InfinityBook—<strong>identical machines in terms of specs</strong>. I chose the Slimbook EVO because it was cheaper and came with GNOME preinstalled.</p>

<h2 id="review">Review</h2>

<h3 id="hardware">Hardware</h3>

<p>The Slimbook EVO feels well-built, especially compared to my old laptop. The aluminum chassis is sturdy and premium. The screen is a significant upgrade: better viewing angles and resolution, though the scaling is a bit awkward. At 100%, everything is too small; at 200%, too large. Fractional scaling works, but may affect battery life. The 120Hz refresh rate is smooth, but I disabled it to save power—it’s not essential for my workflow.</p>

<p>The only downgrade from my previous laptop is the lack of a touchscreen, but since I use an external drawing tablet, it’s not a dealbreaker.</p>

<p>Performance-wise, this laptop is a breath of fresh air. It boots in under five seconds, handles Minecraft at full resolution (with shaders!), and supports 4K displays at 60Hz. My model has 32GB of RAM and 500GB of storage. The extra RAM is a relief, and while the storage is half of what I had before, 500GB is more than enough for my needs.</p>

<h3 id="software">Software</h3>

<p>Buying from a Linux-first vendor means most drivers are preinstalled. However, I decided to install Ubuntu 25 from scratch—perhaps not the smartest move. The installation went smoothly, but I had to manually install a few packages, like the Ethernet driver (<a href="https://slimbook.com/en/blog/guides-2/post/ethernet-driver-installation-tutorial-on-evo-457" rel="nofollow">guide here</a>).</p>

<p>Facial recognition via <a href="https://github.com/boltgolt/howdy" rel="nofollow">howdy</a> doesn’t work yet, as it depends on a library not yet ported to Ubuntu 25. For now, I’ll stick with typing my password.</p>

<p>I also replaced Slimbook’s <code>slimbook-battery</code> (which uses TLP) with <code>power-profiles-daemon</code> for better GNOME integration. I might revisit this later to see if TLP offers better battery life.</p>

<p>Speaking of battery, I capped the charge at 80% in the BIOS to extend its lifespan. It’s reassuring that Slimbook sells replacement batteries, which could be useful down the line.</p>

<h3 id="final-thoughts">Final Thoughts</h3>

<p>I’m happy with my purchase and would recommend the Slimbook EVO 14—especially if you value Linux support and European manufacturing.</p>

<p><em>Note: This text was re-phrased with AI (</em>Le Chat <em>by Mistral.ai to be precise).</em></p>
]]></content:encoded>
      <guid>https://writefreely.ch/leonardurban/thoughts-on-the-slimbook-evo-14</guid>
      <pubDate>Thu, 14 Aug 2025 23:30:46 +0200</pubDate>
    </item>
  </channel>
</rss>