Skip to main content

Turtle Demo (host turtlesim)

apps/turtle_demo is a turtlesim-style demo for x86 Linux hosts. It needs no target board or real hardware. Two processes show OpenEmber multi-node Link, Protobuf messages, and optional launch orchestration. An SDL2 window is the default view; use --no-gui when headless.

This lives under the Application layer (apps/), not as a tiny API sample in examples/. For full runtime supervision (health / device / config), see smart_device_demo and configs/smart_device.launch.yaml.

Like ROS turtlesim: a planar mobile robot​

This demo mirrors classic ROS turtlesim: think of it as a mobile robot on a plane, not a real car or a 3D simulator.

  • 2D only: pose is (x, y, \theta); the window shows a grid and turtle. No 3D scene.
  • Kinematics: closer to a unicycle / differential-drive model—commanded by linear and angular velocity; no wheels, suspension, Ackermann steering, or physics collisions.
  • Purpose: practice multi-node messaging (topics / Link / msgs), not vehicle or Gazebo-class simulation. For 3D visualization or real robot models, use something like RViz / Gazebo; that is outside the turtlesim tier.

What it demonstrates​

CapabilityIn this demo
Multi-process + Linkturtle_sim and turtle_teleop as separate processes (router/client)
openember-msgsgeometry/v1 Twist2D / Pose2D
Host-onlySoftware unicycle integration; no board drivers
VisualizationSDL2 window (grid, turtle, trail); ASCII fallback
Launchconfigs/turtle.launch.yaml (launch_manager as router)

Dependencies and knobs​

  • Kconfig: Application Layer → OPENEMBER_APP_TURTLE_DEMO (on by default; needs Link + msgs)
  • System package (GUI): libsdl2-dev (sudo apt install libsdl2-dev on Debian/Ubuntu)
  • Binaries: build/bin/openember_turtle_sim, build/bin/openember_turtle_teleop

See Build OpenEmber. A LOCAL openember-msgs tree must include geometry/v1 (message protocol).

Topics​

TopicTypeDirection
/turtle/cmd_velopenember.msgs.geometry.v1.Twist2Dteleop → sim
/turtle/poseopenember.msgs.geometry.v1.Pose2Dsim → (optional observers)

Twist2D: linear_x (m/s), angular_z (rad/s).
Pose2D: x / y (m), theta (rad); world roughly ±10 m.

Quick start (two terminals)​

# Terminal 1: sim world (SDL window by default; Link router)
./build/bin/openember_turtle_sim --router

# Terminal 2: teleop (scripted circle)
./build/bin/openember_turtle_teleop --client --demo

Keyboard teleop (TTY required):

./build/bin/openember_turtle_teleop --client
# w/s forward-back, a/d turn, space stop, q quit

Close the window or press Esc to stop turtle_sim in GUI mode.

Headless / CI​

./build/bin/openember_turtle_sim --router --no-gui
./build/bin/openember_turtle_teleop --client --demo

Using launch_manager​

Requires a built launch_manager:

./build/bin/launch_manager --launch configs/turtle.launch.yaml
# also accepted: ./build/bin/launch_manager configs/turtle.launch.yaml

launch_manager is the Link router; sim and teleop join as --client, with teleop --demo. The sim still opens SDL unless you change the launch args (needs a working DISPLAY).

See the header comments in configs/turtle.launch.yaml.

Common flags​

Both processes (same idea as smart_device_demo):

FlagMeaning
--router / --clientFix Link role; default is auto (try router, then client)
--listen <ep>Router listen endpoint (default tcp/127.0.0.1:7447)
--connect <ep>Client connect endpoint

turtle_sim only:

FlagMeaning
--no-gui / --headlessASCII map instead of SDL

turtle_teleop only:

FlagMeaning
--demoContinuous circle-like cmd_vel (use this without a TTY)

Source layout​

apps/turtle_demo/
turtle_sim.cpp
turtle_teleop.cpp
turtle_view_sdl.*
turtle_common.hpp
configs/turtle.launch.yaml
  • examples/core/*, hello_node: API teaching pieces, not a full story.
  • smart_device_demo: product-app skeleton; evolves into Agri Station Demo.
  • Turtle Demo: fastest host closed loop for Link + messages + optional launch.
  • Rover Demo (planned): diff-drive rover (sim + DIY within ¥3000)—actuation, sensing, safety.
  • Agri Station Demo (planned): greenhouse/field multi-sensor + alerts/degrade + ops UI.

See OpenEmber Link and Architecture overview.