mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpimath] Explicitly export wpimath symbols
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
Peter Johnson
parent
161e211734
commit
382deef750
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "frc/geometry/Transform2d.h"
|
||||
#include "units/acceleration.h"
|
||||
@@ -23,12 +25,12 @@ namespace frc {
|
||||
* various States that represent the pose, curvature, time elapsed, velocity,
|
||||
* and acceleration at that point.
|
||||
*/
|
||||
class Trajectory {
|
||||
class WPILIB_DLLEXPORT Trajectory {
|
||||
public:
|
||||
/**
|
||||
* Represents one point on the trajectory.
|
||||
*/
|
||||
struct State {
|
||||
struct WPILIB_DLLEXPORT State {
|
||||
// The time elapsed since the beginning of the trajectory.
|
||||
units::second_t t = 0_s;
|
||||
|
||||
@@ -171,8 +173,10 @@ class Trajectory {
|
||||
}
|
||||
};
|
||||
|
||||
WPILIB_DLLEXPORT
|
||||
void to_json(wpi::json& json, const Trajectory::State& state);
|
||||
|
||||
WPILIB_DLLEXPORT
|
||||
void from_json(const wpi::json& json, Trajectory::State& state);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveKinematics.h"
|
||||
#include "frc/kinematics/MecanumDriveKinematics.h"
|
||||
#include "frc/kinematics/SwerveDriveKinematics.h"
|
||||
@@ -29,7 +31,7 @@ namespace frc {
|
||||
* have been defaulted to reasonable values (0, 0, {}, false). These values can
|
||||
* be changed via the SetXXX methods.
|
||||
*/
|
||||
class TrajectoryConfig {
|
||||
class WPILIB_DLLEXPORT TrajectoryConfig {
|
||||
public:
|
||||
/**
|
||||
* Constructs a config object.
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/spline/SplineParameterizer.h"
|
||||
#include "frc/trajectory/Trajectory.h"
|
||||
#include "frc/trajectory/TrajectoryConfig.h"
|
||||
@@ -19,7 +21,7 @@ namespace frc {
|
||||
/**
|
||||
* Helper class used to generate trajectories with various constraints.
|
||||
*/
|
||||
class TrajectoryGenerator {
|
||||
class WPILIB_DLLEXPORT TrajectoryGenerator {
|
||||
public:
|
||||
using PoseWithCurvature = std::pair<Pose2d, units::curvature_t>;
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/trajectory/Trajectory.h"
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
|
||||
@@ -39,7 +41,7 @@ namespace frc {
|
||||
/**
|
||||
* Class used to parameterize a trajectory by time.
|
||||
*/
|
||||
class TrajectoryParameterizer {
|
||||
class WPILIB_DLLEXPORT TrajectoryParameterizer {
|
||||
public:
|
||||
using PoseWithCurvature = std::pair<Pose2d, units::curvature_t>;
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/trajectory/Trajectory.h"
|
||||
|
||||
namespace frc {
|
||||
class TrajectoryUtil {
|
||||
class WPILIB_DLLEXPORT TrajectoryUtil {
|
||||
public:
|
||||
TrajectoryUtil() = delete;
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
#include "units/acceleration.h"
|
||||
#include "units/curvature.h"
|
||||
@@ -20,7 +22,8 @@ namespace frc {
|
||||
* robot to slow down around tight turns, making it easier to track trajectories
|
||||
* with sharp turns.
|
||||
*/
|
||||
class CentripetalAccelerationConstraint : public TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT CentripetalAccelerationConstraint
|
||||
: public TrajectoryConstraint {
|
||||
public:
|
||||
explicit CentripetalAccelerationConstraint(
|
||||
units::meters_per_second_squared_t maxCentripetalAcceleration);
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveKinematics.h"
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
#include "units/velocity.h"
|
||||
@@ -15,7 +17,8 @@ namespace frc {
|
||||
* commanded velocities for both sides of the drivetrain stay below a certain
|
||||
* limit.
|
||||
*/
|
||||
class DifferentialDriveKinematicsConstraint : public TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT DifferentialDriveKinematicsConstraint
|
||||
: public TrajectoryConstraint {
|
||||
public:
|
||||
DifferentialDriveKinematicsConstraint(
|
||||
const DifferentialDriveKinematics& kinematics,
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/controller/SimpleMotorFeedforward.h"
|
||||
#include "frc/kinematics/DifferentialDriveKinematics.h"
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
@@ -17,7 +19,8 @@ namespace frc {
|
||||
* acceleration of any wheel of the robot while following the trajectory is
|
||||
* never higher than what can be achieved with the given maximum voltage.
|
||||
*/
|
||||
class DifferentialDriveVoltageConstraint : public TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT DifferentialDriveVoltageConstraint
|
||||
: public TrajectoryConstraint {
|
||||
public:
|
||||
/**
|
||||
* Creates a new DifferentialDriveVoltageConstraint.
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
#include "units/math.h"
|
||||
#include "units/velocity.h"
|
||||
@@ -14,26 +16,21 @@ namespace frc {
|
||||
* with the EllipticalRegionConstraint or RectangularRegionConstraint to enforce
|
||||
* a max velocity within a region.
|
||||
*/
|
||||
class MaxVelocityConstraint : public TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT MaxVelocityConstraint : public TrajectoryConstraint {
|
||||
public:
|
||||
/**
|
||||
* Constructs a new MaxVelocityConstraint.
|
||||
*
|
||||
* @param maxVelocity The max velocity.
|
||||
*/
|
||||
explicit MaxVelocityConstraint(units::meters_per_second_t maxVelocity)
|
||||
: m_maxVelocity(units::math::abs(maxVelocity)) {}
|
||||
explicit MaxVelocityConstraint(units::meters_per_second_t maxVelocity);
|
||||
|
||||
units::meters_per_second_t MaxVelocity(
|
||||
const Pose2d& pose, units::curvature_t curvature,
|
||||
units::meters_per_second_t velocity) const override {
|
||||
return m_maxVelocity;
|
||||
}
|
||||
units::meters_per_second_t velocity) const override;
|
||||
|
||||
MinMax MinMaxAcceleration(const Pose2d& pose, units::curvature_t curvature,
|
||||
units::meters_per_second_t speed) const override {
|
||||
return {};
|
||||
}
|
||||
units::meters_per_second_t speed) const override;
|
||||
|
||||
private:
|
||||
units::meters_per_second_t m_maxVelocity;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/kinematics/MecanumDriveKinematics.h"
|
||||
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
|
||||
#include "units/velocity.h"
|
||||
@@ -17,7 +19,8 @@ namespace frc {
|
||||
* commanded velocities for wheels of the drivetrain stay below a certain
|
||||
* limit.
|
||||
*/
|
||||
class MecanumDriveKinematicsConstraint : public TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT MecanumDriveKinematicsConstraint
|
||||
: public TrajectoryConstraint {
|
||||
public:
|
||||
MecanumDriveKinematicsConstraint(const MecanumDriveKinematics& kinematics,
|
||||
units::meters_per_second_t maxSpeed);
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
namespace frc {
|
||||
|
||||
template <size_t NumModules>
|
||||
|
||||
/**
|
||||
* A class that enforces constraints on the swerve drive kinematics.
|
||||
* This can be used to ensure that the trajectory is constructed so that the
|
||||
* commanded velocities of the wheels stay below a certain limit.
|
||||
*/
|
||||
template <size_t NumModules>
|
||||
class SwerveDriveKinematicsConstraint : public TrajectoryConstraint {
|
||||
public:
|
||||
SwerveDriveKinematicsConstraint(
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
namespace frc {
|
||||
|
||||
template <size_t NumModules>
|
||||
|
||||
/**
|
||||
* A class that enforces constraints on the swerve drive kinematics.
|
||||
* This can be used to ensure that the trajectory is constructed so that the
|
||||
* commanded velocities of the wheels stay below a certain limit.
|
||||
*/
|
||||
SwerveDriveKinematicsConstraint<NumModules>::SwerveDriveKinematicsConstraint(
|
||||
const frc::SwerveDriveKinematics<NumModules>& kinematics,
|
||||
units::meters_per_second_t maxSpeed)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "frc/spline/Spline.h"
|
||||
#include "units/acceleration.h"
|
||||
@@ -17,7 +19,7 @@ namespace frc {
|
||||
* An interface for defining user-defined velocity and acceleration constraints
|
||||
* while generating trajectories.
|
||||
*/
|
||||
class TrajectoryConstraint {
|
||||
class WPILIB_DLLEXPORT TrajectoryConstraint {
|
||||
public:
|
||||
TrajectoryConstraint() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user