CSA (Cognitive Synergy Architecture) is an advanced ROS 2โnative framework for human-centric robots.
It integrates perception (SEGO), planning (IMAGO), reasoning (ONN/LOGOS) and meta-reasoning (D-LOGOS)
for robots that understand, reason, adapt plans, and explain decisions in real time.
CSA is not just code โ it is a research journey that embodies my vision:
Robots that reason, reflect, and co-think with humans.
This repository contains the codebase, architecture, and demo pipelines for CSA research and development.
Modular cognition for robots that perceive, reason, and co-think with humans.
CSA is a multistage robotics framework that unifies semantic perception, adaptive planning, and explainable control under a single, ROS 2โnative codebase. It is organized into three tightly-coupled sub-architectures SEGO, IMAGO, and LOGOS that together deliver a full perception-to-action loop with built-in reasoning, safety, and self-reflection.
| Sub-Architecture | Core Question | Key Capabilities (current state) |
|---|---|---|
| SEGO (Semantic Graph Ontology mapper) |
โWhat exactly am I seeing?โ | โข Real-time RGB-D detection (YOLO v5) โข Multi-object tracking (StrongSORT) โข 6-DoF pose fusion (ORB-SLAM2 / RTAB-Map) โข 3-D semantic mapping + scene-graph export |
| IMAGO (Intent Modeling & Action Generation Operator) |
โWhy should I act and how do I adapt my plan?โ | โข Natural-language intent parsing (LLM plugin) โข Symbolic & neuro-symbolic planners (HTN, BT, CoT) โข PPO-based self-adaptation + meta-controller |
| LOGOS (Logical Ontological Generator for Self-adjustment) |
โDoes my behaviour remain safe, valid, and explainable?โ | โข Run-time ontology checks (OWL 2, DL-query) โข Policy distillation โ decision trees โข Human-readable rationales (XAI report) |
Status โ 2025-06 14 SEGO Stage-1 is feature-complete; IMAGO & LOGOS scaffolding is included but most PRs are still WIP.
Road-mapped milestones are listed here ยป.
| Stage | Module | Purpose |
|---|---|---|
| โ | SEGO | Semantic mapping, scene graph construction |
| โก | IMAGO | Intent-driven planning, adaptive control |
| โข | ONN | Ontology Neural Network for topological reasoning |
| โฃ | LOGOS | Explainable decision making, reasoning trace |
| โค | D-LOGOS | Meta-reasoning, self-reflective rule evolution |
- Topological stability guarantee:
- Phase margin under delay:
- Adaptive control law:
This repository is based on the system architecture and cognitive vision proposed in
my own review papers:
- "Towards Cognitive Collaborative Robots: Semantic-Level Integration and Explainable Control for Human-Centric Cooperation"
- "Cognitive Synergy Architecture: SEGO for Human-Centric Collaborative Robots"
These papers present the conceptual and theoretical foundation for CSA (Cognitive Synergy Architecture) โ
a modular framework that integrates semantic perception (SEGO), intention-aware planning (IMAGO),
and ontological reasoning with explainable control (LOGOS).
โจ This project aims to realize the vision outlined in these papers:
to build robots that not only act, but also understand โ
semantically, ethically, and reflectively, in collaboration with humans.
- Quick Start
- High-Level Architecture
- Detailed Modules
- Installation Guide
- Runtime Walk-through
- Directory Layout
- Roadmap & Milestones
# 0 ยท Host prerequisites (Ubuntu 22.04 + ROS 2 Humble assumed)
sudo apt update && sudo apt install build-essential git lsb-release curl
# 1 ยท Clone
git clone https://github.com/jack0682/CSA.git
cd CSA && git submodule update --init --recursive
# 2 ยท Setup ROS 2 & Python env
source /opt/ros/humble/setup.bash # adjust if using another distro
python3 -m venv .venv && source .venv/bin/activate
pip install -U pip wheel
rosdep install --from-paths src -yi # system deps
# 3 ยท Build (SEGO only)
colcon build --packages-select \
csa_interfaces csa_yolo_inference csa_slam_interface csa_semantic_mapper
source install/setup.bash
# 4 ยท Run semantic mapping pipeline
ros2 launch csa_launch sego_pipeline.launch.py \
camera_model:=realsense bag:=false visualize:=truegraph TD
%% === SEGO: Semantic Mapping ===
subgraph SEGO [Stage 1: Semantic Mapping]
YT[yolo_tracker_node] --> OBJS[/tracked_objects/]
SLAM[slam_pose_node] --> CAM[/camera/pose/]
OBJS --> MAP[semantic_mapper_node]
CAM --> MAP
MAP --> SG[Scene Graph - JSON]
SG --> MEM[Semantic Memory]
end
%% === IMAGO: Intent Parsing + Planning ===
subgraph IMAGO [Stage 2: Intent Planning]
INTENT[Intent Parser] --> GGRAPH[Goal Graph]
MEM --> GGRAPH
GGRAPH --> PLAN[Trajectory Planner]
end
%% === LOGOS: Reasoning + Control ===
subgraph LOGOS [Stage 3: Ontological Control]
PLAN --> ACT[ฯ Actuator Commands]
PLAN --> XAI[ฮจ XAI Rationale]
XAI --> HRI[HRI UI / Speech]
ONT[ฮฉ Ontology Rules] -.-> PLAN
end
classDef dim fill:#f9f9f9,stroke:#bbb,stroke-dasharray:5 5,color:#777;
class ONT dim;
Data Loop: sensor โ semantic map โ reasoning โ plan โ control โ explanation
Safety Loop: LOGOS continuously validates each plan slice (ฮt) via OWL-based rules; if violation, a fallback BT and human prompt are triggered.
| Feature | Implementation |
|---|---|
| Detector | YOLO v5 6.2 + Ultralytics API |
| Tracker | StrongSORT (boxmot fork) |
| Depth Sampling | RealSense D435 / any aligned depth topic |
| Output Message | csa_interfaces/TrackedObjectArray |
Wraps ORB-SLAM2 (stereo/RGB-D) or RTAB-Map. Publishes geometry_msgs/PoseStamped @ โ30 Hz on /camera/pose. Automatic time-sync with YOLO frames via TF + approx-time-policy.
Projects 2-D bounding boxes into 3-D world frame: Builds an online scene graph (network-x) and dumps incremental .json logs per track (ready for Neo4J ingestion).
{
"class" : "cbn_wooden_box",
"track_id": 27,
"position": [ 0.773, -0.142, 1.035 ],
"size" : [ 0.28, 0.35, 0.12 ], // meters
"pose_cov": [ 5.2e-4, 8.9e-4, โฆ ],
"timestamp": 1715530123.447,
"world_frame": "map",
"source": {
"camera_frame": "realsense_link",
"depth_px": 713
}
}Launch RViz2 with pre-loaded config: /rviz/sego_live.rviz Display: TF tree, /tracked_objects markers (ID-color keyed), occupancy map.
| Layer | Package | Version | Install hint |
|---|---|---|---|
| System | Ubuntu |
22.04 LTS | apt โฆ |
| ROS 2 | Humble Hawksbill |
โฅ 0.11 | link |
| Vision | OpenCV |
4.9 | apt install libopencv-dev |
| ML | PyTorch |
2.2 + CUDA-11.7 | pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 |
| SLAM | ORB-SLAM2 |
custom | included as git submodule |
| Tracker | boxmot |
0.2.x | pip install boxmot |
| Misc | pangolin / eigen3 |
latest | apt install libeigen3-dev libgl1-mesa-dev |
| Step | Node | Topic | Rate | Note |
|---|---|---|---|---|
| โ | Sensor | /camera/color/image_raw |
30 Hz | RealSense RGB |
| โก | yolo_tracker_node |
/tracked_objects |
15 Hz | after NMS + tracker |
| โข | slam_pose_node |
/camera/pose |
30 Hz | worldโcamera TF |
| โฃ | semantic_mapper_node |
/scene_graph (latched) |
2 Hz | heavy but sparse |
| โค | rviz2 |
markers | live | for debugging |
CSA/
โโโ docs/ โ diagrams, papers, design notes
โโโ src/
โ โโโ csa_interfaces/ โ ROS 2 msg definitions
โ โโโ csa_yolo_inference/
โ โโโ csa_slam_interface/
โ โโโ csa_semantic_mapper/
โ โโโ csa_utils/ โ time_sync, coord transforms
โ โโโ csa_launch/
โ โโโ imago_core/ โ planner skeleton (Stage 2)
โ โโโ logos_core/ โ ontology + XAI (Stage 3)
โโโ third_party/ โ submodules (ORB-SLAM2, pangolinโฆ)
โโโ docker/
โโโ .devcontainer/ โ VS Code remote config
โโโ README.md โ you are here| Quarter | Theme | Deliverable |
|---|---|---|
| 2025 Q3 | IMAGO ฮฑ | HTN planner; LLM intent parser |
| 2025 Q4 | LOGOS ฮฑ | Live policy distillation + OWL safety layer |
| 2026 Q1 | Multi-robot demo | Cross-agent shared scene graphs |
| 2026 Q2 | HRI pilot | Common-ground intent classifier, voice+gesture |
| 2026 Q4 | Science Robotics submission | End-to-end human+robots furniture assembly |
-
TEXT QUERY
Parses user language or natural language commands into intent representations.
Connected with an sLLM-based text query and answering system. -
SEGO MODULE
Provides semantic information via scene graphs.
Utilizes SEGO Scene Graph and Ontology Database.
-
Adaptive Compensator (Pole-Zero Autonomous)
Real-time error correction based on pole-zero compensation.
Receives rule/state feedback from the LOGOS MODULE for compensator adjustment. -
Self-Adjusting Controller
Adaptive control optimization. -
Real-Time Motion Executor
Executes final motion commands at the physical level.
- Adaptive Compensator & LOGOS MODULE:
Pole-zero compensation rule exchange
Real-time rule optimization
Meta-level reasoning feedback
Handshake with real-time executor
โ
Provides joint-level control interface (Torque / Velocity / Position)
โ
Real-time control loop period <1ms (RTOS or RT-capable)
โ
Modifiable controller (Open Source or SDK provided)
โ
Access to high-performance sensors/drivers (Force-Torque, Encoders)
โ
Easy ROS2 or RTAPI integration
โ
Low-level bus access (e.g., EtherCAT, CANopen)
โ
Public SDK / HAL available
๐ Target robot arm: Franka Emika Panda
libfranka APIprovides access above the HAL wrapping layer.- Torque commands are injected after internal impedance safety layers.
- Latency accumulates through ROS2 โ API โ internal RT thread โ driver stack.
- Estimated accumulated delay: 3โ5 ms, which threatens phase margin and may induce oscillations.
Ideal design target:
Actual compensator:
With delay:
Effective compensator:
Phase margin degradation:
Lead compensator form:
Smith predictor (model-based):
Final torque command:
Where:
Adaptive update:
Lyapunov function:
With delay compensation:
Global plan reference:
Synchronization constraint:
Synchronization torque:
-
Franka internal controller:
RTOS + safety layers + motor driver layers โ user control applies above HAL.
Internal safety core modification is not allowed. -
libfranka loop:
1 kHz control loop โ 1 ms period
ROS2 โ C++ API call โ internal RT thread -
Delay accumulation risk:
Accumulated delay of several ms reduces phase margin, induces oscillation or overshoot.
- Multi-joint Smith predictor:
- Frequency response with delay:
- Phase margin with frequency dependency:
imago_controller/
โโโ CMakeLists.txt # ROS2 + C++ ๋น๋ ํ์ผ
โโโ package.xml # ROS2 ํจํค์ง ๋ฉํ ์ ๋ณด
โโโ launch/
โ โโโ imago_controller.launch.py # ROS2 launch ํ์ผ
โโโ config/
โ โโโ controller_params.yaml # IMAGO ํ๋ผ๋ฏธํฐ (J, B, delay ๋ฑ)
โ โโโ sync_params.yaml # ๋ค์ค ๋ก๋ด sync ํ๋ผ๋ฏธํฐ
โโโ include/
โ โโโ imago_controller/
โ โโโ imago_controller.hpp # ๋ฉ์ธ ํด๋์ค ์ ์ธ
โ โโโ pole_zero_compensator.hpp # Pole-Zero ๋ณด์๊ธฐ ํด๋์ค
โ โโโ delay_compensator.hpp # Delay-aware ๋ณด์๊ธฐ ํด๋์ค
โ โโโ ml_estimator.hpp # ML ๊ธฐ๋ฐ inertia/Coriolis/gravity ์ถ์
โ โโโ sync_manager.hpp # ๋ค์ค ๋ก๋ด sync ๊ด๋ฆฌ
โ โโโ low_level_interface.hpp # libfranka / EtherCAT ์ธํฐํ์ด์ค
โ โโโ utils.hpp # ๊ณตํต ํจ์ (matrix ops, logging ๋ฑ)
โโโ src/
โ โโโ imago_controller.cpp # ๋ฉ์ธ control loop
โ โโโ pole_zero_compensator.cpp
โ โโโ delay_compensator.cpp
โ โโโ ml_estimator.cpp
โ โโโ sync_manager.cpp
โ โโโ low_level_interface.cpp
โ โโโ main.cpp # ROS2 ๋
ธ๋ ์ง์
์
โโโ urdf/
โ โโโ panda_with_imago.urdf.xacro # Panda + IMAGO ์ถ๊ฐ ๋งํฌ/์ผ์ URDF
โโโ meshes/
โ โโโ (ํ์ ์ custom link/EE mesh ํ์ผ)
โโโ scripts/
โ โโโ test_plot.py # Latency/torque/sync ๋ฐ์ดํฐ ์๊ฐํ
โโโ tests/
โ โโโ test_imago_controller.cpp # gtest ๊ธฐ๋ฐ ์ ๋ํ
์คํธ
โโโ docs/
โ โโโ design_overview.md # ์ค๊ณ ๋ฌธ์
โโโ data_logs/
โ โโโ (์คํ ์ค ์์ฑ๋๋ log ํ์ผ ์ ์ฅ)
โโโ README.md # ์ ์ฒด ๊ฐ์ ์ค๋ช


