From 7976b863956aa3a24f2f8bfd5f3eeea964dea119 Mon Sep 17 00:00:00 2001 From: Akshat Pandya Date: Fri, 17 Dec 2021 00:17:04 -0800 Subject: [PATCH] Making API consistent for: 1. DiffDriveOdometry.cc 2. DiffDriveOdometry.hh fix #301 Signed-off-by: Akshat Pandya --- include/ignition/math/DiffDriveOdometry.hh | 4 ++-- src/DiffDriveOdometry.cc | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ignition/math/DiffDriveOdometry.hh b/include/ignition/math/DiffDriveOdometry.hh index 93d272155..ddb9bf16f 100644 --- a/include/ignition/math/DiffDriveOdometry.hh +++ b/include/ignition/math/DiffDriveOdometry.hh @@ -129,8 +129,8 @@ namespace ignition /// \param[in] _wheelSeparation Distance between left and right wheels. /// \param[in] _leftWheelRadius Radius of the left wheel. /// \param[in] _rightWheelRadius Radius of the right wheel. - public: void SetWheelParams(double _wheelSeparation, - double _leftWheelRadius, double _rightWheelRadius); + public: void SetWheelParams(const double _wheelSeparation, + const double _leftWheelRadius, const double _rightWheelRadius); /// \brief Set the velocity rolling window size. /// \param[in] _size The Velocity rolling window size. diff --git a/src/DiffDriveOdometry.cc b/src/DiffDriveOdometry.cc index d184b8e02..b5ccb2254 100644 --- a/src/DiffDriveOdometry.cc +++ b/src/DiffDriveOdometry.cc @@ -29,13 +29,13 @@ class ignition::math::DiffDriveOdometryPrivate /// Runge-Kutta. /// \param[in] _linear Linear velocity. /// \param[in] _angular Angular velocity. - public: void IntegrateRungeKutta2(double _linear, double _angular); + public: void IntegrateRungeKutta2(const double _linear, const double _angular); /// \brief Integrates the velocities (linear and angular) using exact /// method. /// \param[in] _linear Linear velocity. /// \param[in] _angular Angular velocity. - public: void IntegrateExact(double _linear, double _angular); + public: void IntegrateExact(const double _linear, const double _angular); /// \brief Current timestamp. public: clock::time_point lastUpdateTime; @@ -165,8 +165,8 @@ bool DiffDriveOdometry::Update(const Angle &_leftPos, const Angle &_rightPos, } ////////////////////////////////////////////////// -void DiffDriveOdometry::SetWheelParams(double _wheelSeparation, - double _leftWheelRadius, double _rightWheelRadius) +void DiffDriveOdometry::SetWheelParams(const double _wheelSeparation, + const double _leftWheelRadius, const double _rightWheelRadius) { this->dataPtr->wheelSeparation = _wheelSeparation; this->dataPtr->leftWheelRadius = _leftWheelRadius; @@ -212,7 +212,7 @@ const Angle &DiffDriveOdometry::AngularVelocity() const ////////////////////////////////////////////////// void DiffDriveOdometryPrivate::IntegrateRungeKutta2( - double _linear, double _angular) + const double _linear, const double _angular) { const double direction = *this->heading + _angular * 0.5; @@ -223,7 +223,7 @@ void DiffDriveOdometryPrivate::IntegrateRungeKutta2( } ////////////////////////////////////////////////// -void DiffDriveOdometryPrivate::IntegrateExact(double _linear, double _angular) +void DiffDriveOdometryPrivate::IntegrateExact(const double _linear, const double _angular) { if (std::fabs(_angular) < 1e-6) {