Skip to content

feat(inverted_pendulum): adopt common demo infrastructure and snippets, updates & cleanup - #124

Open
EnejiOhieku wants to merge 6 commits into
feat/demos-sine-wave-commonfrom
feat/demos-inverted-pendulum-common
Open

EnejiOhieku wants to merge 6 commits into
feat/demos-sine-wave-commonfrom
feat/demos-inverted-pendulum-common

Conversation

@EnejiOhieku

@EnejiOhieku EnejiOhieku commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Migrates the inverted_pendulum demo (Tier 1 and Tier 2) to the centralized zenbedded_common infrastructure and transport snippets, completing the stacked demo-common work. Also introduces the host-side Tier 1 topic hardware interface.

Firmware (Tier 1 & Tier 2)

  • Update to use zenbedded_common infra: firmware now includes zenbedded_common/network.hpp (the previously referenced zenbedded_demo_net.hpp no longer exists) and adopts the ZENBEDDED_ZENOH_LOCATOR / ZENBEDDED_COMMON_USB_CDC Kconfig scheme, replacing the stale NTP_SERVER / ZENBEDDED_ZENOH_IP_PORT / ZENBEDDED_DEMO_COMM_* symbols that aborted Kconfig with warnings.
  • CMake & Kconfig: links the zenbedded_common library into both tiers, sources common Kconfig and prj_common.conf.
  • Transport snippets: -S cdc-ecm and -S wifi via zenbedded_common/snippets/; board overlays now contain strictly actuator/sensor definitions (TMC2209 stepper, AS5600 encoder, LED strip).
  • Firmware upgrades: SNTP time sync, dedicated 400 Hz encoder sampling thread, move_to projection stepping with hard travel limits, WS2812 status LED.
  • sample.yaml: SNIPPET= extra_args and a new dual-transport (cdc-ecm;wifi) target.

Host side (ROS 2)

  • New inverted_pendulum_tier1_hardware SystemInterface plugin: subscribes sensor_msgs/msg/JointState from Tier 1 firmware and publishes control_msgs/msg/JointCommand acceleration commands back to the MCU.
  • Launch: tier (1/2), use_mock_hardware and use_rviz launch arguments; RViz config refresh; URDF refresh.
  • Tests: ament pytest launch integration test for the Tier 1 relay loop; mock hardware test kept in conformance.
  • Meshes are LFS-tracked and unchanged (pointer-only, no binary churn).

Documentation

  • New demo README; rewritten userdoc.rst covering snippet-based builds (cdc-ecm, wifi, dual) and Tier 1 usage.

@EnejiOhieku
EnejiOhieku marked this pull request as draft October 24, 2026 19:42
@EnejiOhieku
EnejiOhieku added this pull request to stack #125 October 24, 2026 19:42
@ShahazadAbdulla
ShahazadAbdulla force-pushed the feat/demos-inverted-pendulum-common branch from 4af9881 to a895136 Compare October 24, 2026 20:05
@EnejiOhieku
EnejiOhieku force-pushed the feat/demos-inverted-pendulum-common branch 4 times, most recently from b6308e5 to 8c16701 Compare October 26, 2026 14:35
@EnejiOhieku
EnejiOhieku force-pushed the feat/demos-inverted-pendulum-common branch from 8c16701 to 5deb814 Compare October 27, 2026 16:00
- Refactor inverted_pendulum tier1 and tier2 to use demos/common library
- Migrate transport configuration to cdc-ecm and wifi snippets
- Decouple stepper/encoder board overlays from network transport
- Update user documentation
@EnejiOhieku
EnejiOhieku force-pushed the feat/demos-inverted-pendulum-common branch from 5deb814 to c636fc2 Compare October 27, 2026 16:07
@bmagyar bmagyar added the 0.1.0 label Oct 30, 2026
…firmware

- Include zenbedded_common/network.hpp; the committed zenbedded_demo_net.hpp
  header no longer exists and broke every inverted_pendulum build
- Adopt ZENBEDDED_ZENOH_LOCATOR / ZENBEDDED_COMMON_USB_CDC Kconfig symbols,
  replacing stale NTP_SERVER / ZENBEDDED_ZENOH_IP_PORT / ZENBEDDED_DEMO_COMM_*
  options that tripped "Aborting due to Kconfig warnings" in twister (demos)
- Keep board overlays strictly actuator/sensor: transport DTS stays in the
  cdc-ecm and wifi snippets
- Firmware upgrades: SNTP time sync, dedicated 400 Hz encoder sampling thread,
  move_to projection stepping with hard travel limits, WS2812 status LED
- sample.yaml: switch to SNIPPET extra_args and add a dual-transport
  (cdc-ecm;wifi) test target
…sh ROS stack

- New inverted_pendulum_tier1_hardware SystemInterface plugin: subscribes
  sensor_msgs/msg/JointState from tier1 firmware and publishes
  control_msgs/msg/JointCommand acceleration commands back to the MCU
- Launch: tier selection (1/2), use_mock_hardware and use_rviz arguments
- RViz config and URDF refresh for the two-joint pendulum visual
- Hook up ament pytest launch integration test for the tier1 relay loop;
  keep the mock hardware test in conformance
- New README with feature matrix, wiring summary and quickstart for both
  transport snippets
- userdoc.rst: document snippet-based firmware builds (cdc-ecm, wifi, dual),
  tier1/tier2 launch instructions and the tier1 topic hardware interface
… interface

The (name, interface, double*) pointer constructors of StateInterface and
CommandInterface were removed from newer hardware_interface releases and
broke the lyrical binary build (gcc 15 docker stack). Construct the tier1
handles from names only — matching zenbedded_hardware_interface and
mock_pendulum_hardware — and let the LooseHandle values carry state:

- on_init: build 4 state handles + 1 command handle names-only, init to 0.0
- read(): set latest q/qdot directly on the handles (no hw_states_ staging)
- write(): get_optional<double>() -> last_accel_cmd_ holds the last good
  acceleration so a NaN command keeps the previous value in the message
@EnejiOhieku
EnejiOhieku marked this pull request as ready for review October 30, 2026 19:48
@EnejiOhieku EnejiOhieku changed the title feat(inverted_pendulum): adopt common demo infrastructure and snippets feat(inverted_pendulum): adopt common demo infrastructure and snippets, updates & cleanup Oct 30, 2026
…ntax and LED behavior

- Stepper wiring table now documents the active TMC2209 overlay config
  (EN=GPIO4, M0=GPIO5, M1=GPIO6, STEP=GPIO7, DIR=GPIO8, 32 microsteps);
  the A4988 mapping survives as a commented-out overlay node footnote
- Unify dual-transport snippets (-S cdc-ecm -S wifi) and drop the invalid
  "-- "-prefixed west build example; flag order matches validated builds
- LED status tables match firmware: solid blue init, flashing green every
  250 ms; no red fault color row
- README gains the second chrony subnet and a troubleshooting section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants