Skip to main content

feagi_structures/templates/
motor_cortical_units.rs

1#[macro_export]
2macro_rules! motor_cortical_units {
3    ($callback:ident) => {
4        $callback! {
5            MotorCorticalUnit {
6
7                #[doc = "Free spinning motor."]
8                RotaryMotor => {
9                    friendly_name: "Rotary Motor",
10                    accepted_wrapped_io_data_type: SignedPercentage, // This property determines what type of registration funciton will be generated
11                    cortical_id_unit_reference: *b"mot",
12                    number_cortical_areas: 1,
13                    cortical_type_parameters: {
14                        frame_change_handling: FrameChangeHandling,
15                        percentage_neuron_positioning: PercentageNeuronPositioning
16                    },
17                    cortical_area_properties: {
18                        0 => (IOCorticalAreaConfigurationFlag::SignedPercentage(frame_change_handling, percentage_neuron_positioning), relative_position: [-20, 0, -10], channel_dimensions_default: [1, 1, 9], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024])
19                    }
20                },
21
22                #[doc = "Servo Position, defined by min / max distances. Uses unsigned Percentage (0-100%)."]
23                PositionalServo => {
24                    friendly_name: "Positional Servo",
25                    accepted_wrapped_io_data_type: Percentage,
26                    cortical_id_unit_reference: *b"pse",
27                    number_cortical_areas: 2,
28                    cortical_type_parameters: {
29                        frame_change_handling: FrameChangeHandling,
30                        percentage_neuron_positioning: PercentageNeuronPositioning
31                    },
32                    cortical_area_properties: {
33                        0 => (IOCorticalAreaConfigurationFlag::Percentage(FrameChangeHandling::Absolute, percentage_neuron_positioning), relative_position: [-20, 0, -10], channel_dimensions_default: [1, 1, 10], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024]),
34                        1 => (IOCorticalAreaConfigurationFlag::Percentage(FrameChangeHandling::Incremental, percentage_neuron_positioning), relative_position: [-40, 0, -10], channel_dimensions_default: [2, 1, 10], channel_dimensions_min: [2, 1, 1], channel_dimensions_max: [2, 1, 1024])
35                    }
36                },
37
38                #[doc = "Gaze control, where the first 2 numbers are the XY center, and the last number is the relative size"]
39                Gaze => {
40                    friendly_name: "Gaze Control",
41                    accepted_wrapped_io_data_type: GazeProperties,
42                    cortical_id_unit_reference: *b"gaz",
43                    number_cortical_areas: 2,
44                    cortical_type_parameters: {
45                        frame_change_handling: FrameChangeHandling,
46                        percentage_neuron_positioning: PercentageNeuronPositioning
47                    },
48                    cortical_area_properties: {
49                        0 => (IOCorticalAreaConfigurationFlag::Percentage2D(frame_change_handling, percentage_neuron_positioning), relative_position: [10, 0, -10], channel_dimensions_default: [8, 8, 1], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1024, 1024, 1]), // Eccentricity
50                        1 => (IOCorticalAreaConfigurationFlag::Percentage(frame_change_handling, percentage_neuron_positioning), relative_position: [0, 0, -10], channel_dimensions_default: [1, 1, 10], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024]) // Modularity
51                    }
52                },
53
54
55                #[doc = "Miscellaneous motor that does not fit existing templates."]
56                MiscData => {
57                    friendly_name: "Miscellaneous Motor",
58                    accepted_wrapped_io_data_type: MiscData,
59                    cortical_id_unit_reference: *b"mis",
60                    number_cortical_areas: 1,
61                    cortical_type_parameters: {
62                        frame_change_handling: FrameChangeHandling,
63                    },
64                    cortical_area_properties: {
65                        0 => (IOCorticalAreaConfigurationFlag::Misc(frame_change_handling), relative_position: [300, 0, -30], channel_dimensions_default: [8, 8, 1], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1024, 1024, 1024])
66                    }
67                },
68
69                #[doc = "Text output (English) - token stream encoded as absolute fractional bitplanes along Z (z=0 is MSB)."]
70                TextEnglishOutput => {
71                    friendly_name: "Text Output (English)",
72                    accepted_wrapped_io_data_type: MiscData,
73                    cortical_id_unit_reference: *b"ten",
74                    number_cortical_areas: 1,
75                    cortical_type_parameters: {
76                        frame_change_handling: FrameChangeHandling,
77                    },
78                    allowed_frame_change_handling: [Absolute],
79                    cortical_area_properties: {
80                        // 1x1x16 default: one token per FEAGI tick, encoded into 16 bitplanes (supports GPT-2 vocab via token_id+1 offset).
81                        0 => (IOCorticalAreaConfigurationFlag::Misc(frame_change_handling), relative_position: [85, 0, -30], channel_dimensions_default: [1, 1, 16], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 32])
82                    }
83                },
84
85                #[doc = "Count output - unsigned percentage encoding (linear, absolute)."]
86                CountOutput => {
87                    friendly_name: "Count Output",
88                    accepted_wrapped_io_data_type: Percentage,
89                    cortical_id_unit_reference: *b"cnt",
90                    number_cortical_areas: 1,
91                    cortical_type_parameters: {
92                        frame_change_handling: FrameChangeHandling,
93                        percentage_neuron_positioning: PercentageNeuronPositioning
94                    },
95                    allowed_frame_change_handling: [Absolute],
96                    cortical_area_properties: {
97                        0 => (IOCorticalAreaConfigurationFlag::Percentage(frame_change_handling, percentage_neuron_positioning), relative_position: [175, 0, -30], channel_dimensions_default: [1, 1, 10], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024])
98                    }
99                },
100
101                #[doc = "Object semantic segmentation output (bitplane class encoding)"]
102                ObjectSegmentation => {
103                    friendly_name: "Object Segmentation",
104                    accepted_wrapped_io_data_type: MiscData,
105                    cortical_id_unit_reference: *b"seg",
106                    number_cortical_areas: 1,
107                    cortical_type_parameters: {
108                        frame_change_handling: FrameChangeHandling,
109                    },
110                    allowed_frame_change_handling: [Absolute],
111                    cortical_area_properties: {
112                        0 => (IOCorticalAreaConfigurationFlag::Misc(frame_change_handling), relative_position: [-200, 0, 0], channel_dimensions_default: [32, 32, 8], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [4096, 4096, 1024])
113                    }
114                },
115
116                #[doc = "Visual thoughts output - RGB image generation from brain activity"]
117                SimpleVisionOutput => {
118                    friendly_name: "Simple Vision",
119                    accepted_wrapped_io_data_type: ImageFrame,
120                    cortical_id_unit_reference: *b"img",
121                    number_cortical_areas: 1,
122                    cortical_type_parameters: {
123                        frame_change_handling: FrameChangeHandling,
124                    },
125                    cortical_area_properties: {
126                        0 => (IOCorticalAreaConfigurationFlag::CartesianPlane(frame_change_handling), relative_position: [-240, 60, -20], channel_dimensions_default: [128, 128, 3], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [4096, 4096, 3])
127                    }
128                },
129
130                #[doc = "Pose estimation output - XY plane encodes joint location, Z depth encodes joint ID. PSP magnitude encodes confidence."]
131                PoseEstimation => {
132                    friendly_name: "Pose Estimation",
133                    accepted_wrapped_io_data_type: PoseEstimationData,
134                    cortical_id_unit_reference: *b"pos",
135                    number_cortical_areas: 1,
136                    cortical_type_parameters: {
137                        frame_change_handling: FrameChangeHandling,
138                        pose_schema: PoseSchema,
139                    },
140                    allowed_frame_change_handling: [Absolute],
141                    cortical_area_properties: {
142                        0 => (IOCorticalAreaConfigurationFlag::PoseEstimation(frame_change_handling, pose_schema), relative_position: [-200, 60, 0], channel_dimensions_default: [64, 64, 17], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [4096, 4096, 256])
143                    }
144                },
145
146                #[doc = "Image Processing configuration - dynamically control brightness, contrast, and per pixel diff thresholding"]
147                DynamicImageProcessing => {
148                    friendly_name: "Image Enhancements",
149                    accepted_wrapped_io_data_type: ImageFilteringSettings,
150                    cortical_id_unit_reference: *b"ifs",
151                    number_cortical_areas: 4,
152                    cortical_type_parameters: {
153                        frame_change_handling: FrameChangeHandling,
154                        percentage_neuron_positioning: PercentageNeuronPositioning
155                    },
156                    cortical_area_properties: {
157                        0 => (IOCorticalAreaConfigurationFlag::Percentage(frame_change_handling, percentage_neuron_positioning), relative_position: [0, 0, 0], channel_dimensions_default: [1, 1, 10], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024]), // brightness
158                        1 => (IOCorticalAreaConfigurationFlag::Percentage(frame_change_handling, percentage_neuron_positioning), relative_position: [0, 0, -10], channel_dimensions_default: [1, 1, 10], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [1, 1, 1024]), // contrast
159                        2 => (IOCorticalAreaConfigurationFlag::Percentage2D(frame_change_handling, percentage_neuron_positioning), relative_position: [0, 0, -30], channel_dimensions_default: [2, 1, 10], channel_dimensions_min: [2, 1, 1], channel_dimensions_max: [2, 1, 1024]), // per pixel diff
160                        3 => (IOCorticalAreaConfigurationFlag::Percentage2D(frame_change_handling, percentage_neuron_positioning), relative_position: [0, 0, -30], channel_dimensions_default: [2, 1, 10], channel_dimensions_min: [2, 1, 1], channel_dimensions_max: [2, 1, 1024]) // image diff
161                    }
162                },
163
164                #[doc = "Spatial pointer output - decodes activity into one normalized XYZ percentage tuple."]
165                SpatialPointer => {
166                    friendly_name: "Spatial Pointer",
167                    accepted_wrapped_io_data_type: SpatialPointer3D,
168                    cortical_id_unit_reference: *b"ptr",
169                    number_cortical_areas: 1,
170                    cortical_type_parameters: {
171                        frame_change_handling: FrameChangeHandling,
172                        percentage_neuron_positioning: PercentageNeuronPositioning
173                    },
174                    allowed_frame_change_handling: [Absolute, Incremental],
175                    cortical_area_properties: {
176                        0 => ($crate::genomic::cortical_area::io_cortical_area_configuration_flag::spatial_pointer_io_flag(frame_change_handling, percentage_neuron_positioning), relative_position: [210, 0, -30], channel_dimensions_default: [64, 64, 1], channel_dimensions_min: [1, 1, 1], channel_dimensions_max: [4096, 4096, 4096])
177                    }
178                },
179
180            }
181        }
182    };
183}