Example Projects

Twelve complete applications ship in the HORUS repository under examples/. Each one is a real project — a horus.toml, a main.rs, main.py or src/main.cpp, a robot description under robots/, and for seven of them a worlds/ scene — not a snippet. They are what to reach for when you know what you want to build and would rather see it built once first.

ℹ️These are projects; the language pages are snippets

Rust Examples, Python Examples and C++ Examples show individual API patterns inside this documentation. The twelve below are checked-out, runnable applications with their own manifests. A CI job (shipped-examples-build in .github/workflows/docs-contract.yml) runs horus build in every project under examples/ on each pull request, and a failure blocks the merge through the required Docs Contract Success check — so a break is caught on the pull request that caused it, not a day later.

Start here

ExampleLanguageWhat it teaches
differential_driveRustNodes, topics, messages, scheduler basics — the smallest complete robot
python_robotPythonThe same robot in Python; the starting point if you are not writing Rust
differential_drive_cppC++The same robot again in C++; a horus.toml project that horus build drives through cmake

Core robotics

ExampleLanguageWhat it teaches
robot_armRust6-DOF joint control, services, and frame transforms with TransformFrame
sensor_navigationRustLiDAR + IMU, multi-rate scheduling, reactive obstacle avoidance
sensor_navigation_pyPythonThe same LiDAR + IMU navigation in Python
camera_perceptionRustA CV pipeline: camera capture, object detection, IoU/SORT tracking

Advanced

ExampleLanguageWhat it teaches
multi_robotRustNamespaced topics, launch files, fleet coordination
quadrupedRustReal-time nodes: 12-DOF gait with budgets, deadlines and IMU feedback
pick_and_placeRustActions — goal lifecycle, feedback, cancellation

Production

ExampleLanguageWhat it teaches
driver_integrationRustHardware drivers from the manifest, Terra HAL, custom driver nodes
record_replayRustSession recording, blackbox forensics, deterministic replay

Coming from ROS 2

If you know the ROS 2 tutorial you would have followed, this is its counterpart:

ROS 2 workflowHORUS example
Publisher/subscriber tutorialdifferential_drive or python_robot
tf2 and frame transformsrobot_arm
nav2 sensor pipelinesensor_navigation
darknet_ros / YOLO detectioncamera_perception
Multi-robot swarmmulti_robot
ros2_control hardwaredriver_integration
MoveIt pick-and-placepick_and_place
rosbag2 record/playrecord_replay
Legged robot controlquadruped

See also Migrating from ROS 2 for the API mapping, and the ROS 2 bridge recipe for running both at once.

Running one

Every example is an ordinary HORUS project, so it runs the way yours does:

git clone https://github.com/softmata/horus.git
cd horus/examples/differential_drive
horus run main.rs

Python is the same command:

cd horus/examples/python_robot
horus run main.py

The simulator is optional — the examples publish and subscribe without it. To see the robot move, start sim3d in another terminal first:

sim3d --mode visual --robot robots/<robot>.urdf --world worlds/<world>.yaml

Five of the twelve — camera_perception, driver_integration, pick_and_place, python_robot and record_replay — ship no worlds/ directory. Start sim3d without --world for those, or point --world at a scene from another example.

While one is running, the usual introspection applies:

horus topic list
horus topic echo cmd_vel
horus node list
horus monitor

Turning one into your project

horus new <name> --from <example> is the one step: it copies the shipped example, renames the package to <name>, and leaves the build output behind.

horus new my_robot --from differential_drive
cd my_robot
horus run main.rs

Pass a name that does not exist — horus new my_robot --from list — and the error is the list of available examples. The language comes from the example, so the language and layout flags do not apply alongside --from and are rejected rather than ignored: --python, --rust, --cpp, --macro, --workspace and --lib.

The examples are read out of the HORUS source tree, the same one horus build already needs for its path dependencies — a checkout, an installer cache, or wherever HORUS_SOURCE points. Nothing is copied that belongs to that tree: .horus/, target/, build/, __pycache__/, .git/ and the tool caches are all skipped, so the new project carries no build output and no path dependency on someone else's checkout.

Copying the directory by hand still works if you would rather:

cp -r horus/examples/differential_drive my_robot
cd my_robot
# edit horus.toml: change `name = "differential_drive"` to `name = "my_robot"`
horus run main.rs

Rename the package in the manifest — two projects that keep the same [package] name build binaries that collide in a shared target directory and register the same node names at runtime. horus build regenerates .horus/Cargo.toml from horus.toml on every build, so the manifest is the only file holding the name. Delete the copied .horus/ directory if one came along; it is a build cache.

💡Copy the manifest, not just the code

horus.toml is where an example's dependencies, [hardware] entries and scripts live — driver_integration's driver table and robot_arm's horus-tf dependency are both in the manifest, not in src/main.rs. Copying only the source file is the usual reason a copied example stops compiling.

C++ examples

One C++ example is a full project like the rest: examples/differential_drive_cpp has a horus.toml and builds with horus build, which generates a CMakeLists.txt into .horus/ and links libhorus_cpp.a for you. It is in the Start here table above.

The remaining C++ examples live under horus_cpp/examples/ rather than examples/, because they are standalone translation units built directly with CMake against the C++ bindings rather than through horus build:

ExampleWhat it teaches
pub_sub_demo.cppTopics, the loan/publish pattern, send-by-copy
multi_node.cppSeveral nodes in one scheduler — rates, budgets, on_miss
obstacle_avoidance.cppReactive control from a LaserScan
camera_publisher.cppPublishing sensor data at a fixed rate
transform_frames.cppCoordinate frames from C++
params_demo.cppRuntime parameters
cargo build -p horus_cpp                      # produces libhorus_cpp.a
cmake -S horus_cpp/examples -B build/cpp-examples
cmake --build build/cpp-examples

CMake finds the library under target/ automatically in a checkout; pass -DHORUS_CPP_LIB=... to point it elsewhere.

See Also