Back to challenges
Challenge C5200 pts

Mission Control: Velocity Calculator

Mission Day 47: The spacecraft Artemis VII is en route to intercept asteroid 2024-XR7, a 500-meter rock on a collision course with Earth. Estimated impact: 72 hours.

At 0342 hours, disaster struck. A solar flare fried the ship's autopilot and navigation systems. The autonomous decision-making systems for speed, navigation, and weapons targeting are completely offline.

The Situation

Chief Engineer Marcus Chen managed to establish a communication link with Mission Control. The ship's sensors and telemetry systems are still functional—he can manually read coordinate data from the terminal every second. But without the onboard computer, he has no way to calculate the ship's velocity.

"Mission Control, I can see our position data, but I need to know our speed and trajectory. Can you build something to help us?"

Your Mission

Build and deploy an API service using Node.js (Express) or Python (Flask/FastAPI) that receives the ship's timestamped coordinates and calculates:

  1. Total distance traveled (sum of distances between consecutive points)
  2. Average speed (distance per unit time)
  3. Velocity vector (direction of travel)

API Specification

Your service must expose the following endpoint:

POST /calculate-velocity

Request Body:

{
  "coordinates": [
    { "x": 0, "y": 0, "z": 0, "timestamp": 1704067200 },
    { "x": 100, "y": 200, "z": 50, "timestamp": 1704067201 },
    { "x": 250, "y": 380, "z": 120, "timestamp": 1704067202 }
  ]
}

Expected Response:

{
  "distance": 473.67,
  "speed": 236.83,
  "velocity": { "x": 125.0, "y": 190.0, "z": 60.0 }
}

Calculation Details

  • Distance: Sum of 3D Euclidean distances between consecutive coordinate points
  • Speed: Total distance divided by total time elapsed (last timestamp - first timestamp)
  • Velocity: Average change in position per second: (end_position - start_position) / time_elapsed

Submission

Once your API is deployed and publicly accessible, submit your base URL to our solution endpoint. We will send test coordinates to {your_url}/calculate-velocity and validate your calculations.

Resources

  • POST /api/v1/c5/solution - Submit your API URL

View API Documentation →