// 使用SI单位;车体系X向前、Y向左、逆时针为正,XxxInYyy表示Xxx在Yyy坐标系中。 namespace MyParking.Shared { // 二维坐标点,单位为m。 public readonly struct Point2D { public Point2D(double xMeters, double yMeters) { XMeters = xMeters; YMeters = yMeters; } public double XMeters { get; } public double YMeters { get; } public static Point2D Zero => new Point2D(0.0, 0.0); } // 二维位姿,位置单位为m,航向单位为rad。 public readonly struct Pose2D { public Pose2D( double xMeters, double yMeters, double yawRadians) { XMeters = xMeters; YMeters = yMeters; YawRadians = yawRadians; } public double XMeters { get; } public double YMeters { get; } public double YawRadians { get; } public Point2D Position => new Point2D(XMeters, YMeters); public static Pose2D Identity => new Pose2D(0.0, 0.0, 0.0); } // 二维刚体速度,线速度单位为m/s,角速度单位为rad/s。 public readonly struct Twist2D { public Twist2D( double vxMetersPerSecond, double vyMetersPerSecond, double omegaRadiansPerSecond) { VxMetersPerSecond = vxMetersPerSecond; VyMetersPerSecond = vyMetersPerSecond; OmegaRadiansPerSecond = omegaRadiansPerSecond; } public double VxMetersPerSecond { get; } public double VyMetersPerSecond { get; } public double OmegaRadiansPerSecond { get; } public static Twist2D Zero => new Twist2D(0.0, 0.0, 0.0); } }