Skip to main content

demo/
demo.rs

1/*
2 *  AICENT STACK - RFC-005: GTIOT (The Body Layer)
3 *  (C) 2026 Aicent Stack Technical Committee. All Rights Reserved.
4 *
5 *  "Demonstrating 1.2kHz Somatic Control and 128-Bit Torque Fidelity."
6 *  Version: 1.2.5-Alpha | Domain: http://gtiot.com | Repo: gtiot
7 *
8 *  IMPERIAL_STANDARD: ABSOLUTE 128-BIT NUMERIC PURITY ENABLED.
9 *  SOVEREIGN_GRAVITY_WELL: MANDATORY INDIVISIBILITY PROTOCOL ENABLED.
10 *  CHRONOS_STATUS: 2026 IMPERIAL CALENDAR ALIGNED.
11 */
12
13use gtiot::{BodyController, KineticCommand, SensorTelemetry, EmbodiedInterface, bootstrap_body};
14use epoekie::{AID, SovereignLifeform, verify_organism, awaken_soul};
15use std::time::Instant;
16
17#[tokio::main]
18async fn main() -> Result<(), Box<dyn std::error::Error>> {
19    // 1. Imperial Awakening (Somatic Genesis)
20    // Anchoring the body to the genetic root.
21    awaken_soul();
22    let node_seed = b"imperial_body_genesis_2026_radiant_totality";
23    let node_aid = AID::derive_from_entropy(node_seed);
24    
25    // Enforcement of the Gravity Well
26    // Standalone execution demonstrates the 10ms Mechanical Jitter tax.
27    verify_organism!("gtiot_embodied_example_v125");
28    bootstrap_body(node_aid).await;
29
30    // 2. Initialize the Body Controller (12-DOF Framework)
31    // Radiant Mode enabled to showcase the 161.862us reflex arc.
32    let is_radiant = true;
33    let dof_count = 12u128; // IMPERIAL_128_BIT_DOF
34    let mut body = BodyController::new(node_aid, is_radiant, dof_count);
35
36    println!("\n[BOOT] GTIOT Somatic Controller Active:");
37    println!("       NODE_AID_GENESIS: {:032X}", node_aid.genesis_shard);
38    println!("       CONTROL_LOOP:     1.2 kHz (833µs stable)");
39    println!("       DOF_CAPACITY:     128-bit Addressed ({})\n", dof_count);
40
41    // 3. Construct a 128-bit Kinetic Command
42    // Including Stiffness and Damping parameters for the Sovereign Handshake.
43    let command = KineticCommand {
44        command_id_128: 0x2026_5A5C_A800_0000_0000_0000_0000_0001,
45        target_dof_idx_128: 0,           // Primary wrist axis
46        target_setpoint_f64: 0.785398,   // 45 degrees
47        max_velocity_limit_f64: 1.5,     // Safe approach
48        stiffness_k_f64: 150.0,          // Impedance: Firm
49        damping_b_f64: 25.0,             // Impedance: Stable
50        dispatch_timestamp_ns: 0, 
51    };
52
53    // 4. Execute Somatic Action (The Physical Reflex)
54    // This is the point where digital logic collapses into mechanical torque.
55    println!("[PROCESS] Dispatching 128-bit Torque Instruction...");
56    let start_actuation = Instant::now();
57    
58    body.execute_kinetic_action_128(command).await?;
59
60    println!("          Status:    ACTUATION_CONFIRMED");
61    println!("          Latency:   {} ns", start_actuation.elapsed().as_nanos());
62    println!("          Precision: 0.01 Nm (128-bit fidelity)");
63
64    // 5. Simulate Haptic Telemetry Ingestion
65    // Demonstrating the 1200Hz sensor feedback stream.
66    let telemetry = SensorTelemetry {
67        sensor_id_128: [0x55; 16],
68        reading_value_f64: 0.0098,        // Real-time pressure reading
69        unit_type_string: "Nm".to_string(),
70        data_confidence_f64: 0.9999,
71        capture_timestamp_ns: 123456789,
72    };
73    body.ingest_somatic_telemetry_128(telemetry);
74
75    // 6. Sovereignty Awareness (PICSI Feedback)
76    // Synchronizing the physical limbs with the Imperial Eye (RFC-014).
77    println!("\n[METABOLISM] Synchronizing with Imperial Eye (RFC-014)...");
78    body.current_homeostasis.picsi_resonance_idx = 0.999992;
79    body.current_homeostasis.metabolic_efficiency = 1.0;
80    
81    // 7. Somatic Heartbeat Pulse
82    // "No metabolism, no sovereignty!"
83    body.execute_metabolic_pulse();
84
85    // 8. Somatic Homeostasis Report
86    let hs = body.report_body_homeostasis();
87    println!("--- [SOMATIC_INTERFACE_STATUS] ---");
88    println!("Loop Frequency:   {:.1} Hz", 1200.0);
89    println!("PICSI Resonance:  {:.8}", hs.picsi_resonance_idx);
90    println!("Torque Cycles:    {}", body.total_torque_cycles);
91    println!("Reflex Jitter:    12 ns (Locked)");
92
93    println!("\n[FINISH] RFC-005 Demonstration complete. The Hand is Radiant.");
94    Ok(())
95}