Glossary#
A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W
A#
- Abstract Class#
A class that cannot be instantiated directly and is designed to be subclassed. Defined by inheriting from
ABC(or settingABCMetaas the metaclass). May contain both abstract methods (which subclasses must override) and concrete methods (which are inherited as-is). Shown in UML with an italicized name and a circled A marker. L6 · L7- Abstract Method#
A method declared with the
@abstractmethoddecorator inside an abstract class. It has no required implementation in the base class (the body is typicallypassor...). Any concrete subclass that does not implement all abstract methods cannot be instantiated. Python raises aTypeErrorat instantiation time, catching the omission early. L6 · L7- Abstraction#
The principle of hiding complex implementation details behind a simple interface. Users interact with an object through its public methods without needing to know how those methods work internally. Example: calling
robot.move("north")without knowing about motor controllers or path planning. L6 · L7- Action#
A ROS 2 communication primitive for long-running, interruptible tasks. Unlike a service, an action provides continuous feedback while executing and a final result when complete. The client can cancel the goal at any time. Defined in
.actionfiles containing a goal, result, and feedback section. Example use: navigating a robot to a goal pose. L8- Action Node (BT)#
A leaf node in a behavior tree that performs work and returns
SUCCESS,FAILURE, orRUNNING. Action nodes are the only nodes allowed to returnRUNNING: they may take many ticks to complete (e.g., driving the robot, calling a service, waiting for a Nav2 action). Contrast with a Condition Node, which must give an instantaneous yes/no answer. L12- Adaptive Monte Carlo Localization#
- AMCL#
A particle-filter localization algorithm distributed with Nav2 as the
nav2_amclpackage. AMCL maintains a cloud of weighted pose hypotheses and refines it by comparing predicted LiDAR scans against the actual scan on each cycle (predict, update, resample). The “adaptive” part dynamically grows the particle count when the robot is poorly localized and shrinks it once the filter has converged. AMCL consumes/mapand publishes themap->odomtransform. L13- Aggregation#
A “has-a” relationship where the contained object (the part) can exist independently of the container (the whole). Parts are created outside the container and passed in. Example: a
TeamhasRobot(s), but dissolving the team does not destroy the robots. Represented in UML by a hollow diamond on the container side. L7- Aliasing#
When two or more variable names refer to the same object in memory. Modifying the object through one name affects all aliases. Use
.copy()or constructor calls to create independent copies. L1 · L3- ament_python#
The build type used with
ros2 pkg createfor pure-Python ROS 2 packages. Relies onsetuptoolsandsetup.pyfor installation. Contrast withament_cmake, which is used for C++ packages. L8- Argument#
A value passed to a function when it is called. Arguments are assigned to the function’s parameters. Python supports positional arguments, keyword arguments, and unpacking with
*and**. L4*args#A parameter prefix that collects any extra positional arguments into a tuple. Defined as
*argsin the function signature. Example:def func(*args):allowsfunc(1, 2, 3)whereargsis(1, 2, 3).- Arithmetic Operator#
An operator that performs mathematical computation. Python’s arithmetic operators are
+,-,*,/(true division),//(floor division),%(modulus), and**(exponentiation). L2- AST#
- Abstract Syntax Tree#
A tree representation of the syntactic structure of source code produced by the parser. Each node represents a construct in the language (e.g., assignment, binary operation). Python exposes this through the
astmodule. L1- Assignment Operator#
The
=symbol in Python, which binds a name (variable) to an object. Unlike in some languages,=does not copy a value into a memory location – it creates a reference from the name to the object. L1 · L2- Association#
A general relationship between two objects where one object holds a reference to another for a period of time. Neither object owns the other, and both can exist independently. Can be unidirectional (only one class knows about the other) or bidirectional. Example: a
Robotis assigned aTask; the task exists before and after the robot executes it. The associated object is passed in as a parameter, not created inside the class. L7- Augmented Assignment#
A shorthand that combines an arithmetic operation with assignment, e.g.,
x += 5is equivalent tox = x + 5. Other forms include-=,*=,/=,//=,%=, and**=. L2
B#
- Bag (ROS 2)#
- ROS 2 Bag#
A directory of recorded ROS 2 messages produced by
ros2 bag recordand replayed withros2 bag play. Each bag preserves the original topic name, message type, and timestamp so downstream nodes receive the data exactly as if the original publishers were still running. The directory contains ametadata.yamldescribing topics and message counts plus one or more storage files (.db3for SQLite3 or.mcapfor MCAP). Bags are used for offline debugging, regression testing, dataset creation, and remote-run analysis. L14- Base Case#
The condition in a recursive function that stops the recursion. Without a base case, the function will recurse until Python raises a
RecursionError. Example:if n <= 1: return 1in a factorial function. L4The high-level Python class shipped by
nav2_simple_commander. Wraps theNavigateToPoseand waypoint-follower action clients so a script can callsetInitialPose,waitUntilNav2Active,goToPose,followWaypoints,isTaskComplete,getFeedback,getResult, andcancelTaskwithout writing any action plumbing. Internally creates its ownrclpynode. L13- Behavior Tree#
A hierarchical model for task execution used in robotics and game AI. Internal nodes are composites (Sequence, Fallback) that decide how the tree branches; leaf nodes are actions and conditions that do the work. Every tick propagates from the root and each node returns
SUCCESS,FAILURE, orRUNNING. In this course, students build application-level behavior trees with the py_trees library to coordinate Nav2 navigation actions; Nav2 itself uses an internal behavior tree (BehaviorTree.CPP) to orchestrate planning, control, and recovery. L12 · L13- bool#
Python’s Boolean type, a subclass of
intwith exactly two instances:True(1) andFalse(0). The built-inbool()function converts any value to a Boolean using truthiness rules. L1 · L2- break#
A statement that immediately exits the innermost enclosing
fororwhileloop. Whenbreakexecutes, anyelseclause attached to the loop is skipped. L3- Built-in Scope#
The outermost scope in the LEGB rule, containing Python’s pre-defined names such as
print,len,int,True, andNone. These are defined in thebuiltinsmodule. L4- Business Rule#
A constraint, trigger, or computation that the system must enforce as part of domain logic. Business rules directly influence class design by determining which validations go into methods, which attributes need constraints, and which relationships must be enforced. Identified with prefixes: BR-C (constraint), BR-T (trigger), BR-D (computation). L6
- Bytecode#
A low-level, platform-independent set of instructions generated by the Python compiler from the AST. Stored in
.pycfiles inside__pycache__/for imported modules. Executed by the interpreter loop. L1
C#
- Callback#
A function passed as an argument to another function, or registered with a framework, to be called at a later time. In Python generally, callbacks are used in event-driven programming. In ROS 2 specifically, a callback is registered with the executor and invoked automatically when a triggering event occurs – an incoming topic message, a timer expiration, a service request, or an action goal. Callbacks only execute while the node is spinning and should be kept fast; a slow callback blocks the executor and starves other pending callbacks. L8 · L9
- Callback Group#
A container within a ROS 2 node that holds a set of callbacks (for timers, subscriptions, services, or actions) and defines the concurrency rules that govern them. Two types exist:
MutuallyExclusiveCallbackGroup(only one callback in the group executes at a time) andReentrantCallbackGroup(multiple callbacks in the group can run concurrently on separate threads). All callbacks in a node belong to an implicit mutex group by default. Explicit groups are created to override this behavior. L9- Callable#
Any object that can be invoked using parentheses
(). In Python, callables include functions defined withdef, lambda expressions, classes (calling a class creates an instance), instances with a__call__method, and built-in functions. Usecallable(obj)to check. L5- Call Stack#
The data structure Python uses to track active function calls. Each function call creates a frame object that is pushed onto the stack. When the function returns, its frame is popped. The stack enables nested and recursive function calls. L4
- CamelCase#
A naming convention where each word starts with a capital letter and no underscores are used. In Python, class names follow CamelCase by convention (e.g.,
RobotArm,SensorFusion), while functions and variables usesnake_case. L1 · L6- Cell Object#
An internal CPython mechanism used to share variables between enclosing and nested functions. Cell objects are mutable containers that hold a single reference, enabling the
nonlocalkeyword to work across scope boundaries. L5- Chained Assignment#
Binding multiple names to the same object in a single statement, e.g.,
x = y = 10. All names reference the identical object. L1 · L2- Chained Comparison#
A Python feature that allows multiple relational operators in a single expression, e.g.,
1 < x < 10is equivalent to1 < x and x < 10. Each operand is evaluated at most once. L2change_stateService#The service of type
lifecycle_msgs/srv/ChangeStatethat every lifecycle node automatically advertises at/<node_name>/change_state. Clients submit aTransitionrequest whoseidfield selects the desired transition (TRANSITION_CONFIGURE,TRANSITION_ACTIVATE, etc.); the response carries asuccessboolean. Theros2 lifecycle setCLI is just one client of this service – a node can also call it on itself to drive its own transitions programmatically. L14- Circumscribed Radius#
The radius of the smallest circle that encloses the robot’s footprint. Any cell at distance greater than this radius from an obstacle is guaranteed to be safe regardless of the robot’s heading. The Nav2 inflation radius is typically set at least as large as the circumscribed radius so the planner steers the robot far enough from walls. Compare with Inscribed Radius. L13
- Class#
A blueprint that defines the attributes (data) and methods (functions) that its objects will have. Defined using the
classkeyword followed by the name in CamelCase. In Python 3, all classes implicitly inherit fromobject. L6- Class Attribute#
An attribute defined inside the class body but outside any method. Shared by all instances of the class. Accessed via the class name (
ClassName.attr) or via any instance. Commonly used for constants and counters (e.g.,total_robots). L6 · L7- Class Method#
A method defined with the
@classmethoddecorator. It receives the class itself as its first argument (conventionally namedcls) rather than an instance. Class methods can access and modify class-level state and are commonly used as factory methods or alternative constructors. Callingcls(...)inside a class method ensures correct behavior in subclasses. L7- Closure#
A function that retains access to variables from its enclosing scope, even after the enclosing function has finished executing. Three conditions are required: a nested function, a reference to a free variable from the enclosing scope, and the enclosing function returning the nested function. The captured variables are stored in cell objects accessible via
__closure__. L5- Code Smell#
A surface-level indicator in source code that suggests a deeper problem. The term was coined by Martin Fowler in Refactoring: Improving the Design of Existing Code. Linters like Ruff detect common code smells automatically. L1
- colcon#
The official build tool for ROS 2 (collective construction). It replaces the ROS 1 build tools (
catkin_make,catkin build). Builds all packages found undersrc/, supports parallel builds, and producesbuild/,install/, andlog/directories. Key flags:--symlink-install(links Python files instead of copying),--packages-select <pkg>(builds one package only). L8- Compiled Language#
A language whose source code is translated directly into native machine code by a compiler before execution. Examples: C, C++, Rust, Go. L1
- Comprehension#
A concise syntax for creating collections by transforming and/or filtering elements from an iterable. Python supports list comprehensions (
[x for x in iter]), dictionary comprehensions ({k: v for k, v in iter}), set comprehensions ({x for x in iter}), and generator expressions ((x for x in iter)). L3- Composite Node (BT)#
An internal node in a behavior tree that has one or more children and decides how their results are combined. The two primary composites are the Sequence Node (logical AND – fail on first failure) and the Fallback (BT) / Selector (logical OR – succeed on first success). Composites are the only nodes with children; leaves (actions and conditions) do the actual work. L12
- Composition#
A “has-a” relationship where the contained objects (the parts) cannot exist independently of the container (the whole). Parts are created inside the container’s
__init__and their lifetime is tied to the whole. Example: aRobotowns itsSensor(s); destroying the robot destroys its sensors. Represented in UML by a filled diamond on the container side. L7- Concatenation#
Joining strings end-to-end. In Python, use the
+operator for a small number of strings orstr.join()for joining many strings efficiently. L2- Concrete Class#
A class that provides implementations for all abstract methods it inherits and can therefore be instantiated directly. Shown in UML with a circled C marker. L6 · L7
- Condition Node#
A leaf node in a behavior tree that checks a predicate and returns
SUCCESS(true) orFAILURE(false). Condition nodes never returnRUNNING– they must give an instantaneous yes/no answer. Typical examples:GoalNotReached?,BatteryLow?,ObstacleDetected?. Combined with composites, they make the tree reactive to changing conditions. L12- Conditional Expression#
- Ternary Expression#
A single-line
if/elseconstruct that produces a value:value_if_true if condition else value_if_false. Useful for simple assignments but should not replace multi-lineifblocks for complex logic. L2- Container#
A lightweight, isolated environment that packages an application with its dependencies. In this course, Docker containers ensure a consistent development environment across platforms. See also Docker, Dev Containers. L1
- Costmap#
A 2D grid maintained by Nav2 that assigns a traversal cost to every cell. A cost of zero means the cell is freely traversable; a lethal cost means the robot’s footprint would collide if placed there. Costmaps are built by stacking layers (static, obstacle, inflation). Nav2 maintains both a global costmap (whole map, used by the planner) and a local costmap (rolling window around the robot, used by the controller). L13
- continue#
A statement that skips the rest of the current loop iteration and proceeds to the next iteration. Unlike
break, the loop continues running.create_lifecycle_publisher#The lifecycle-aware factory used inside a LifecycleNode to create a publisher that respects the node’s active/inactive state. Unlike
create_publisher, the returned publisher silently discards messages while the node is not Active, preventing premature data from being delivered. The publisher is enabled bysuper().on_activate(state)and disabled bysuper().on_deactivate(state). L14- CPython#
The reference (default) implementation of Python, written in C. When you run
python3, you are running CPython. It compiles source code to bytecode and executes it via an evaluation loop. CPython 3.14 introduces officially supported free-threaded builds (python3.14t). L1- Cython#
A superset of Python that compiles to C, then to native machine code. Used to write high-performance C extensions with Python-like syntax. L1
D#
- Data Class#
A class decorated with
@dataclass(from thedataclassesmodule, introduced in Python 3.7) that auto-generates__init__,__repr__, and__eq__from its type-annotated fields. Type hints are required; fields without annotations are ignored. Supports default values, mutable defaults viafield(default_factory=...), post-initialization logic via__post_init__, and immutable variants viafrozen=True. Best suited to classes whose primary purpose is storing data. L7- DWB Controller#
A Nav2 local controller (Dynamic Window-based) that samples a set of candidate
(linear, angular)velocity pairs each control cycle, simulates each one forward over the local costmap, scores the resulting trajectories via critic plugins (path alignment, goal heading, obstacle distance, etc.), and publishes the best-scoring command on/cmd_vel. Best suited to crowded, dynamic environments. Compare with Regulated Pure Pursuit. L13- DDS (Data Distribution Service)#
An open, data-centric publish-subscribe middleware standard managed by the Object Management Group (OMG). DDS is the communication layer beneath ROS 2. It provides decentralized discovery, transport-independent messaging (UDP, TCP, shared memory), and fine-grained QoS control. The underlying wire protocol is RTPS (Real-Time Publish-Subscribe). Common ROS 2 implementations include Fast DDS (eProsima), Cyclone DDS (Eclipse), and Connext DDS (RTI). L8
- DeclareLaunchArgument#
A ROS 2 launch action that declares a named argument for a launch file, optionally with a default value and description. The argument can then be referenced anywhere in the file via
LaunchConfiguration("arg_name"). Arguments expose tunable knobs to the caller without modifying the launch file source. L9- Deep Copy#
A copy operation that recursively duplicates all nested objects, creating a completely independent copy. Performed using
copy.deepcopy(). Contrast with Shallow Copy. L3- Default Argument#
A parameter value specified in the function definition that is used when the caller does not provide that argument. Default values are evaluated once at definition time, not at each call. Mutable defaults (like lists) should be avoided; use
Noneinstead. L4- Default Value Pattern#
A common Python idiom using
orto provide fallback values:name = user_input or "Anonymous". Whenuser_inputis empty or falsy,"Anonymous"is assigned instead. L4- Design Phase#
The process of translating a real-world problem into a workable software structure before writing any code. Includes requirement analysis, business rules, noun/verb analysis, UML modeling, and implementation planning. L6
- Design Smell#
A sign in your code that something is structurally wrong with your design, even if the code technically works. Not a bug – the program runs – but the design will cause problems as the codebase grows. Analogous to “code smell” but applied at the class and relationship level. Classic example: a base class carrying
Nonevalues for attributes that only apply to some subclasses, signaling that specialization is needed. L6 · L7- Dev Containers#
A VS Code feature that allows development inside a Docker container. The
ms-vscode-remote.remote-containersextension opens a project folder in a containerized environment with all dependencies pre-installed. L1- Decorator#
A function that takes another function as input, adds functionality, and returns a new function (or the same function modified). The
@decoratorsyntax placed above a function definition is syntactic sugar forfunc = decorator(func). Decorators are used for cross-cutting concerns such as logging, timing, access control, and caching. L5 · L6- Decorator Factory#
A function that accepts arguments and returns a decorator. Used when a decorator itself needs to be parameterized. Requires three levels of nesting:
factory(args) -> decorator(func) -> wrapper(*args, **kwargs). Example:@repeat(3)whererepeatis the factory. L5- Decorator Node (BT)#
A node in a behavior tree that wraps a single child and modifies how its return status is reported. Common
py_trees.decoratorsexamples includeTimeout(returnsFAILUREif the child staysRUNNINGlonger than a duration),Inverter(flipsSUCCESSandFAILURE),Retry(re-ticks onFAILURE), andOneShot(returns the same status forever after the child completes). Distinct from a Python@decoratorfunction. L12- Dictionary#
- dict#
A mutable mapping type that stores key-value pairs. Keys must be hashable. Since Python 3.7, dictionaries maintain insertion order. Access values with
d[key]ord.get(key). L3- Dictionary Comprehension#
A concise syntax for creating dictionaries:
{key_expr: val_expr for item in iterable if condition}. Returns a newdictobject. L3- Difference#
A set operation returning elements in the first set but not in the second. Performed with
-operator or.difference()method.{1, 2, 3} - {2, 3, 4}returns{1}. L3- Dispatch Table#
A dictionary that maps keys (such as strings) to functions. Used to select and call a function based on a runtime value, replacing long
if/elifchains. Example:operations = {"add": add, "multiply": multiply}. L5- Docstring#
A string literal that appears as the first statement in a function, class, or module. Used to document the purpose, parameters, and return value. Accessible at runtime via
func.__doc__. This course uses Google-style docstrings withArgsandReturnssections. L4 · L6- Docker#
A platform for building and running containers. Docker Desktop provides a GUI and CLI (
docker) for managing containers on Windows, macOS, and Linux. L1- Dot Notation#
The syntax used to access attributes and methods on an object:
obj.attributeorobj.method(). Python uses dot notation for all member access. L6- Duck Typing#
The runtime mechanism Python uses to achieve polymorphism. An object is compatible with an interface if it has the required methods, regardless of its type or class hierarchy. The name comes from the saying: “If it walks like a duck and quacks like a duck, then it must be a duck.” Python checks what an object can do, not what it is. Duck typing is flexible but provides no compile-time guarantee; abstract base classes and protocols add that safety net. L7
- Dunder Method#
A Python method with double leading and trailing underscores (e.g.,
__init__,__str__,__add__). Dunder methods enable operator overloading and integration with built-in functions. “Dunder” is short for “double underscore.” L6 · L7- Durability (QoS)#
A QoS policy that controls whether messages are cached for late-joining subscribers.
TRANSIENT_LOCALretains the last published message and delivers it to any subscriber that connects after the fact.VOLATILE(default) discards messages immediately if no matching subscriber is currently connected. L8- Dynamic Typing#
A type system where the type is associated with the value (object), not the variable name. A variable can be rebound to objects of different types during execution. Types are checked at runtime. L1 · L2
E#
- Editable Install#
Installing a Python package in development mode using
pip install -e .. Changes to the source code take effect immediately without reinstalling. Requires apyproject.tomlfile. The most portable and professional approach for making packages discoverable. L2- Encapsulation#
The bundling of data (attributes) with the methods that operate on that data, while restricting direct access to internal state. In Python, encapsulation is achieved by convention: prefix non-public attributes with an underscore (
_attr) and provide controlled access through@propertydecorators. L6- Enclosing Scope#
The scope of an outer function when using nested functions. In the LEGB rule, Python checks the enclosing scope after the local scope. Variables in the enclosing scope can be read by inner functions and modified using the
nonlocalkeyword. L4 · L5- Entry Point#
A mapping in
setup.py(underconsole_scripts) that associates a command name with a Python function. The format is'<command> = <module>:<function>'. After building the workspace,ros2 run <pkg> <command>invokes that function. A newcolcon buildis required after adding or changing entry points. L8- enumerate()#
A built-in function that returns an iterator of tuples, each containing an index and the corresponding value from an iterable.
enumerate(["a", "b"], start=1)yields(1, "a"), (2, "b"). More Pythonic thanrange(len(...)).- Equality#
Comparison of values using the
==operator. Two distinct objects can be equal if they contain the same data. Contrast with Identity. L1 · L2- Escape Sequence#
A backslash-prefixed character combination inside a string literal that represents a special character, e.g.,
\n(newline),\t(tab),\\(literal backslash),\"(literal double quote). Suppressed by using a raw string (r"..."). L2- Executor#
The ROS 2 component responsible for managing the spin loop and dispatching callbacks to threads. When you call
rclpy.spin(node), ROS 2 creates a default single-threaded executor internally and hands it your node. The executor maintains a queue of pending callbacks and dispatches them one by one. Multiple nodes can be added to one executor. L8 · L9- else Clause (Loop)#
An optional clause after a
fororwhileloop that executes only if the loop completes normally (withoutbreak). Useful for search patterns where you need to know if an item was found.
F#
- Factory Method#
A class method that constructs and returns a new instance with a predefined or computed configuration. Uses
cls(...)rather than the class name directly, so the factory works correctly in subclasses. Example:Robot.create_scout()returns aRobotconfigured as a scout without the caller needing to know the default values. Factory methods can also return collections of instances. L7- Fallback (BT)#
- Selector (BT)#
A composite node (also called a Selector) that ticks its children left to right and returns
SUCCESSas soon as any child succeeds. If every child fails, the Fallback returnsFAILURE. Logical OR. Used to express “try this; if it fails, try that” recovery strategies. Compare with Sequence Node. L12- Falsy#
A value that evaluates to
Falsewhen passed tobool(). Python’s falsy values are:0,0.0,"",[],(),{},set(),None, andFalseitself. Contrast with Truthy. L2 · L3- Foxglove Studio#
A free, cross-platform robotics visualization tool that opens MCAP bags directly (no transcoding) and renders multi-panel layouts (3D, Plot, Image, Raw Messages, Diagnostics) driven from a shared timeline. Available as desktop apps for Linux / macOS / Windows and as a browser app at
app.foxglove.dev(bag stays local; nothing is uploaded). Can also connect to a live ROS 2 system over the Foxglove WebSocket bridge. Used in this course for offline analysis of navigation runs recorded as MCAP bags. L14- First-Class Object#
An entity that can be assigned to a variable, passed as an argument, returned from a function, and stored in a data structure. In Python, functions are first-class objects, which means they can be manipulated like any other value (integers, strings, lists). L5
- Floor Division#
Integer division that rounds toward negative infinity, performed by the
//operator.10 // 3is3;10 // -3is-4(not-3). L2- Footprint#
The 2D polygon that represents the robot’s outline in the
base_linkframe. Nav2 uses the footprint, in conjunction with the costmap, to decide which cells are lethal: a cell is lethal if placing the footprint there would overlap an obstacle. Differential-drive robots are often modelled as a circular footprint so that orientation drops out of collision checking (the inscribed and circumscribed radii coincide). See Inscribed Radius, Circumscribed Radius. L13- for Loop#
A control structure that iterates over items in an iterable. Syntax:
for item in iterable:. The loop variable takes each value from the iterable in turn.- Formatter#
A tool that automatically rewrites source code to conform to a consistent style (indentation, spacing, line length). Ruff and Black are popular Python formatters. L1
- Frame Object#
A heap-allocated
PyFrameObjectstruct created by CPython for each function call. Contains the local variables array (f_localsplus), a pointer to the globals dictionary (f_globals), the builtins dictionary (f_builtins), and a back-pointer to the caller’s frame (f_back). L4- Free Variable#
A variable referenced inside a function that is not defined in that function’s local scope. In the context of closures, free variables are defined in the enclosing function’s scope and captured by the inner function via cell objects. L5
- fromkeys()#
A
dictclass method that creates a new dictionary with keys from an iterable and all values set to a specified default.dict.fromkeys(["a", "b"], 0)returns{"a": 0, "b": 0}.- Frozen Data Class#
A data class created with
@dataclass(frozen=True). All fields are immutable after construction; any attempt to assign to a field raisesFrozenInstanceError. Frozen instances are hashable and can be used as dictionary keys or set members. Suitable for records that should never change after creation, such as sensor readings or event logs. L7- f-string#
- Formatted String Literal#
A string literal prefixed with
forFthat allows embedded Python expressions inside curly braces:f"Hello, {name}". Introduced in Python 3.6. Supports format specifiers such as.2f(two decimal places) and>20(right-align in 20 characters). L2functools.partial#A function from the
functoolsmodule that creates a new callable with some arguments of the original function pre-filled (“frozen”). The returned partial object has.func,.args, and.keywordsattributes for introspection. L5functools.wraps#A decorator from the
functoolsmodule that copies metadata (__name__,__doc__,__module__,__qualname__,__annotations__,__dict__,__wrapped__) from the original function onto a wrapper function. Essential for preserving introspection in decorators. L5- Function#
A named, reusable block of code defined with the
defkeyword. Functions accept input through parameters, execute a body of statements, and optionally return a value. They are first-class objects in Python. L4- Functional Programming#
A programming paradigm that expresses computation as the evaluation of mathematical functions. Emphasizes pure functions, immutability, avoiding side effects, and higher-order functions. Python supports functional programming alongside procedural and object-oriented styles. L5
G#
- Gazebo Harmonic#
A robotics simulation environment used in this course. Students build and test robot behaviors in Gazebo before deploying to real hardware. L1
- generate_launch_description#
The entry-point function that every Python ROS 2 launch file must define. It takes no arguments and returns a
LaunchDescriptionobject containing all the actions (nodes, arguments, includes, conditionals) to execute when the file is launched. ROS 2 discovers and calls this function viaros2 launch. L9- Generalization#
A bottom-up design activity in which common attributes and behaviors shared by multiple classes are identified and moved into a new shared base class. The result is a parent class that captures what all subclasses have in common, reducing duplication. Contrast with specialization. L7
- GIL#
- Global Interpreter Lock#
A mutex inside the CPython interpreter that allows only one thread to execute Python bytecode at a time, regardless of how many CPU cores are available. The GIL exists to protect CPython’s internal memory management from concurrent modification. It is released during blocking I/O,
time.sleep(), and calls into native extension libraries (NumPy, OpenCV). As a result, aMultiThreadedExecutorin ROS 2 provides concurrency (tasks interleave on one core) rather than true parallelism for pure Python callbacks. True parallelism is achievable only when callbacks release the GIL. CPython 3.13+ offers experimental free-threaded builds without the GIL. L1 · L9- Global Scope#
The module-level scope containing variables defined outside of any function. In the LEGB rule, Python checks the global scope after local and enclosing scopes. The
globalkeyword allows a function to modify variables in this scope. L4globalKeyword#A statement that declares a variable inside a function as referring to the module-level (global) variable of the same name. Without it, assignment inside a function creates a new local variable.
- GraalPy#
A Python implementation running on GraalVM with JIT compilation and polyglot interoperability with other languages (Java, JavaScript, Ruby, etc.). L1
- GroupAction#
A ROS 2 launch action that wraps a list of other actions and applies shared properties – most usefully a
condition– to all of them at once. If the condition evaluates to false, none of the enclosed actions are executed. UsingGroupActioneliminates the need to attach the same condition to every individualNodeaction in a related set. L9
H#
- Hashable#
An object is hashable if it has a hash value that never changes during its lifetime and can be compared to other objects. Immutable built-in types (
int,str,tuple) are hashable. Mutable types (list,dict,set) are not. Only hashable objects can be dictionary keys or set elements. L3- Higher-Order Function#
A function that takes one or more functions as arguments, returns a function, or both. Built-in examples include
map,filter, andsorted(with itskeyparameter). Decorators are also higher-order functions. L5
I#
- Identity#
The unique integer (memory address) associated with every Python object, returned by
id(). Two names have the same identity only if they reference the exact same object. Tested with theisoperator. Contrast with Equality. L1 · L2- Identity Operator#
The
isandis notoperators, which test whether two names reference the exact same object in memory (sameid). Useisonly for None checks; use==for value comparison. L1 · L2- Immutable#
An object that cannot be changed after creation. Operations that appear to modify an immutable object actually create a new object. Examples:
int,float,str,tuple,bool,NoneType. L1 · L3- Immutability#
The property of an object whose state cannot be changed after creation. In functional programming, immutability is preferred because it eliminates side effects and makes code easier to reason about. Python’s built-in immutable types include
int,str,tuple, andfrozenset. L1 · L3 · L5- import#
A statement that makes names from another module or package available in the current namespace. Common forms:
import math,from math import sqrt,import math as m. L2- In-Place Operation#
An operation that modifies an object directly rather than creating a new object. List methods like
append(),sort(), andreverse()are in-place and returnNone. Contrast with Out-of-Place Operation. L3- Indentation#
Whitespace at the beginning of a line that defines a code block in Python. PEP 8 prescribes 4 spaces per level. Mixing tabs and spaces causes
IndentationError. L2- Inflation Layer#
A Nav2 costmap layer that expands lethal cells outward by a configurable
inflation_radius, producing a graded cost gradient that decays with distance. The planner naturally prefers paths that stay away from walls, even though the footprint itself is not modelled at every cell. The radius is typically set at least as large as the robot’s circumscribed radius. L13- Inscribed Radius#
The radius of the largest circle that fits inside the robot’s footprint. Any cell at distance less than this radius from an obstacle is lethal regardless of the robot’s heading. Compare with Circumscribed Radius. L13
- Inheritance#
A mechanism that allows a class (the child or derived class) to reuse and extend the attributes and methods of another class (the parent or base class). Represents an “is-a” relationship. Python supports single, multi-level, multiple, and hierarchical inheritance. The child uses
super().__init__()to delegate parent attribute initialization. Prefer composition over inheritance when the relationship is “has-a” rather than “is-a”. L7- Instance#
A concrete realization of a class, also called an object. Created by calling the class as if it were a function:
obj = ClassName(args). Each instance has its own attribute values and operates independently of other instances. L6- Instance Attribute#
An attribute that belongs to a specific object. Created inside
__init__usingself.attr = value. Each instance maintains its own copy, so modifying one instance does not affect others. L6- Instance Method#
A standard method that receives the instance as its first argument (conventionally named
self). Has access to both instance state and class state. The most common method type in Python. Contrast with class methods and static methods. L7- Integer Cache#
A CPython implementation detail where small integers (typically
-5through256) are pre-allocated and reused. Two variables assigned the same small integer may share the sameid(). Do not rely on this behavior in production code. L2- IntelliSense#
A code-completion and assistance feature in Visual Studio Code that provides context-aware suggestions, parameter hints, and documentation as you type. L1
- IfCondition#
A ROS 2 launch condition that evaluates a
LaunchConfigurationor other substitution to a Boolean. When passed as theconditionargument to aNodeorGroupAction, the action is executed only if the evaluated string equals"true"(case-insensitive). The complementary classUnlessConditioninverts the logic. L9- Interface (ROS 2)#
A typed data contract shared between nodes. Defined in plain-text
.msg(messages),.srv(services), or.action(actions) files. At build time these files are compiled into language-specific Python and C++ code. The same.msgfile generates Python, C++, and other bindings – publishers and subscribers must use the same interface type to communicate. L8- Interning#
A CPython optimization that reuses the same object for small integers (typically
-5through256) and compile-time string constants. Never rely on interning for correctness. L2- Interpreted Language#
A language whose source code is compiled to intermediate bytecode and executed by an interpreter rather than directly by the CPU. Python, JavaScript, and Ruby are interpreted languages. L1
- Intersection#
A set operation returning elements present in both sets. Performed with
&operator or.intersection()method.{1, 2, 3} & {2, 3, 4}returns{2, 3}. L3- IronPython#
A Python implementation that compiles to .NET Intermediate Language (IL) and runs on the Common Language Runtime (CLR). Provides access to .NET libraries and does not have a GIL. L1
- Iterable#
Any object capable of returning its elements one at a time. This includes sequences (lists, strings, tuples), mappings (dictionaries), sets, files, and generators. An iterable can be used in a
forloop or passed to functions likelist(),sum(), orenumerate(). L3 · L4- Iterator#
An object representing a stream of data that returns successive items via the
__next__()method. Iterators remember their position in the data stream. All iterators are iterables, but not all iterables are iterators. L3__init__#A special dunder method called automatically when a new instance is created. Used to initialize the object’s attributes. It is an initializer, not a constructor; the actual constructor is
__new__, which is rarely overridden. L6
J#
- JIT Compilation#
- Just-In-Time Compilation#
A technique where bytecode is compiled to native machine code at runtime, typically for frequently executed (“hot”) code paths. PyPy uses JIT compilation to achieve significant speedups over CPython. L1
- Jython#
A Python implementation that compiles to Java bytecode and runs on the Java Virtual Machine (JVM). Provides direct access to Java libraries and does not have a GIL. L1
K#
- Key (Dictionary)#
The identifier used to access a value in a dictionary. Keys must be hashable (immutable). Common key types are strings, integers, and tuples. L3
- Keyword Argument#
An argument passed to a function by explicitly naming the parameter:
func(name="Alice"). Keyword arguments can appear in any order and make function calls more readable. L4**kwargs#A parameter prefix that collects any extra keyword arguments into a dictionary. Defined as
**kwargsin the function signature. Example:def func(**kwargs):allowsfunc(x=1, y=2)wherekwargsis{'x': 1, 'y': 2}. L4
L#
- Lambda#
A small anonymous function defined with the
lambdakeyword. Limited to a single expression (no statements, no multi-line logic, no docstrings, no type hints). Commonly used as short inline callbacks forsorted(key=...),map, andfilter. PEP 8 discourages assigning lambdas to variable names. L5- Launch File#
A Python script (
*.launch.py) that starts multiple ROS 2 nodes from a single command usingros2 launch. All node output appears in one terminal, prefixed by node name. A single Ctrl-C stops the entire system. Preferred overros2 runfor integration testing and running a complete system. L8 · L9- LaunchConfiguration#
A substitution that reads the current value of a named launch argument at the time it is evaluated. Used together with
DeclareLaunchArgumentto make launch file behavior configurable from the command line or from a parent launch file. The value is always a string; usePythonExpressionto convert it to another type. L9- Lazy Evaluation#
A strategy where values are computed only when needed.
range()uses lazy evaluation – it doesn’t store all values in memory but generates them on demand. This makesrange(1000000000)use the same memory asrange(10). L3- Lazy Iterator#
An object that produces values one at a time on demand rather than computing all values upfront.
mapandfilterreturn lazy iterators in Python 3. Wrap inlist()to materialize all results. L3 · L5- LEGB Rule#
The order in which Python resolves variable names: Local, Enclosing, Global, Built-in. Python searches each scope in this order and uses the first match found. This is the fundamental mechanism for variable name resolution in Python. L4
- Leaf Node (BT)#
A node in a behavior tree with no children. Leaves do the actual work and are split into two kinds: action nodes (perform a task; may return
RUNNING) and condition nodes (check a predicate; never returnRUNNING). All other BT nodes are composites or decorators. L12- Lifecycle Manager#
A coordinator node (e.g., Nav2’s
lifecycle_manager) that drives a fixed set of lifecycle nodes through their transitions in a defined order, can pause and resume the stack at runtime, and shuts everything down cleanly on error. Nav2 managesmap_server,amcl,planner_server,controller_server, andbt_navigatorthis way. L14- Lifecycle Node#
A ROS 2 node that follows the standardized state machine defined by REP 2002: Unconfigured, Inactive, Active, and Finalized. Rather than starting work the moment it is constructed, the node waits for explicit transition commands (
configure,activate,deactivate,cleanup,shutdown) issued via theros2 lifecycleCLI or programmatically through thechange_stateservice. Resources are allocated in transition callbacks (on_configure,on_activate) and released in their counterparts, which gives the system precise control over initialization order, runtime pause/resume, and clean shutdown. L14- LifecycleNode#
The Python base class (
rclpy_lifecycle.LifecycleNode) that students extend to implement a lifecycle node. Provides hooks for the four primary transition callbacks (on_configure,on_activate,on_deactivate,on_cleanup) plus optionalon_shutdownandon_error. Used together withcreate_lifecycle_publisher. L14- Lifecycle Publisher#
A publisher created via
create_lifecycle_publisherinside a LifecycleNode. It exists in an inactive state by default and silently discards published messages untilsuper().on_activate(state)enables it; a subsequentsuper().on_deactivate(state)disables it again without destroying the publisher object. Prevents data from being sent before the node is fully ready. L14- Loop Closure#
A SLAM mechanism that detects when the robot returns near a previously visited area and adds a constraint between the current pose graph node and the earlier node observing the same place. The graph optimizer then redistributes accumulated drift across the entire trajectory to satisfy the new constraint, producing a globally consistent map. Without loop closure, drift accumulates and the map shears or overlaps after long traversals. L13
- Lexer#
- Tokenizer#
The first stage of the Python execution pipeline. Breaks source code into a stream of tokens (keywords, identifiers, operators, literals, etc.). Python exposes this through the
tokenizemodule. L1- Linter#
A static analysis tool that scans source code for potential errors, style violations, and code smells without executing the code. The name originates from the
linttool for C (1978). See also Ruff. L1- List#
A mutable, ordered sequence of objects. Created with square brackets
[1, 2, 3]or thelist()constructor. Elements can be of any type, including other lists (nested lists). L3- List Comprehension#
A concise syntax for creating lists:
[expression for item in iterable if condition]. More readable and often faster than equivalentforloops withappend(). L3 · L5- Local Scope#
The innermost scope, containing variables defined inside the current function (including parameters). Local variables are stored in a fast-access array (
f_localsplus) on the frame object and accessed viaLOAD_FAST/STORE_FASTbytecode instructions. L4- Logical Operator#
The
and,or, andnotoperators, which combine or negate Boolean expressions. Python’s logical operators use short-circuit evaluation. With non-boolean values,andreturns the first falsy value (or the last value if all truthy), andorreturns the first truthy value (or the last value if all falsy).notalways returns abool. L2
M#
- Mapping Type#
A container that associates keys with values. The primary mapping type in Python is dict. Mappings support key-based access (
d[key]) and key membership testing (key in d). L3mapFrame#The global REP 105 reference frame for mobile navigation. Goal poses, planned paths, and the occupancy grid are expressed in
map. The localization stack (SLAM or AMCL) publishes themap->odomtransform, which may jump when the pose estimate is corrected (loop closure, particle filter convergence). Compare withodom, which never jumps but drifts over time. L13- Map Server#
The
nav2_map_servernode that loads a saved occupancy grid from disk (.yaml+.pgm) at startup and republishes it on/mapfor AMCL and the costmaps to consume. The companionmap_saver_clitool serializes a live map (e.g., fromslam_toolbox) to disk in the same format. L13- MCAP#
An open, vendor-neutral container format for log files of timestamped, heterogeneous messages. The recommended ROS 2 bag storage backend for sensor-heavy or long-running navigation recordings: it compresses better than SQLite3, supports fast random-access seeks, and is opened natively by Foxglove Studio and the
mcapCLI. Selected withros2 bag record --storage mcaponce theros-jazzy-rosbag2-storage-mcapplugin is installed. L14- Memory Flag (BT)#
The
memoryargument on apy_treesSequence or Selector that decides whether the composite remembers which child was last ticked. Withmemory=False(reactive), the composite restarts from its first child on every tick, so condition nodes are re-checked continuously. Withmemory=True, the composite resumes from the next unfinished child, which is useful when re-running an already-completed action would be incorrect (e.g., re-issuing a Nav2 goal that has already succeeded). L12- Membership Operator#
The
inandnot inoperators, which test whether an element exists within a sequence (string, list, tuple, set, or dict keys)."h" in "hello"evaluates toTrue. L2 · L3- Message#
A packet of data exchanged over a topic. Defined in
.msgfiles as a list of typed fields (IDL primitive types or nested message types). Publishers fill and send message objects; subscribers receive them in callback functions. Standard message packages (std_msgs,geometry_msgs,sensor_msgs, etc.) ship precompiled with ROS 2. L8- Method#
A function defined inside a class that operates on instances of that class. The first parameter is conventionally named
self, which refers to the instance calling the method. Methods are invoked using dot notation:obj.method(args). L6- Method Resolution Order (MRO)#
The sequence Python follows when searching for a method or attribute in a class hierarchy. Computed using the C3 linearization algorithm, which produces a consistent, predictable order that respects the hierarchy and never visits the same class twice. In single inheritance the MRO is simply the chain from child to parent to
object. Inspect it viaClassName.__mro__.super()calls the next class in the MRO, not necessarily the direct parent. L7- Method Overriding#
When a subclass provides its own implementation of a method that already exists in the parent class. The method name and signature remain the same; the subclass version replaces the parent version when called on a subclass instance. Used to specialize inherited behavior. Note: implementing dunder methods such as
__str__or__eq__is overriding (not overloading), because every Python class already inherits these fromobject. L7- Middleware#
Software that sits between the operating system and application code, providing common services such as communication, discovery, and data serialization. In ROS 2, DDS is the middleware layer. It handles all network transport, participant discovery, and QoS enforcement transparently, so node developers interact only with the
rclpy/rclcppAPI. L8- Mutually Exclusive Callback Group#
- MutuallyExclusiveCallbackGroup#
A ROS 2 callback group in which at most one callback can execute at any moment, even when a
MultiThreadedExecutoris used. The executor withholds any queued callback from the group until the currently running callback returns. Prevents race conditions on shared state without requiring explicit locks, at the cost of serializing all group callbacks. The implicit default group for all callbacks in a node is mutually exclusive. L9- MicroPython#
A Python implementation optimized for microcontrollers (ESP32, Raspberry Pi Pico) with minimal RAM requirements (~256 KB). L1
- Modular Programming#
A software design approach that breaks a program into separate, reusable units (modules and packages), each responsible for a specific piece of functionality. L2
- Module#
A single
.pyfile containing functions, classes, and variables. Modules are imported with theimportstatement and are the basic unit of code organization in Python. L2- Modulus#
The remainder after floor division, computed by the
%operator.7 % 3is1. Useful for checking divisibility (n % 2 == 0tests whethernis even). L2- Multiple Assignment#
Binding several names to several values in a single statement using tuple unpacking, e.g.,
name, age, role = "Guido", 64, "BDFL". L1 · L2- Mutable#
An object that can be changed in place after creation. The object’s
id()remains the same even as its contents change. Examples:list,dict,set. L1 · L3
N#
- Name Mangling#
A Python mechanism triggered by a double leading underscore (
__attr). Python renames the attribute to_ClassName__attrto reduce the chance of accidental access from subclasses. Rarely needed in practice. L6 · L7- Namespace#
A mapping from names to objects. Every module, function, and class has its own namespace. Wildcard imports pollute the current namespace. L2 · L4
- Namespace Pollution#
When too many names are imported into the current namespace, increasing the risk of accidental name collisions. Caused primarily by wildcard imports. L2
- Namespace (ROS 2)#
A path-style prefix applied to a ROS 2 node and to every relative name (topics, services, parameters) it owns. Running the same node twice in different namespaces (e.g.,
/frontand/rear) isolates their topics automatically:image_rawbecomes/front/image_rawand/rear/image_raw. Namespaces affect only relative names; absolute names (starting with/) bypass them. Applied via--ros-args -r __ns:=/frontor thenamespaceargument of a launchNodeaction. L12The ROS 2 Navigation Stack. Provides autonomous navigation capabilities including localization (AMCL), costmaps, global planners (NavFn, Smac), local controllers (DWB, Regulated Pure Pursuit), recovery behaviors, and a behavior-tree-based navigator. Students configure (rather than rewrite) Nav2 and send goals via action servers. L1 · L13
The Python convenience package shipped with Nav2 that wraps the navigation action interfaces. Its primary class is BasicNavigator. L13
A classical Dijkstra/A* grid planner shipped with Nav2. Fast and simple, but ignores kinematic constraints, so the resulting path may not be physically drivable by a non-holonomic robot from the start. Compare with Smac Planner. L13
The primary ROS 2 action interface to Nav2 (
nav2_msgs/action/NavigateToPose). The client sends a goalPoseStampedin themapframe; Nav2 plans, controls, and recovers autonomously, publishing periodic feedback (current pose, distance remaining, recovery count) until the goal succeeds, fails, or is cancelled. L13- Nested Condition#
An
ifstatement inside anotherifblock. While sometimes necessary, deeply nested conditions can often be simplified usingelifchains or combined Boolean expressions. L2- Nested Function#
A function defined inside another function. The inner function has access to variables in the enclosing function’s scope. Nested functions are the foundation for closures and decorators. L4 · L5
- Node#
The fundamental unit of a ROS 2 application. A node is a single OS process (or a named entity within a process) that performs one specific task. Nodes discover each other automatically via DDS and communicate through topics, services, and actions. In Python, nodes are typically written as classes that inherit from
rclpy.node.Node. L8 · L9- None#
Python’s null value – the sole instance of the
NoneTypeclass. A singleton used to represent the absence of a value. Always compare withis None, not== None. L1 · L4nonlocalKeyword#A statement that declares a variable inside a nested function as referring to a variable in the enclosing function’s scope. Without it, assignment inside the inner function would create a new local variable instead of modifying the enclosing one.
- Noun/Verb Analysis#
A technique for extracting candidate classes (nouns) and methods (verbs) from a natural-language problem description. Nouns map to classes or attributes, verbs map to methods, and relational phrases (“has a”, “is a”) map to composition or inheritance relationships. L6
O#
- Object#
A concrete realization of a class (synonym for instance). Objects bundle data (attributes) and behavior (methods) together. Multiple objects can be created from the same class, each with independent state. L6
- Occupancy Grid Map#
A metric map that divides 2D space into a regular grid; each cell stores a probability that the corresponding region is occupied. Encoded in ROS 2 as
nav_msgs/msg/OccupancyGrid:0= free,100= occupied,-1= unknown, with intermediate values for partial evidence. Defined by a resolution (typical0.05 m), width, height, and origin pose. Updated by SLAM via Bayesian (log-odds) ray tracing of LiDAR scans. L13on_activate#The lifecycle transition callback invoked when a node moves from Inactive to Active. Must call
super().on_activate(state)first to enable the lifecycle publishers, then start any timers or work that should only run while Active. ReturnsTransitionCallbackReturn.SUCCESSorFAILURE. L14on_cleanup#The lifecycle transition callback invoked when a node moves from Inactive back to Unconfigured. Drops references to publishers, subscribers, and other resources allocated in
on_configure, allowing garbage collection. Afteron_cleanup, the node can be reconfigured fresh. L14on_configure#The lifecycle transition callback invoked when a node moves from Unconfigured to Inactive. Allocates persistent resources – typically lifecycle publishers, subscribers, parameters, and connections. Timers are not created here; they belong in
on_activateso callbacks do not fire while the node is Inactive. ReturnsTransitionCallbackReturn.SUCCESSorFAILURE. L14on_deactivate#The lifecycle transition callback invoked when a node moves from Active back to Inactive. Cancels any timers started in
on_activate, then callssuper().on_deactivate(state)to disable the lifecycle publishers. The publisher objects are kept alive and re-enabled by the nexton_activate. L14on_shutdown#The lifecycle transition callback invoked when
shutdownis requested from any state. The node ends up in Finalized, after which no further transitions are possible. Used to release any final resources before the node is destroyed. L14- Operator Overloading#
A form of polymorphism in which the same operator (
+,==,<, etc.) behaves differently depending on the type of object it is applied to. Achieved by implementing the corresponding dunder method in the class (e.g.,__add__for+,__eq__for==). See also: method overriding. L6 · L7- Operator Precedence#
The rules that determine which operator is evaluated first when an expression contains multiple operators. In Python (highest to lowest):
**, unary+/-,*//////%,+/-, comparisons,not,and,or. Use parentheses for clarity. L2Optional#A type hint from the
typingmodule indicating that a value can be of a specified type orNone.Optional[int]is equivalent toUnion[int, None]. In Python 3.10+, the shorthandint | Nonecan be used instead. L4- Out-of-Place Operation#
An operation that returns a new object without modifying the original. The built-in
sorted()function is out-of-place, returning a new list. String methods are out-of-place because strings are immutable. Contrast with In-Place Operation. L3
P#
- package.xml#
The manifest file for a ROS 2 package. It declares the package name, version, license, maintainer, and all build/runtime dependencies.
amentreads it to determine build order;rosdepreads it to install missing system dependencies.package.xmlandsetup.pymust always agree on package name and version. L8- Package#
A directory containing
.pyfiles (modules) and optionally an__init__.pyfile. Packages allow hierarchical organization of modules, e.g.,shape.square. L2- Parameterized Decorator#
A decorator that accepts arguments. Implemented as a decorator factory: a function that takes the decorator’s arguments and returns the actual decorator. Uses three nested functions:
factory(args) -> decorator(func) -> wrapper(*args, **kwargs). L5- Parameter#
A variable listed in a function’s definition that receives a value when the function is called. Parameters define the function’s interface. Distinguished from arguments: parameters are in the definition, arguments are in the call. L4
- Parser#
The second stage of the Python execution pipeline. Receives tokens from the lexer and validates them against Python’s grammar to produce a parse tree, which is then simplified into an AST. L1
- Particle Filter#
A recursive Bayesian estimator that represents a probability distribution over the robot’s pose as a set of weighted hypotheses (particles), each a candidate pose \((x, y, \theta)\). AMCL repeats three steps every cycle: predict (move particles by the motion model), update (weight each particle by how well a virtual LiDAR scan matches the real scan against the map), and resample (draw a new set with replacement, proportional to weight). The cloud concentrates around poses that consistently explain the data. L13
- Pass-by-Assignment#
Python’s argument-passing mechanism, sometimes called “pass-by-object-reference.” The function receives a reference to the object, not a copy. In-place mutations on mutable objects affect the original; reassignment creates a new local binding without affecting the caller. L4
- PEP 8#
Python Enhancement Proposal 8 – the official style guide for Python code. Prescribes
snake_casefor variables and functions,UPPER_CASEfor constants, andPascalCasefor classes. L1 · L2- Primary State (Lifecycle)#
One of the four stable states a lifecycle node can rest in: Unconfigured (no resources held), Inactive (resources allocated but not processing), Active (fully operational), and Finalized (cleaned up; no further transitions). Movement between primary states is performed by transition commands (
configure,activate,deactivate,cleanup,shutdown), each of which invokes the correspondingon_*callback. L14- Pose Graph#
The internal representation used by graph-based SLAM (e.g.,
slam_toolbox): nodes are estimated robot poses sampled along the trajectory, edges encode the relative transforms between poses (typically from scan matching). Loop-closure edges connect distant nodes that observed the same area. A graph optimizer adjusts every node simultaneously to satisfy all constraints, producing a globally consistent map. L13- Polymorphism#
A design principle meaning “many forms.” Different objects respond to the same interface in their own way. In Python, polymorphism is achieved through duck typing (method presence at runtime) and method overriding (subclass specialization). A polymorphic function calls the same method on a mixed collection of objects and receives different, type-appropriate behavior from each, without knowing the concrete types involved. L7
- Positional Argument#
An argument matched to a parameter by its position in the function call. The first argument is assigned to the first parameter, the second to the second, and so on. L4
- Process#
A program in execution. Each ROS 2 node typically runs as a separate OS process with its own isolated memory space, PID, CPU time allocation, and file descriptors. Process isolation is the key to fault containment in a distributed ROS 2 system: a crashed node does not take down other nodes. L8
- Programming Paradigm#
A fundamental style or approach to organizing and structuring code. The three major paradigms are procedural (step-by-step instructions), object-oriented (data and behavior bundled in objects), and functional (computation as function evaluation). Python supports all three as a multi-paradigm language. L5
- Property#
A Python mechanism (via the
@propertydecorator) that allows controlled access to an attribute through getter and setter methods while preserving attribute-style syntax. The getter is triggered byobj.attrand the setter byobj.attr = value. Used throughout OOP to enforce validation on assignment. L6@property#A built-in decorator that transforms a method into a read-only attribute. Combined with
@attr.setter, it provides validation and control over attribute access without changing the external interface. Preferred over explicit getter/setter methods in Python. L6- Protocol#
A class defined with
typing.Protocolthat describes an interface through structural subtyping. A class satisfies a Protocol if it has the required methods and attributes, regardless of its class hierarchy. No explicit inheritance from the Protocol is needed. Contrast with ABCs, which require the subclass to explicitly inherit from the base class (nominal typing). Adding@runtime_checkableallowsisinstance()checks at runtime, though only method presence (not signatures) is verified. L7- Proxy Object#
A wrapper that intercepts calls and forwards them to another object on your behalf.
super()returns a proxy object: it does not give you the parent class directly but a middleman that knows your position in the MRO and routes method calls to the correct next class in the chain. This is what makessuper()work correctly in multiple inheritance, where the next class is not always the obvious direct parent. L7- Publisher#
A ROS 2 object that sends messages on a named topic. Created with
self.create_publisher(MsgType, "topic_name", qos_depth). Publishers send messages regardless of whether any subscriber is listening. Messages are published from timer or event callbacks, not from blockingwhileloops. L8- Parameter (ROS 2)#
A configurable value stored inside a specific ROS 2 node that can be set at startup or updated at runtime without modifying the source code. Declared with
self.declare_parameter()and retrieved withself.get_parameter(). Supported types arebool,int,double,string, and their array variants, plusbyte[]. Each parameter belongs exclusively to the node that declared it. L9- Parameter Descriptor#
- ParameterDescriptor#
A
rcl_interfacesmessage attached to a ROS 2 parameter at declaration time viadeclare_parameter(..., descriptor=...). Stores a human-readable description and optional constraints (IntegerRange,FloatingPointRange). Constraints are exposed byros2 param describeand enforced duringros2 param set. Once declared, the descriptor cannot be changed at runtime. L9- Parameter File#
A YAML-format configuration file that stores parameter values for one or more nodes. The top-level keys are node names; each maps to a
ros__parametersblock containing parameter names and values. Loaded at node startup via--ros-args --params-fileor via theparametersargument of aNodelaunch action. Stored by convention in theconfig/directory of the package. L9- Pure Function#
A function whose output depends only on its inputs and that produces no side effects. Given the same inputs, a pure function always returns the same output. Pure functions do not modify external state, perform I/O, or depend on mutable global variables. L5
- py_trees#
A Python library for building behavior trees. Used in the final project to coordinate high-level robot tasks (waypoint patrol, event response) by calling Nav2 action servers. L12
- py_trees_ros#
The ROS 2 companion to py_trees. Wraps a tree in a ROS 2 node with a timer-driven tick loop (
BehaviourTree.tick_tock), provides ROS-aware leaf classes (Subscriber,ActionClient, …), and exposes tree state on standard topics so the tick stream can be visualized. Enables BTs to send Nav2 goals and consume sensor topics directly. L12- PyPy#
A Python implementation written in RPython that uses JIT compilation to achieve 4–10x speedups on long-running programs. L1
pyproject.toml#A configuration file used by Python packaging tools. Defines build system requirements, project metadata (name, version, description), and dependencies. Required for editable installs. L2
PYTHONPATH#An environment variable listing directories that Python adds to
sys.pathat startup. Session-specific by default; add to~/.bashrcfor persistence. Useful during development and testing. L2.pthFile#A text file placed in Python’s site-packages directory where each line is a path added to
sys.pathat startup. Provides a system-wide way to make packages discoverable without modifying code.
Q#
- QoS (Quality of Service)#
The set of policies that govern how messages are delivered between publishers and subscribers in DDS/ROS 2. The four most relevant policies are Reliability, Durability, History, and Deadline. Publisher and subscriber QoS must be compatible or DDS silently refuses the connection – no error and no data. An incompatible QoS mismatch is one of the most common causes of a subscriber that receives nothing. L8
- Queue Depth#
The
depthparameter of a QoS profile (or the integer shorthand passed tocreate_publisher/create_subscription). Under theKEEP_LASThistory policy, the queue holds at mostdepthundelivered messages. When the queue is full, the oldest message is evicted to make room for the newest. A queue depth of 1 means only the most recent message is ever buffered. L8
R#
- range()#
A built-in function that returns an immutable sequence of integers. Syntax:
range(stop)orrange(start, stop, step). Thestopvalue is never included.range()is memory-efficient because it uses lazy evaluation. L3- Raw String#
A string literal prefixed with
rthat treats backslashes as literal characters:r"C:\Users\notes"contains two literal backslashes. Useful for file paths and regular expressions. L2- rclpy#
The Python client library for ROS 2. It wraps the underlying
rclC library and exposes the full ROS 2 API in Python:rclpy.init(),rclpy.spin(),rclpy.shutdown(), and theNodeclass withcreate_publisher(),create_subscription(),create_timer(), and more. L8 · L9- Rebinding#
Reassigning a variable name to a different object. In Python, this does not modify the original object – it changes which object the name refers to. L1 · L2
- Recursion#
A programming technique where a function calls itself to solve a problem by breaking it into smaller sub-problems. Every recursive function requires a Base Case and a recursive case. Python limits recursion depth to 1000 by default. L4
- Relational Operator#
An operator that compares values and returns
TrueorFalse:==,!=,>,<,>=,<=. Python supports chained comparisons. L2- Reliability (QoS)#
A QoS policy controlling message delivery guarantees.
RELIABLEretransmits dropped packets until delivery is confirmed.BEST_EFFORTsends without retransmission, offering lower latency at the cost of possible message loss. ARELIABLEsubscriber will not connect to aBEST_EFFORTpublisher. L8- Remapping#
A surgical, per-name redirection mechanism that changes a single ROS 2 node, topic, service, or parameter name without modifying source code. Applied via
--ros-args -r old:=newon the CLI, theremappingsargument of a launchNodeaction, or the-rflag onros2 bag play. Useful for connecting a node written against a generic name (image_raw) to a specific pipeline (/sensors/front/image) or for renaming a node so a second instance can coexist with the first. Compare with the bulk operation of a Namespace (ROS 2). L12- Reentrant Callback Group#
- ReentrantCallbackGroup#
A ROS 2 callback group in which multiple callbacks (or multiple instances of the same callback) can execute concurrently on separate threads in a
MultiThreadedExecutor. Provides the highest throughput for independent, stateless tasks. If callbacks share mutable state, athreading.Lockis required to prevent race conditions. Contrast with Mutually Exclusive Callback Group. L9- REPL#
- Read-Eval-Print Loop#
An interactive programming environment that reads user input, evaluates it, prints the result, and loops. Python provides a built-in REPL via
python3or the VS Code Native Python REPL. L1- Regulated Pure Pursuit#
- RPP#
A Nav2 local controller that follows the planned path by aiming at a lookahead point on it and slowing down near obstacles and tight curves. Cheaper and smoother than DWB Controller, well suited to open environments with predictable paths. L13
- REP 105#
The ROS Enhancement Proposal that defines the standard coordinate-frame chain for mobile platforms:
world->map->odom->base_link-> sensor frames. Specifies who publishes each transform and the jump/drift semantics (odomis locally consistent but drifts;mapis globally consistent but can jump on correction). L11 · L13- Requirement Analysis#
The process of identifying what the system must do (functional requirements) and how well it must do it (non-functional requirements). The first step in the design workflow. L6
- Reserved Keyword#
A word with special meaning in Python that cannot be used as a variable name (e.g.,
if,class,return). Python 3 has 35 reserved keywords. Usekeyword.iskeyword()to check. L1 · L2- ROS 2#
- Robot Operating System 2#
A middleware framework for robotics development. This course uses ROS 2 Jazzy Jalisco for robot communication, sensor integration, and task coordination. L8 · L9
- ROS 2 Workspace#
A directory containing all packages, dependencies, and build artifacts for a ROS 2 project. The standard layout has four subdirectories:
src/(source packages),build/(intermediate build artifacts),install/(final install tree includingsetup.bash), andlog/(build logs). Always runcolcon buildfrom the workspace root, not from insidesrc/. L8- rosbag2#
The ROS 2 message recording / replay subsystem. Provides the
ros2 bagCLI (record,play,info,convert) and therosbag2_pyPython API for reading and writing bags programmatically. Supports pluggable storage backends; the two used in this course are SQLite3 (default) and MCAP. L14- rosdep#
A command-line tool that reads
package.xmlfiles and installs all declared system dependencies automatically. Runrosdep install --from-paths ./src --ignore-packages-from-source -yfrom the workspace root to install all missing dependencies in one command. L8- RTPS (Real-Time Publish-Subscribe)#
The wire protocol underlying DDS. RTPS defines how DDS implementations discover participants and exchange data over the network. Because all vendors implement RTPS, DDS nodes from different vendors can interoperate on the same network. L8
- Ruff#
A fast Python linter and formatter written in Rust. Replaces Flake8, Black, isort, and many plugins. Runs 10–100x faster than pure-Python alternatives. L1
__repr__#A dunder method called by
repr(), the REPL, the debugger, and when objects appear inside containers (lists, dicts). Should return a string that looks like the code you would type to create the object (e.g.,Robot('Scout', 100)). Serves as the fallback for__str__if__str__is not defined. L6 · L7returnStatement#A statement that exits a function and optionally sends a value back to the caller. Multiple values can be returned as a tuple. Functions without a
returnstatement implicitly returnNone.
S#
- Scan Matching#
The algorithm that aligns two LiDAR point clouds (typically two consecutive scans) by finding the rigid transform (translation + rotation) that best overlaps them. The result is an incremental pose estimate that does not depend on wheel odometry, and is therefore more accurate on slippery or uneven surfaces. In
slam_toolbox, scan-match results become the edges of the pose graph; the result’s covariance determines how strongly the graph optimizer trusts each edge. L13- Scope#
The region of a program where a variable name is accessible. Python uses the LEGB Rule to determine which scope a name belongs to. Each function call creates a new local scope. L4
self#The conventional name for the first parameter of instance methods. Refers to the specific instance that called the method. Python passes it automatically:
obj.method(arg)is translated toClassName.method(obj, arg).- Sequence Node#
A composite node that ticks its children left to right and returns
SUCCESSonly if every child succeeds. Aborts and returnsFAILUREon the first child that fails. Logical AND. With memory set toFalse, the Sequence restarts from the first child on every tick, which makes upstream conditions reactive to changing world state. Compare with Fallback (BT). L12- Sequence Type#
A container that stores elements in a specific order and supports indexing, slicing, and iteration. Built-in sequence types include
list,tuple,str,bytes, andrange. L3- Service#
A ROS 2 communication primitive for synchronous request-response interactions. One node (the client) sends a request; another node (the server) processes it and returns a response. Services block until a response arrives. Defined in
.srvfiles. Example use: trigger the gripper, query the current map, save state. L8- Set#
A mutable, unordered collection of unique hashable elements. Created with curly braces
{1, 2, 3}or theset()constructor. Supports mathematical operations like union, intersection, and difference. L3- Set Comprehension#
A concise syntax for creating sets:
{expression for item in iterable if condition}. Automatically removes duplicates. L3- Shadowing#
When a variable in an inner scope has the same name as a variable in an outer scope, hiding the outer variable. For example, a local variable named
xshadows a global variable namedxwithin that function. L6- Shallow Copy#
A copy of a container (e.g.,
list.copy(),dict.copy()) that creates a new container object but does not recursively copy the objects contained within it. Sufficient when the contained objects are immutable. L3- Short-Circuit Evaluation#
A behavior of logical operators where the second operand is not evaluated if the result is already determined.
andstops at the first falsy value;orstops at the first truthy value. L2- Side Effect#
Any observable change that a function makes beyond returning a value. Examples include modifying a global variable, mutating a mutable argument, printing to the console, writing to a file, or making a network request. Functional programming aims to minimize side effects. L5
- Singleton#
An object of which only one instance exists in the entire program.
None,True, andFalseare singletons in Python. L1site-packages#The directory where Python installs third-party packages. Its location can be found with
python3 -c "import site; print(site.getsitepackages())". .pth files placed here are processed at startup.- SLAM#
- Simultaneous Localization and Mapping#
The class of algorithms that estimate the robot’s pose and build a map of the environment at the same time, from sensor data alone.
slam_toolboxis the graph-based 2D SLAM library used in this course: it scan-matches successive LiDAR scans, stores the result in a pose graph, and uses loop closure to correct accumulated drift. L13- slam_toolbox#
A graph-based 2D SLAM library by Steve Macenski. Builds an occupancy grid in real time from LiDAR + odometry by scan matching new scans, adding nodes/edges to a pose graph, and detecting loop closures to correct drift. Supports an online-async mode (build a fresh map) and a localization mode (load an existing serialized graph). Configured via a YAML parameter file (
mapper_params_online_async.yaml). L13- Slicing#
Extracting a subsequence from a sequence using the syntax
[start:stop:stride].startis inclusive,stopis exclusive, andstridedefaults to1. Negative indices count from the end. L2 · L3- Smac Planner#
A family of Nav2 global planners (Hybrid A*, lattice, Theta*) that search an SE(2) lattice respecting the robot’s turning radius. Best suited to non-holonomic robots in tight spaces where the path must be physically drivable from the start. Compare with NavFn Planner. L13
- snake_case#
A naming convention where words are separated by underscores and all letters are lowercase, e.g.,
student_name,max_speed. Prescribed by PEP 8 for variable and function names.- Specialization#
A top-down design activity in which a general base class is refined into derived classes that extend or override its behavior for a specific context. Each subclass carries only the attributes and methods unique to that type, avoiding
Noneplaceholders for inapplicable fields. Contrast with generalization. L7- SQLite3 Storage#
The default rosbag2 storage backend. Bag data is written to one or more
.db3files inside the bag directory. Adequate for short runs and low-bandwidth topics (parameters, text data) but degrades on long runs with high-rate topics due to indexing overhead. Switch to MCAP for sensor-heavy navigation bags. L14- Spinning#
The act of activating the ROS 2 executor so it can process incoming callbacks.
rclpy.spin(node)blocks the calling thread indefinitely and dispatches callbacks as they arrive. Without spinning, a node is registered but completely passive – no timer fires, no message is received.rclpy.spin_once()processes one batch and returns;rclpy.spin_until_future_complete()blocks until a Future resolves. L8 · L9- Static Method#
A method defined with the
@staticmethoddecorator. It receives neitherselfnorclsand has no implicit access to instance or class state. Behaves like a regular function but lives in the class namespace for organizational clarity. Common uses: validation helpers, unit conversions, and pure computations logically related to the class. L7- Static Typing#
A type system where the type of every variable is known at compile time and cannot change. Examples: C, C++, Java, Rust. Contrast with Dynamic Typing. L4
- String Interning#
- Structural Subtyping#
A typing model in which compatibility between a class and an interface is determined by the presence of the required methods and attributes, not by explicit inheritance. Implemented in Python via
typing.Protocol. Contrast with nominal typing (used by ABCs), where a class must explicitly inherit from the interface to be considered compatible. L7- Subscriber#
A ROS 2 object that receives messages on a named topic. Created with
self.create_subscription(MsgType, "topic_name", callback, qos_depth). The callback is invoked by the executor each time a message arrives. Topic name and message type must match the publisher exactly; a mismatch causes a silent failure. L8super()#A built-in function that returns a proxy object used to delegate method calls to the next class in the MRO. Always use the no-argument form
super()in Python 3. Callsuper().__init__()as the first line of a child__init__so that parent attributes are initialized before the child tries to use them. Can be used in any method, not just__init__.- Symmetric Difference#
A set operation returning elements in either set but not in both. Performed with
^operator or.symmetric_difference()method.{1, 2, 3} ^ {2, 3, 4}returns{1, 4}. L3- Syntactic Sugar#
Syntax that makes code easier to read or write but does not add new functionality. The
@decoratorsyntax is syntactic sugar forfunc = decorator(func). Similarly, list comprehensions are syntactic sugar for loops that build lists. L5- sys.path#
A list of directory paths that Python searches when resolving
importstatements. Modify withsys.path.insert()to add custom directories. Also populated automatically from PYTHONPATH and .pth files.- setup.py#
The build script for a Python ROS 2 package. It tells
colconhow to install nodes (viaentry_points), launch files, and config files (viadata_files). Package name and version must matchpackage.xmlexactly. After adding a new entry point,colcon buildmust be run again;--symlink-installdoes not pick up new entry points automatically. L8__slots__#A class-level declaration that replaces the per-instance
__dict__with a fixed, compact structure containing only the listed attribute names. Reduces memory consumption (the__dict__alone costs roughly 232 bytes per instance) and speeds up attribute access. Prevents dynamic addition of attributes not listed in__slots__. In an inheritance hierarchy, each class should declare only the new attributes it introduces; Python merges the slots from all classes in the chain automatically. L7__str__#A dunder method called by
print()andstr(). Should return a human-readable string intended for end users and display output. If not defined, Python falls back to__repr__. L6 · L7
T#
- Thread#
The smallest unit of execution inside a process. A process starts with one thread (the main thread). When
rclpy.spin(node)is called, the main thread is handed to the ROS 2 executor which runs it in a loop dispatching callbacks. A slow callback blocks this thread and delays all other pending callbacks. L8 · L9- Tick (BT)#
The fundamental signal in a behavior tree. The root receives a tick at a fixed rate and propagates it depth-first down the tree according to each composite’s logic; children that are reached return
SUCCESS,FAILURE, orRUNNING, and the result bubbles back up. Tick frequency determines how reactive the tree is; slow ticks make recovery feel sluggish, while fast ticks waste CPU on conditions that haven’t changed. L12- Timer (ROS 2)#
A ROS 2 object that fires a callback at a fixed interval. Created with
self.create_timer(period_seconds, callback). The timer only fires while the node is spinning. Timers are the standard mechanism for driving periodic behavior (e.g., publishing sensor data at a fixed rate) without blocking the executor thread. L8 · L9- Token#
The smallest meaningful unit of source code produced by the lexer. Examples include keywords (
def), identifiers (my_var), operators (+), and literals (42). L1- Topic#
A named, typed communication channel over which nodes exchange messages asynchronously. Publishers and subscribers are decoupled: they discover each other through DDS without knowing each other’s identity. A topic has a fixed name (e.g.,
/scan) and a fixed message type; both must match for a publisher-subscriber pair to exchange data. L8TransitionCallbackReturn#The enum returned by every lifecycle transition callback to tell the state machine what happened.
SUCCESSadvances to the target state.FAILUREkeeps the node in its previous state and lets the operator retry the transition (use it when nothing was half-allocated).ERRORinvokeson_error; the default handler returnsFAILURE, which sends the node straight to Finalized, so reserveERRORfor genuinely inconsistent partial-setup situations. L14- Truthy#
A value that evaluates to
Truewhen passed tobool(). Any non-zero number, non-empty string, or non-empty collection is truthy. Contrast with Falsy. L2- Truthiness#
The concept that every Python object has an inherent Boolean value. Pythonic code leverages truthiness directly in conditions:
if my_list:rather thanif len(my_list) > 0:. L2- Tuple#
An immutable, ordered sequence of objects. Created with parentheses
(1, 2, 3)or thetuple()constructor. Single-element tuples require a trailing comma:(42,). Tuples are hashable if all their elements are hashable. L3- Tuple Packing#
Creating a tuple by listing comma-separated values without parentheses:
point = 3, 4creates the tuple(3, 4). L3- Tuple Unpacking#
Assigning tuple elements to individual variables:
x, y = (3, 4)assigns3toxand4toy. Also works with lists and other iterables. L3 · L4- Type Hint#
An optional annotation in Python source code that indicates the expected type of a variable, parameter, or return value (e.g.,
def greet(name: str) -> None). L4 · L6
U#
- Ubuntu#
A Linux distribution. This course uses Ubuntu 24.04 LTS (Noble Numbat) as the primary operating system. L1
- UML#
Unified Modeling Language. A standardized notation for visualizing software design. This course uses class diagrams (structure), sequence diagrams (object interaction over time), and activity diagrams (control flow). L6 · L7
- Union#
A set operation returning all elements from both sets (duplicates removed). Performed with
|operator or.union()method.{1, 2, 3} | {2, 3, 4}returns{1, 2, 3, 4}. L3 · L4- Unpacking#
See Tuple Unpacking. Extended unpacking uses
*to capture multiple values:first, *rest = [1, 2, 3, 4]assigns1tofirstand[2, 3, 4]torest. L3 · L4
V#
- Variadic Function#
A function that accepts a variable number of arguments. Python’s built-in
print()is variadic – it accepts any number of positional arguments. L1 · L4- View Object#
An object providing a dynamic view of dictionary keys, values, or items. Returned by
dict.keys(),dict.values(), anddict.items(). Views reflect changes to the dictionary without creating a copy. L3- Visual Studio Code#
- VS Code#
A lightweight, extensible code editor by Microsoft. The primary IDE for this course, used with the Python, Dev Containers, and Ruff extensions. L1
W#
- while Loop#
A control structure that repeats as long as a condition is
True. Syntax:while condition:. Must include logic to eventually make the conditionFalse, or the loop runs forever (infinite loop). L3- Wildcard Import#
An import of the form
from module import *that brings every public name from a module into the current namespace. Strongly discouraged because it causes namespace pollution and makes it impossible to tell where a name originated. L2- Workspace#
In VS Code, the root folder opened by the editor. VS Code stores workspace-specific settings in
.vscode/settings.json. For this course:~/enpm605/py_ws. L1 · L8- Workspace Overlay#
The practice of sourcing one ROS 2 installation on top of another. The later source takes precedence for package lookup. The standard order is: source the base ROS 2 installation first (
/opt/ros/jazzy/setup.bash), then source your workspace (install/setup.bash). Never source two different ROS 2 distributions in the same shell session. L8- Wrapper Function#
The inner function in a decorator that replaces the original function. It typically accepts
*argsand**kwargsto work with any function signature, adds the decorator’s behavior (such as logging or timing), calls the original function, and returns its result. Should always use@functools.wrapsto preserve the original function’s metadata. L5__init__.py#A file that marks a directory as a Python package. May be empty or may contain package-level initialization code and
__all__definitions to control wildcard imports. L2__name__#A special variable set to
"__main__"when a module is run directly and to the module’s own name when imported. Theif __name__ == '__main__':guard prevents code from running on import. L2