MCPcopy Create free account
hub / github.com/botbotrobotics/BotBrain / generateYAML

Function generateYAML

frontend/src/utils/ros/mapFileUtils.ts:121–140  ·  view source on GitHub ↗
(metadata: MapMetadata)

Source from the content-addressed store, hash-verified

119
120// Generate YAML content
121export function generateYAML(metadata: MapMetadata): string {
122 const lines: string[] = [];
123
124 // Required fields first
125 lines.push(`image: ${metadata.image}`);
126 lines.push(`resolution: ${metadata.resolution}`);
127 lines.push(`origin: [${metadata.origin.join(', ')}]`);
128 lines.push(`negate: ${metadata.negate}`);
129 lines.push(`occupied_thresh: ${metadata.occupied_thresh}`);
130 lines.push(`free_thresh: ${metadata.free_thresh}`);
131
132 // Add any additional fields
133 for (const [key, value] of Object.entries(metadata)) {
134 if (!['image', 'resolution', 'origin', 'negate', 'occupied_thresh', 'free_thresh'].includes(key)) {
135 lines.push(`${key}: ${value}`);
136 }
137 }
138
139 return lines.join('\n');
140}
141
142// Convert canvas to PGM format
143export function canvasToPGM(canvas: HTMLCanvasElement): ArrayBuffer {

Callers 1

MapEditorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected