udacity / sdc-issue-reports

29 stars 6 forks source link

Inconsistency in defining formula for cte(t+1) #1440

Closed proshan75 closed 5 years ago

proshan75 commented 5 years ago

Formula for ctet+1​ seems to be different on two pages. In lesson 18, section 10, it is defined and explained as: ctet+1​=yt​−f(xt​)+(vt​∗sin(eψt​)∗dt)

But the solution (section 9) in lesson 19 has implementation as below: ctet+1​=f(xt​)−yt​+(vt​sin(eψt​)dt)

Which one is correct?

Based on the feedback from mentors it depends on how eψt is calculated. Please provide clarification in the lesson or make it consistent.

Thanks, Prashant

mvirgo commented 5 years ago

Nice catch!

I think the mentors are technically correct that how eψt is calculated could change this, but we've have eψt defined the same way in both locations. As such, I've updated it so that both locations use the second version of the above equation (with cte defined as f(x_t) - y_t).

In fact, trying out the first version of the equation in the full MPC project results in the car running off the road (as would be expected really), so that further confirms it.