Skip to content

Commit

Permalink
Added unit conversion as constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Facundo Garcia committed Jan 15, 2024
1 parent b243cde commit 4ece541
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions fixposition_driver_lib/src/gprmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

namespace fixposition {

// unit transformation constant
static constexpr double knots_to_ms = 1852.0 / 3600.0; //!< convert knots to m/s

/// msg field indices
static constexpr const int time_idx = 1;
static constexpr const int status_idx = 2;
Expand Down Expand Up @@ -57,8 +60,8 @@ void GprmcConverter::ConvertTokens(const std::vector<std::string>& tokens) {
if (tokens.at(lon_ew_idx).compare("W") == 0) _lon *= -1;
msg_.longitude = _lon;

// Speed and course over groung
msg_.speed = StringToDouble(tokens.at(speed_idx)) * 1852.0 / 3600.0;
// Speed [m/s] and course [deg] over ground
msg_.speed = StringToDouble(tokens.at(speed_idx)) * knots_to_ms;
msg_.course = StringToDouble(tokens.at(course_idx));

// Get GPS status
Expand Down
2 changes: 1 addition & 1 deletion fixposition_driver_ros1/launch/tcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fp_output:
formats: ["ODOMETRY", "LLH", "RAWIMU", "CORRIMU", "GPGGA", "GPZDA", "GPRMC", "TF"]
type: tcp
port: "21000"
ip: "10.0.2.1" # change to VRTK2's IP address in the network
ip: "127.0.0.1" # change to VRTK2's IP address in the network
rate: 200
reconnect_delay: 5.0 # wait time in [s] until retry connection

Expand Down
Empty file.

0 comments on commit 4ece541

Please sign in to comment.