yorgoon / minimum-snap-geometric-control

Quadrotor control using minimum snap trajectory optimization and SE3 geometric controller
104 stars 31 forks source link

Question about the code #3

Open RandyChen233 opened 2 years ago

RandyChen233 commented 2 years ago

Hi,

Your code is very well written! I just have a question: how should I remove the obstacle constraints in the path planning? I would like to generate a 3-D minimum snap trajectory without any obstacle constraints at all (such as the screenshot of that helical path). I can't figure out how I should do that by modifying 'mainsim.m'

yorgoon commented 2 years ago

Hi Randy,

You can generate an object of the class MinimumSnapTrajectoy as long as you have appropriate tau_vec and path arguments.

traj_obj = MinimumSnapTrajectory(tau_vec, path)

yorgoon commented 2 years ago

path should consist of the way points including start and end, and tau_vec should be time intervals corresponding to that path.

yorgoon commented 2 years ago

If you want to allocate time interval automatically, you can use time allocation technique that I used in here.

yorgoon commented 2 years ago

If you want to allocate time interval automatically, you can use time allocation technique that I used in here.

path = [0,0,0;1,1,0;2,0,0;1,-1,0;0,0,0;-1,1,0;-2,0,0;-1,-1,0;0,0,0]; tau_vec = timeAllocation(path, 100)';

yorgoon commented 2 years ago

If you want to allocate time interval automatically, you can use time allocation technique that I used in here.

path = [0,0,0;1,1,0;2,0,0;1,-1,0;0,0,0;-1,1,0;-2,0,0;-1,-1,0;0,0,0]; tau_vec = timeAllocation(path, 100)';

With this generated tau_vec, you can create a trajectory object.

yorgoon commented 2 years ago

If you want to allocate time interval automatically, you can use time allocation technique that I used in here.

path = [0,0,0;1,1,0;2,0,0;1,-1,0;0,0,0;-1,1,0;-2,0,0;-1,-1,0;0,0,0]; tau_vec = timeAllocation(path, 100)';

With this generated tau_vec, you can create a trajectory object.

The second argument 100 is time penalty. If you increase this number, you will have shorter time intervals, meaning having a faster trajectory.

RandyChen233 commented 2 years ago

thank you so much!!! just another question: how should I design the desired yaw vector such that the heading of the drone is aligned with the direction it is going? I think intuitively I should just set desired.yaw = desired. velocity, but I keep getting some errors that I don't know how to resolve

yorgoon commented 2 years ago

yawd = desired_state.yaw; yawd_dot = desired_state.yawdot; yawd_2dot = desired_state.yawddot;

you get errors when you set desired yaw as implemented in the controller.m ?

RandyChen233 commented 2 years ago

Sorry I didn't make it clear: I was trying to change desired.yaw such that when the simulation is run, the heading of the drone is aligned with the trajectory (direction of the path). I thought I can set desired.yaw = vel, but it is not working

yorgoon commented 2 years ago

desired.yaw should be a scalar whereas vel is 3-dimensional vector. I don't think you can just set equal them.

RandyChen233 commented 2 years ago

I see, thanks! Is there a way to make the heading direction point along the trajectory?