MCPcopy Create free account
hub / github.com/comaps/comaps / generate_simctl_command

Function generate_simctl_command

tools/python/ios_simulator_load_gpx.py:33–55  ·  view source on GitHub ↗

Generate simctl location start command.

(points, speed_kmh=60, interval=0.1, distance=None, device="booted")

Source from the content-addressed store, hash-verified

31 return points
32
33def generate_simctl_command(points, speed_kmh=60, interval=0.1, distance=None, device="booted"):
34 """Generate simctl location start command."""
35 if len(points) < 2:
36 raise ValueError("Need at least 2 waypoints for simctl location start")
37
38 # Convert km/h to m/s
39 speed_mps = speed_kmh / 3.6
40
41 # Format waypoints as lat,lon pairs
42 waypoint_strings = [f"{lat:.6f},{lon:.6f}" for lat, lon in points]
43
44 # Build command
45 cmd = ["xcrun", "simctl", "location", device, "start"]
46 cmd.append(f"--speed={speed_mps:.2f}")
47
48 if distance:
49 cmd.append(f"--distance={distance}")
50 else:
51 cmd.append(f"--interval={interval}")
52
53 cmd.extend(waypoint_strings)
54
55 return cmd
56
57def main():
58 parser = argparse.ArgumentParser(

Callers 1

mainFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected