Streak
0 days
Core progress
0/12 lessons
Next milestone

Step 1: python-can virtual bus, send and receive

Humanoid actuator diagnostics simulator

open board →
Explain this out loud

Explain out loud: what is a slice header and why can append surprise you?

Today's session · Go · Week 1

Types, slices, maps, interfaces, errors

Concept

A slice is a view (pointer, length, capacity) over an array; appending may reallocate. Maps are reference types and not safe for concurrent writes. Interfaces are satisfied implicitly. Errors are values: return them, wrap with `fmt.Errorf("...: %w", err)`, inspect with errors.Is / errors.As.

Why it matters in robotics: Fleet services ingest messy telemetry. Clear error values beat panics when one robot sends a bad payload.

Exercise · 55 min

Write `ParseTelemetry(line string) (Reading, error)` for lines like `robot7,knee_l,71.2,3.4`. Return distinct, wrapped errors for wrong field count, bad number, and unknown joint. Write a table-driven test with at least 6 cases.

Quiz

  1. Q1. s := make([]int, 3, 3); t := append(s, 4). Do s and t share memory?

  2. Q2. What does %w do in fmt.Errorf?

  3. Q3. How does a type satisfy an interface in Go?

Resources