mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Also update copyright to include "and other WPILib contributors" and clarify license referral language to not be restricted to FIRST teams.
18 lines
690 B
C++
18 lines
690 B
C++
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
#include "frc/kinematics/ChassisSpeeds.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
static constexpr double kEpsilon = 1E-9;
|
|
|
|
TEST(ChassisSpeeds, FieldRelativeConstruction) {
|
|
const auto chassisSpeeds = frc::ChassisSpeeds::FromFieldRelativeSpeeds(
|
|
1.0_mps, 0.0_mps, 0.5_rad_per_s, frc::Rotation2d(-90.0_deg));
|
|
|
|
EXPECT_NEAR(0.0, chassisSpeeds.vx.to<double>(), kEpsilon);
|
|
EXPECT_NEAR(1.0, chassisSpeeds.vy.to<double>(), kEpsilon);
|
|
EXPECT_NEAR(0.5, chassisSpeeds.omega.to<double>(), kEpsilon);
|
|
}
|