mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add C++20 std::math constants shim (#1788)
Based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0631r7.pdf
This commit is contained in:
committed by
Peter Johnson
parent
dd43109596
commit
37d316aa09
@@ -10,14 +10,13 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <hal/HAL.h>
|
||||
#include <wpi/math>
|
||||
|
||||
#include "frc/DriverStation.h"
|
||||
#include "frc/WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
constexpr double kPi = 3.14159265358979323846;
|
||||
|
||||
Joystick::Joystick(int port) : GenericHID(port) {
|
||||
m_axes[Axis::kX] = kDefaultXChannel;
|
||||
m_axes[Axis::kY] = kDefaultYChannel;
|
||||
@@ -91,5 +90,5 @@ double Joystick::GetDirectionRadians() const {
|
||||
}
|
||||
|
||||
double Joystick::GetDirectionDegrees() const {
|
||||
return (180 / kPi) * GetDirectionRadians();
|
||||
return (180 / wpi::math::pi) * GetDirectionRadians();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user