DAIRLab / dairlib

MIT License
66 stars 26 forks source link

Set impact velocities initial guess #237

Closed ShaneRozenLevy closed 10 months ago

ShaneRozenLevy commented 3 years ago

Added new function for setting initial guess from trajectories. This has a few advantages over the current interface:

  1. Sets initial guess for post impact velocities
  2. Sets initial guess for the duration of each segment based the length of time allocated per mode
  3. When evaluating force trajectory & state trajectory uses the correct times

I have done some testing of this and it seems good, but it likely needs more testing and a second set of eyes before merging it in.


This change is Reviewable

ShaneRozenLevy commented 3 years ago

In terms of the start and end time, I wrote this function assuming the start and end of the spline might not be the start and end of mode. If you think thats a reasonable assumption I can set start time and end time using the inputted spline.

ShaneRozenLevy commented 3 years ago

Hmm, so thats close to the purpose of those variables, but not quite it. I use the start and end time for 2 purposes.

  1. To calculate the initial guess for the duration of the mode
  2. When evaluating traj_init_x for the intial guess for a particular mode I evaluate it starting at start_time and going to end_time.

Depending on how your code is setup you might want to set start time to be 0 for each mode or maybe you want to set start_time to be your actual guess for the time the mode start. It all depends on which interval of time from the traj_init_x you want to use for the initial guess. I'm also assuming the traj_init_x does not necessarily start and start_time and end at end_time (if I did, I could get start_time and end_time from the pp_traj object).