You are the pilot of a spaceship at the origin P_start = (0,0,0) at time t = 0. Your mission is to reach a space station located at G = (x_g, y_g, z_g ) in the minimum possible time T.
1.Spaceship Dynamics:
The spaceship can move in any direction in 3D space with a maximum constant speed V_max. Let S(t) be the position of the ship at time t, The constraint on its velocity is:
2.Moving Obstacles ( Asteroids ):
There are N spherical asteroids in the field. Each asteroid i is defined by its initial position.
P_i0 = (x_i, y_i, z_i ), a constant velocity vector V_i = ( v*x_i, v*y_i, v*z_i ), and a radius R_i.
The position of the center of asteroid i at any time t >= 0 is:
3.Safety Constraint:
To avoid dustruction, the spaceship must never enter the volume of any asteroid. At all times t ∈ [0,T], the distance between the ship and every asteroid center must satisfy:
4.Goal:
Find the minimum time T such that S(T) = G. If the goal is unreachable due to obstacles, return Inf.
Input:
- goal: A 1x3 vector [x_g, y_g, z_g]
- Vmax: A scalar representing your maximum speed.
- asteroids: An Nx7 matrix. Each row represents [x_0, y_0, z_0, vx, vy, vz, R].
Output:
- min_T: A scalar representing the shortest time to reach the goal
P/s: Sorry for not being clean in presentation, hope you guys sympathize with me :((
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers2
Suggested Problems
More from this Author15
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I tryna change something in my code and it was still right eventhought I should be wrong, hope you change it soon
Tks for your ideas, I've been updated it