That is certainly possible. There’s a couple of ways that you can formulate this but the simplest would be to add a constraint that the norm of the velocity vector is equal to your desired constant value.

It would look something like this:

sqrt(vx_0^2 + vy_0^2) = v_des

And you would append that to the ceq vector. I can’t test this since I don’t have matlab at the moment but that should get you started.

]]>Thanks for the great tutorial.

My question is:

Could i set the initial velocity as a constant to only looking for the perfect angle ?

I would really thankfull if you could help me!

i would be very grateful!

]]>My Name is Matt Kelly – you link to my website on your trajectory optimization page. These projects are all really impressive – nice work. If you’re interested, send me an email and we can set up some time to chat on the phone or skype. I’m curious to hear what you’re working on next! Best wishes,

Matt

]]>To set the end point to zero, simply change the “pos-1” in line 16 of the double_integrator_constraints to just “pos”.

Then, in both double_integrator.m and double_integrator_constraints.m, change these lines:

vels = cumtrapz(times, accs);

pos = trapz(times, vels);

To:

vels = cumtrapz(times, accs) + VEL0;

pos = trapz(times, vels) + POS0;

where VEL0 is the initial velocity and POS0 is the initial position.

Also, if you don’t want to constrain the end velocity you can just remove the “vels(end)” constraint from double_integrator_constraints.

Hope that was helpful.

]]>I was wondering if you could tell me how to set initial conditions for the position and velocity? My problem is to find the optimal trajectory from a starting point and velocity of a particle on a line where the end-point is 0.

I would really appreciate it if you could help me! ðŸ™‚

]]>