Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload operator<< to print position and velocity ned #715

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions plugins/telemetry/include/plugins/telemetry/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,28 @@ bool operator==(const Telemetry::Position &lhs, const Telemetry::Position &rhs);
*/
std::ostream &operator<<(std::ostream &str, Telemetry::Position const &position);

/**
* @brief Stream operator to print information about a `Telemetry::PositionNED`.
*
* @return A reference to the stream.
*/
std::ostream &operator<<(std::ostream &str, Telemetry::PositionNED const &position_ned);

/**
* @brief Stream operator to print information about a `Telemetry::VelocityNED`.
*
* @return A reference to the stream.
*/
std::ostream &operator<<(std::ostream &str, Telemetry::VelocityNED const &velocity_ned);

/**
* @brief Stream operator to print information about a `Telemetry::PositionVelocityNED`.
*
* @return A reference to the stream.
*/
std::ostream &operator<<(std::ostream &str,
Telemetry::PositionVelocityNED const &position_velocity_ned);

/**
* @brief Equal operator to compare two `Telemetry::Health` objects.
*
Expand Down
25 changes: 25 additions & 0 deletions plugins/telemetry/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,31 @@ std::ostream &operator<<(std::ostream &str, Telemetry::Position const &position)
<< ", rel_alt: " << position.relative_altitude_m << "]";
}

std::ostream &operator<<(std::ostream &str, Telemetry::PositionNED const &position_ned)
{
return str << "[position_north_m: " << position_ned.north_m
<< ", position_east_m: " << position_ned.east_m
<< ", position_down_m: " << position_ned.down_m << "]";
}

std::ostream &operator<<(std::ostream &str, Telemetry::VelocityNED const &velocity_ned)
{
return str << "[velocity_north_m_s: " << velocity_ned.north_m_s
<< ", velocity_east_m_s: " << velocity_ned.east_m_s
<< ", velocity_down_m_s: " << velocity_ned.down_m_s << "]";
}

std::ostream &operator<<(std::ostream &str,
Telemetry::PositionVelocityNED const &position_velocity_ned)
{
return str << "[position_north_m: " << position_velocity_ned.position.north_m
<< ", position_east_m: " << position_velocity_ned.position.east_m
<< ", position_down_m: " << position_velocity_ned.position.down_m << "] "
<< "[velocity_north_m_s: " << position_velocity_ned.velocity.north_m_s
<< ", velocity_east_m_s: " << position_velocity_ned.velocity.east_m_s
<< ", velocity_down_m_s: " << position_velocity_ned.velocity.down_m_s << "]";
}

bool operator==(const Telemetry::Health &lhs, const Telemetry::Health &rhs)
{
return lhs.gyrometer_calibration_ok == rhs.gyrometer_calibration_ok &&
Expand Down