Skip to content
Merged
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
16 changes: 16 additions & 0 deletions diff_drive_controller/src/odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ bool Odometry::update(double left_pos, double right_pos, const rclcpp::Time & ti
left_wheel_old_pos_ = left_wheel_cur_pos;
right_wheel_old_pos_ = right_wheel_cur_pos;

// Disable deprecated warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
updateFromVelocity(left_wheel_est_vel, right_wheel_est_vel, time);
#pragma GCC diagnostic pop

return true;
}
Expand Down Expand Up @@ -105,7 +109,11 @@ bool Odometry::updateFromVelocity(double left_vel, double right_vel, const rclcp
const double angular = (right_vel - left_vel) / wheel_separation_;

// Integrate odometry:
// Disable deprecated warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
integrateExact(linear, angular);
#pragma GCC diagnostic pop

timestamp_ = time;

Expand Down Expand Up @@ -152,7 +160,11 @@ void Odometry::updateOpenLoop(double linear, double angular, const rclcpp::Time
/// Integrate odometry:
const double dt = time.seconds() - timestamp_.seconds();
timestamp_ = time;
// Disable deprecated warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
integrateExact(linear * dt, angular * dt);
#pragma GCC diagnostic pop
}

bool Odometry::try_update_open_loop(double linear_vel, double angular_vel, double dt)
Expand Down Expand Up @@ -203,7 +215,11 @@ void Odometry::integrateExact(double linear, double angular)
{
if (fabs(angular) < 1e-6)
{
// Disable deprecated warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
integrateRungeKutta2(linear, angular);
#pragma GCC diagnostic pop
}
else
{
Expand Down