Closed shamaanikala closed 8 years ago
The purpose of the moveToNextPoint() method is to simulate, what would be the new GPS coordinate after we've shut down the GPS receiver for _dt seconds. This is affected by:
The larger the drift, the more the boat will (unintentionally) steer off course. Thus, the drift does affect both the TRUE heading and the TRUE distance traveled by the boat (which can be (and most often are) different from the requested values of 1, if and only if there is a non-zero drift). Both the boat and drift velocities are vectors; I don't think you can add their magnitudes like that.
Instead, you've got to add the two vectors (boat requested velocity + drift) together to get the final point where the boat will end up after its GPS receiver has been turned ON again (after time _dt).
-Juho
And those "wished for" speed and heading are stored in _boatSpeed and _heading of the GpsSimulator, respectively. In this case, you don't have to care about how/when are they set.
Remember the Coord::destination(heading, distance) function.
Here's a brief overview of the problem: http://www.physicsclassroom.com/class/vectors/Lesson-1/Relative-Velocity-and-Riverboat-Problems Again, it's just adding the two vectors together.
The first version assumed that the heading was somehow pointing to the right direction.
The distance the boat is going to move is now calculated from the values of the simulator with the formula s = (boatSpeed+driftSpeed)*dt.