mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Merge branch 'main' into development
This commit is contained in:
@@ -49,3 +49,6 @@ struct WPILIB_DLLEXPORT DifferentialDriveWheelPositions {
|
||||
}
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
|
||||
#include "frc/kinematics/struct/DifferentialDriveWheelPositionsStruct.h"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveWheelPositions.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveWheelPositions> {
|
||||
static google::protobuf::Message* New(google::protobuf::Arena* arena);
|
||||
static frc::DifferentialDriveWheelPositions Unpack(
|
||||
const google::protobuf::Message& msg);
|
||||
static void Pack(google::protobuf::Message* msg,
|
||||
const frc::DifferentialDriveWheelPositions& value);
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
#include <wpi/struct/Struct.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveWheelPositions.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelPositions> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:DifferentialDriveWheelPositions";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 16; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
return "double left;double right";
|
||||
}
|
||||
|
||||
static frc::DifferentialDriveWheelPositions Unpack(
|
||||
std::span<const uint8_t> data);
|
||||
static void Pack(std::span<uint8_t> data,
|
||||
const frc::DifferentialDriveWheelPositions& value);
|
||||
};
|
||||
|
||||
static_assert(wpi::StructSerializable<frc::DifferentialDriveWheelPositions>);
|
||||
@@ -79,7 +79,7 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
*
|
||||
* @param kV The velocity gain, in volts/(unit/sec).
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²).
|
||||
* @throws std::domain_error if kV <= 0 or kA <= 0.
|
||||
* @throws std::domain_error if kV < 0 or kA <= 0.
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
*/
|
||||
@@ -89,8 +89,8 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
static LinearSystem<1, 1, 1> IdentifyVelocitySystem(
|
||||
decltype(1_V / Velocity_t<Distance>(1)) kV,
|
||||
decltype(1_V / Acceleration_t<Distance>(1)) kA) {
|
||||
if (kV <= decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than zero.");
|
||||
if (kV < decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than or equal to zero.");
|
||||
}
|
||||
if (kA <= decltype(kA){0}) {
|
||||
throw std::domain_error("Ka must be greater than zero.");
|
||||
@@ -122,7 +122,7 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
* @param kV The velocity gain, in volts/(unit/sec).
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²).
|
||||
*
|
||||
* @throws std::domain_error if kV <= 0 or kA <= 0.
|
||||
* @throws std::domain_error if kV < 0 or kA <= 0.
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
*/
|
||||
@@ -132,8 +132,8 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
static LinearSystem<2, 1, 1> IdentifyPositionSystem(
|
||||
decltype(1_V / Velocity_t<Distance>(1)) kV,
|
||||
decltype(1_V / Acceleration_t<Distance>(1)) kA) {
|
||||
if (kV <= decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than zero.");
|
||||
if (kV < decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than or equal to zero.");
|
||||
}
|
||||
if (kA <= decltype(kA){0}) {
|
||||
throw std::domain_error("Ka must be greater than zero.");
|
||||
@@ -251,7 +251,7 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
* @param kV The velocity gain, in volts/(unit/sec).
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²).
|
||||
*
|
||||
* @throws std::domain_error if kV <= 0 or kA <= 0.
|
||||
* @throws std::domain_error if kV < 0 or kA <= 0.
|
||||
*/
|
||||
template <typename Distance>
|
||||
requires std::same_as<units::meter, Distance> ||
|
||||
@@ -259,8 +259,8 @@ class WPILIB_DLLEXPORT LinearSystemId {
|
||||
static LinearSystem<2, 1, 2> DCMotorSystem(
|
||||
decltype(1_V / Velocity_t<Distance>(1)) kV,
|
||||
decltype(1_V / Acceleration_t<Distance>(1)) kA) {
|
||||
if (kV <= decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than zero.");
|
||||
if (kV < decltype(kV){0}) {
|
||||
throw std::domain_error("Kv must be greater than or equal to zero.");
|
||||
}
|
||||
if (kA <= decltype(kA){0}) {
|
||||
throw std::domain_error("Ka must be greater than zero.");
|
||||
|
||||
Reference in New Issue
Block a user