How hggshiwo/dankong works
Dankong is a modular robot-control system built around a dk event-driven hierarchical state machine. Its principal workflow is external commands entering through adapters, being converted to events, handled by listeners and scheduled as state/mission actions; states read shared context, invoke tracking or landing logic, and command a robot abstraction. The README documents the adapter, robot, feature and HSM layers; the source index confirms selected assembly, state, control and MAVLink relationships. Some feature internals and adapter bindings were not sampled, so those links are documented rather than inferred from names.
Main entry points: targets Robot context · adapters Protocol adapters · states Robot behavior states · irobot.hpp Robot abstraction
Components 19
Startup and adapters
- Dankong node
src/dankong_node.cpp - Protocol adapters
src/adapters
Control runtime
- Control listener
src/features/control/event_listener.cpp - Event HSM engine
include/core/engine.hpp - Robot behavior states
include/states - Robot context
include/targets
Robot capabilities
- Motion tracker
include/features/tracker/tracker.hpp - Precision landing
include/features/pland/landing_controller.hpp - Algorithm features
include/features/algo - RTK corrections
include/features/ntrip/ntrip_client.hpp - State reporting
include/features/report
Robot and protocols
- Robot abstraction
include/robot/irobot.hpp - Vehicle implementations
include/robot - MAVLink interface
include/mavlink/imavlink.hpp - MAVSDK transport
src/mavlink/mavsdk_drone.cpp
Shared services
- Configuration manager
include/core/global_config.hpp - State registry
include/utils/state_registry.hpp - Shared state values
include/utils/dirty_var.hpp
Other components
- External command
Connections 22
- External command → Protocol adapters: sends commands
- Protocol adapters → Robot context: bind observations
- Protocol adapters → Control listener: bind events
- Dankong node → Robot context: assembles target
include/targets/car/robot_context.hpp - Control listener → Event HSM engine: returns actions
- Event HSM engine → Robot behavior states: dispatches actions
- Robot behavior states → Robot context: reads state
include/states/posvel_state.hpp - Robot behavior states → Motion tracker: sends position commands
include/states/posvel_state.hpp - Robot behavior states → Robot abstraction: issues control
include/states/state_utils.hpp - Precision landing → Robot context: uses observations
include/features/pland/landing_controller.hpp - Robot context → Motion tracker: provides tracker context
include/targets/car/robot_context.hpp - Robot context → Precision landing: provides landing context
include/targets/drone/robot_context.hpp - Robot context → Algorithm features: includes feature context
include/targets/drone/robot_context.hpp - Robot context → RTK corrections: includes feature context
include/targets/drone/robot_context.hpp - Robot context → State reporting: includes feature context
include/targets/car/robot_context.hpp - State reporting → State registry: registers values
include/features/report/context.hpp - State registry → Shared state values: reads dirty values
include/utils/state_registry.hpp - Vehicle implementations → Robot abstraction: implements interface
include/robot/car.hpp - Robot abstraction → MAVLink interface: forwards commands
include/robot/irobot.hpp - MAVSDK transport → MAVLink interface: implements transport
- Configuration manager → Robot context: supplies settings
include/core/global_config.hpp - Protocol adapters → MAVLink interface: optional transport binding