helsinkiAUV / auv

Software for the Autonomous Underwater Vehicle developed by the University of Helsinki physics students.
GNU General Public License v3.0
1 stars 0 forks source link

Updates GpsSimulator::moveToNextPoint() method #11

Closed shamaanikala closed 8 years ago

shamaanikala commented 8 years ago

The distance the boat is going to move is now calculated from the values of the simulator with the formula s = (boatSpeed+driftSpeed)*dt.

juppiega commented 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:

  1. The requested or "wished for" heading and speed of the boat. This is computed by other functions (e.g. "newBearing" in "navigation.cpp") and represents the path that the boat would exactly follow if the drift were zero.
  2. The heading and speed of an unwanted drift (caused by e.g. winds and ocean currents).

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

juppiega commented 8 years ago

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.

juppiega commented 8 years ago

Remember the Coord::destination(heading, distance) function.

juppiega commented 8 years ago

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.

shamaanikala commented 8 years ago

The first version assumed that the heading was somehow pointing to the right direction.