Skip to content

Commit

Permalink
Add kraken pinions
Browse files Browse the repository at this point in the history
  • Loading branch information
tervay committed Dec 18, 2023
1 parent c596b50 commit 66a486b
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 15 deletions.
19 changes: 11 additions & 8 deletions src/common/models/ExtraTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export type ParamifyDefaults<DefaultMap extends BaseState> = {
[Name in keyof DefaultMap]: DefaultMap[Name] extends Measurement
? typeof MeasurementParam
: DefaultMap[Name] extends Motor
? typeof MotorParam
: DefaultMap[Name] extends Ratio
? typeof RatioParam
: DefaultMap[Name] extends boolean
? typeof BooleanParam
: null;
? typeof MotorParam
: DefaultMap[Name] extends Ratio
? typeof RatioParam
: DefaultMap[Name] extends boolean
? typeof BooleanParam
: null;
};

export type UseStateObject<T extends BaseState> = {
Expand Down Expand Up @@ -66,21 +66,24 @@ export type PulleyBeltType = "HTD" | "GT2" | "RT25";
export type ChainType = "#25" | "#35";
export type Bore =
| "NEO"
| "Kraken"
| "Falcon"
| "775"
| "550"
| "1/2 Hex"
| "3/8 Hex"
| "0.875in"
| "1.125in"
| "MAXSpline";
export const MotorBores: Bore[] = ["NEO", "Falcon", "775", "550"];
| "MAXSpline"
| "SplineXL";
export const MotorBores: Bore[] = ["NEO", "Kraken", "Falcon", "775", "550"];
export const NonMotorBores: Bore[] = [
"1/2 Hex",
"3/8 Hex",
"0.875in",
"1.125in",
"MAXSpline",
"SplineXL",
];

// Quick units, mostly for tests
Expand Down
8 changes: 4 additions & 4 deletions src/common/models/Gearbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export type MotionMethod = BaseMotionMethod & {
export function MMTypeStr(mm: MotionMethod): string {
let typeStr = "";
if (mm.type === "Gear") {
typeStr = `${(mm as any as GearData).dp} DP`;
typeStr = `${(mm as unknown as GearData).dp} DP`;
} else if (mm.type === "Pulley") {
typeStr = (mm as any as PulleyData).beltType;
typeStr = (mm as unknown as PulleyData).beltType;
} else if (mm.type === "Sprocket") {
typeStr = (mm as any as SprocketData).chainType;
typeStr = (mm as unknown as SprocketData).chainType;
} else if (mm.type === "Planetary") {
const pd = mm as any as PlanetaryData;
const pd = mm as unknown as PlanetaryData;
if (pd.stageSequence === undefined) {
typeStr = "Planetary";
} else {
Expand Down
74 changes: 74 additions & 0 deletions src/common/models/data/cots/wcp/gears.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1008",
"teeth": 10,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1009",
"teeth": 11,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1010",
"teeth": 12,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1011",
"teeth": 12,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1012",
"teeth": 13,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1013",
"teeth": 14,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1014",
"teeth": 14,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1015",
"teeth": 15,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
},
{
"bore": "Kraken",
"dp": 20,
"partNumber": "WCP-1016",
"teeth": 16,
"url": "https://wcproducts.com/products/20dp-motor-gears",
"vendor": "WCP"
}
]
66 changes: 66 additions & 0 deletions src/common/models/data/cots/wcp/pulleys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"bore": "Kraken",
"partNumber": "WCP-1178",
"pitch": {
"s": 3,
"u": "mm"
},
"teeth": 16,
"type": "GT2",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"width": {
"s": 9,
"u": "mm"
},
"vendor": "WCP"
},
{
"bore": "Kraken",
"partNumber": "WCP-1179",
"pitch": {
"s": 3,
"u": "mm"
},
"teeth": 16,
"type": "GT2",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"width": {
"s": 15,
"u": "mm"
},
"vendor": "WCP"
},
{
"bore": "Kraken",
"partNumber": "WCP-1017",
"pitch": {
"s": 5,
"u": "mm"
},
"teeth": 12,
"type": "HTD",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"width": {
"s": 9,
"u": "mm"
},
"vendor": "WCP"
},
{
"bore": "Kraken",
"partNumber": "WCP-1018",
"pitch": {
"s": 5,
"u": "mm"
},
"teeth": 12,
"type": "HTD",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"width": {
"s": 15,
"u": "mm"
},
"vendor": "WCP"
}
]
18 changes: 18 additions & 0 deletions src/common/models/data/cots/wcp/sprockets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"bore": "Kraken",
"partNumber": "WCP-1019",
"teeth": 10,
"type": "#25",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"vendor": "WCP"
},
{
"bore": "Kraken",
"partNumber": "WCP-1020",
"teeth": 12,
"type": "#25",
"url": "https://wcproducts.com/collections/motors-pneumatics/products/kraken",
"vendor": "WCP"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export default function RatioFinderCalculator(): JSX.Element {
get.enableMaxSpline,
get.startingPinionSize,
get.forceStartingPinionSize,
get.enableKrakenPinions,
]);

const [displayNum, setDisplayNum] = useState(20);
Expand Down Expand Up @@ -511,6 +512,14 @@ export default function RatioFinderCalculator(): JSX.Element {
set.setEnableNEOPinions,
],
},
{
name: "Kraken",
stateHook: [
get.enableKrakenPinions,
set.setEnableKrakenPinions,
],
},

{
name: "Falcon",
stateHook: [
Expand Down
1 change: 1 addition & 0 deletions src/web/calculators/ratioFinder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const RatioFinderParamsV1 = {
enableFalconPinions: withDefault(BooleanParam, true),
enable775Pinions: withDefault(BooleanParam, true),
enable550Pinions: withDefault(BooleanParam, true),
enableKrakenPinions: withDefault(BooleanParam, true),

enableVEX: withDefault(BooleanParam, false),
enableREV: withDefault(BooleanParam, true),
Expand Down
10 changes: 7 additions & 3 deletions src/web/calculators/ratioFinder/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ import ttbSprockets from "common/models/data/cots/ttb/sprockets.json";
import vexGears from "common/models/data/cots/vex/gears.json";
import vexPulleys from "common/models/data/cots/vex/pulleys.json";
import vexSprockets from "common/models/data/cots/vex/sprockets.json";
import wcpGears from "common/models/data/cots/wcp/gears.json";
import wcpPulleys from "common/models/data/cots/wcp/pulleys.json";
import wcpSprockets from "common/models/data/cots/wcp/sprockets.json";

function stagesFromMinToMax(
min: number,
Expand Down Expand Up @@ -239,23 +242,23 @@ export function generateOptions(state: RatioFinderStateV1) {
const gears = [
...(state.enableREV ? revGears : []),
...(state.enableAM ? amGears : []),
...(state.enableWCP ? [] : []),
...(state.enableWCP ? wcpGears : []),
...(state.enableTTB ? [] : []),
...(state.enableVEX ? vexGears : []),
];

const pulleys = [
...(state.enableREV ? revPulleys : []),
...(state.enableAM ? amPulleys : []),
...(state.enableWCP ? [] : []),
...(state.enableWCP ? wcpPulleys : []),
...(state.enableTTB ? ttbPulleys : []),
...(state.enableVEX ? vexPulleys : []),
];

const sprockets = [
...(state.enableREV ? revSprockets : []),
...(state.enableAM ? amSprockets : []),
...(state.enableWCP ? [] : []),
...(state.enableWCP ? wcpSprockets : []),
...(state.enableTTB ? ttbSprockets : []),
...(state.enableVEX ? vexSprockets : []),
];
Expand Down Expand Up @@ -286,6 +289,7 @@ export function generateOptions(state: RatioFinderStateV1) {
good = good && (state.enableNEOPinions || m.bore !== "NEO");
good = good && (state.enable775Pinions || m.bore !== "775");
good = good && (state.enable550Pinions || m.bore !== "550");
good = good && (state.enableKrakenPinions || m.bore !== "Kraken");
} else {
good = good && (state.enable12HexBore || m.bore !== "1/2 Hex");
good = good && (state.enable38HexBore || m.bore !== "3/8 Hex");
Expand Down

1 comment on commit 66a486b

@tervay
Copy link
Owner Author

@tervay tervay commented on 66a486b Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for recalc ready!

✅ Preview
https://recalc-hjnzn6irv-tervay.vercel.app

Built with commit 66a486b.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.